DataObjects/Events.php
[Pman.Core] / DataObjects / Events.php
index bb554e8..6e34de9 100644 (file)
@@ -74,9 +74,7 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
             }
             
             $jt = DB_DataObject::factory($person);
-            $this->whereAdd("
-                    person_table = *
-                ");
+            //$this->whereAdd("
             //        person_table  = '{$jt->tableName()}'
             //        OR
             //        person_table = ''
@@ -109,13 +107,6 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
         }
         */
         
-        if (!$au->hasPerm("Admin.Admin_Tab", 'S')) {
-            //DB_DataObject::DebugLevel(1);
-            // they can only view their changes..
-            $this->whereAdd("($tn.person_id = {$au->id} OR $tn.person_id = 0)");
-//            $this->person_id = $au->id;
-            
-        }
         // _join = tablename,tablename...
         
         /// on_table=cohead
@@ -220,7 +211,7 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
                 $roo->jerr("ontable is invalid");
             }
             
-            if (!method_exists($obj,'relatedWhere') && !method_exists($obj,'relatedEventsWhere')) {
+            if (!method_exists($obj,'relatedWhere')) {
                 $roo->jerr( $q['_related_on_table'] . " Does not have method relatedWhere  or relatedEventsWhere:" .
                            implode(',', get_class_methods($obj)));
             }
@@ -245,17 +236,10 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
                 $this->whereAdd(implode(' OR ' , $w));
             }
             
-            if ($obj && method_exists($obj,'relatedEventsWhere')) {
-                $a = $obj->relatedEventsWhere($q,$roo);
-                if($a){
-                    $this->whereAdd($a);
-                }
-            }
-            
-            
-            
+         
             
         }
+        
         // since roo does not support autojoin yet..
         if (!isset($q['_distinct'])) {
             //$this->autoJoinExtra();
@@ -272,8 +256,17 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
         } 
         
     }
-      
     
+    function applyPermissionFilters($q, $au ,$roo)
+    {
+        if (!$au->hasPerm("Admin.Admin_Tab", 'S') &&  !$au->hasPerm("BAdmin.BAdmin", 'S')) {
+            //DB_DataObject::DebugLevel(1);
+            // they can only view their changes..
+            $this->whereAdd("($tn.person_id = {$au->id} OR $tn.person_id = 0)");
+//            $this->person_id = $au->id;
+            
+        }
+    }
     
     /**
      * check who is trying to access this. false == access denied..
@@ -716,4 +709,6 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
         $this->selectAdd('join_person_id_id.email as email');
         
     }
+    
+    
 }