Pman/Images.php
[Pman.Base] / Pman / Roo.php
index 2dba59b..7597356 100644 (file)
@@ -46,7 +46,7 @@ class Pman_Roo extends Pman
      * -- defaults to listing data. with args.
      * 
      * !colname=....                 => colname != ....
-     * colname[0]=... colname[1]=... => colname IN (.....)
+     * colname[0]=... colname[1]=... => colname IN (.....) ** only supports main table at present..
      * 
      * other opts:
      * _post      = simulate a post with debuggin on.
@@ -73,7 +73,7 @@ class Pman_Roo extends Pman
     function get($tab)
     {
          //  $this->jerr("Not authenticated", array('authFailure' => true));
-         //DB_DataObject::debuglevel(1);
+        // DB_DataObject::debuglevel(1);
         
         // debugging...
         if (!empty($_GET['_post'])) {
@@ -555,7 +555,7 @@ class Pman_Roo extends Pman
         // collect tables
         
        // echo '<PRE>';print_r($affects);exit;
-       DB_Dataobject::debugLevel(1);
+       //DB_Dataobject::debugLevel(1);
        
         
         $clean = create_function('$v', 'return (int)$v;');
@@ -579,9 +579,12 @@ class Pman_Roo extends Pman
             foreach($affects as $k=> $true) {
                 $ka = explode('.', $k);
                 $chk = DB_DataObject::factory($ka[0]);
-                $chk->{$ka[1]} =  $xx->id;
+                if (!is_a($chk,'DB_DataObject')) {
+                    $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');
+                    $this->jerr('Delete Dependant records first ('. $ka[0]. ':' . $ka[1] .'='.$xx->$pk.')');
                 }
             }
             
@@ -808,7 +811,7 @@ class Pman_Roo extends Pman
                     
                 }
                 if (count($ar)) {
-                    $x->whereAddIn($key,$ar, $quote ? 'string' : 'int');
+                    $x->whereAddIn($x->tableName(). '.'.$key,$ar, $quote ? 'string' : 'int');
                 }
                 
                 continue;