DataObjects/Events.php
authorAlan Knowles <alan@roojs.com>
Wed, 28 Sep 2011 06:33:08 +0000 (14:33 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 28 Sep 2011 06:33:08 +0000 (14:33 +0800)
DataObjects/Events.php

index 1bda1d2..d0dd5e5 100644 (file)
@@ -30,34 +30,15 @@ class Pman_Core_DataObjects_Events extends DB_DataObject
     //  ------------ROO HOOKS------------------------------------
     function applyFilters($q, $au)
     {
-        if (!empty($q['query']['person_not_internal'])) {
-            $this->whereAdd(" join_company_id_id.isOwner = 0 ");
+        if (!empty($q['query']['from'])) {
+            $dt = date('Y-m-d' , strtotime($q['query']['from']));
+            $this->whereAdd(" Events.event_when >=  '$dt' ");
         }
-        if (!empty($q['query']['person_internal_only_all'])) {
-            // must be internal and not current user (need for distribution list)
-            $this->whereAdd(" join_company_id_id.comptype = 'OWNER'");
-            
+        if (!empty($q['query']['to'])) {
+            $dt = date('Y-m-d' , strtotime($q['query']['to']));
+            $this->whereAdd(" Events.event_when <=  '$dt' ");
         }
-        // -- for distribution
-        if (!empty($q['query']['person_internal_only'])) {
-            // must be internal and not current user (need for distribution list)
-            $this->whereAdd(" join_company_id_id.comptype = 'OWNER'");
-            
-            //$this->whereAdd(($this->tableName() == 'Person' ? 'Person' : "join_person_id_id") .
-            //    ".id  != ".$au->id);
-            $this->whereAdd("Person.id != {$au->id}");
-        } 
-        
-        if (!empty($q['query']['comptype_or_company_id'])) {
-           // DB_DataObject::debugLevel(1);
-            $bits = explode(',', $q['query']['comptype_or_company_id']);
-            $id = (int) array_pop($bits);
-            $ct = $this->escape($bits[0]);
-            
-            $this->whereAdd(" join_company_id_id.comptype = '$ct' OR Person.company_id = $id");
-            
-        }
-    
+         
     }
     /**
      * check who is trying to access this. false == access denied..