DataObjects/core.sql
[Pman.Core] / DataObjects / Core_notify.php
index 04bdc32..edb070c 100644 (file)
@@ -105,11 +105,34 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject
         return false;
         
     }
+    
+    function triggerEvent()
+    {
+
+        $c = DB_DataObject::factory('Events');
+        
+        if ($c->get($this->trigger_event_id)) {
+            return $c;
+        }
+        return false;
+        
+    }
+    
     function delivered()
     {
         return !empty($this->msgid);
     }
     
+    function whereAddDeliveryStatus($delivered = false)
+    {
+        $tn = $this->tableName();
+        if ($delivered) {
+            $this->whereAdd("$tn.msgid IS NOT NULL AND $tn.msgid != ''");
+        } else {
+            $this->whereAdd("$tn.msgid IS NULL OR $tn.msgid = ''");    
+        }
+    }
+    
     function status() // used by commandline reporting at present..
     {
         switch($this->event_id) {
@@ -135,8 +158,12 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject
             //DB_DAtaObject::DebugLevel(1);
             // then we can build a join..
             $d = DB_DataObject::Factory($q['ontable']);
-            $jinfo = $d->autoJoin();
-            print_R($jinfo);
+            $ji = $d->autoJoin();
+            //echo '<PRE>';print_R($ji);
+            // get cols
+            foreach($ji['join_names'] as $cname=>$fname) {
+                 $this->selectAdd($fname . ' as ontable_id_' . $cname );
+            }
             
             //$this->selectAdd($d->_query['data_select']); -- this will cause the same dataIndex...
             $this->_join .= "