Pman/Roo.php
[Pman.Base] / Pman / Roo.php
index 1c85686..a0d3058 100644 (file)
@@ -59,7 +59,7 @@ class Pman_Roo extends Pman
      * 
      * csvCols[0] csvCols[1]....    = .... column titles for CSV output
      * 
-     * csvTitle[0], csvTitle[1] ....  = columns to use for CSV output
+     * csvTitles[0], csvTitles[1] ....  = columns to use for CSV output
      *
      * sort        = sort column (',' comma delimited)
      * dir         = sort direction ?? in future comma delimited...
@@ -73,7 +73,8 @@ class Pman_Roo extends Pman
     function get($tab)
     {
          //  $this->jerr("Not authenticated", array('authFailure' => true));
-       //echo '<PRE>';print_R($_GET);  DB_DataObject::debuglevel(1);
+       //echo '<PRE>';print_R($_GET);
+     //  DB_DataObject::debuglevel(1);
         
         $this->init(); // from pnan.
         
@@ -122,7 +123,7 @@ class Pman_Roo extends Pman
                 $this->jerr("PERMISSION DENIED");
             }
             
-            $this->jok(method_exists($x, 'toRooSingleArray') ? $x->toRooSingleArray($this->authUser) : $x->toArray());
+            $this->jok(method_exists($x, 'toRooSingleArray') ? $x->toRooSingleArray($this->authUser, $_REQUEST) : $x->toArray());
             
         }
         if (isset($_REQUEST['_delete'])) {
@@ -153,6 +154,7 @@ class Pman_Roo extends Pman
             $this->jerr("PERMISSION DENIED");
         }
         
+      //  DB_DataObject::debuglevel(1);
         // sets map and countWhat
         $this->loadMap($x, $_columns, empty($_REQUEST['_distinct']) ? false:  $_REQUEST['_distinct']);
         
@@ -617,8 +619,16 @@ class Pman_Roo extends Pman
                     $this->jerr('Unable to load referenced table, check the links config: ' .$ka[0]);
                 }
                 $chk->{$ka[1]} =  $xx->$pk;
-                if ($chk->count()) {
-                    $this->jerr('Delete Dependant records first ('. $ka[0]. ':' . $ka[1] .'='.$xx->$pk.')');
+                $matches = $chk->count();
+                if ($matches) {
+                    $chk->limit(1);
+                    $o = $chk->fetchAll();
+                    $desc =  $ka[0]. ':' . $ka[1] .'='.$xx->$pk;
+                    if (method_exists($chk, 'toEventString')) {
+                        $desc = $ka[0] . ' : ' . $o[0]->toEventString();
+                    }
+                    
+                    $this->jerr("Delete Dependant records ($matches found),  first is ( $desc )");
                 }
             }
             // finally log it..