X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FCore_notify.php;h=c6e8f5e2408208e030c07c05b8aa02a570274415;hp=95a14e1eb45a174ff7715a5f232bca3cdde8f65c;hb=437e9d6c1855f6074743f1476b1f06ce9ef861d1;hpb=d8a06f490383b2ca49bea0f8f1a3494feb7f52c3 diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php index 95a14e1e..c6e8f5e2 100644 --- a/DataObjects/Core_notify.php +++ b/DataObjects/Core_notify.php @@ -64,11 +64,13 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject return $set; } $c = DB_DataObject::factory($this->ontable); + if ($this->onid == 0) { return $c; // empty dataobject. } $c->autoJoin(); + if ($c->get($this->onid)) { return $c; } @@ -100,7 +102,7 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject } function delivered() { - return !empty($msgid); + return !empty($this->msgid); } function status() // used by commandline reporting at present.. @@ -129,7 +131,7 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject // then we can build a join.. $d = DB_DataObject::Factory($q['ontable']); $d->autoJoin(); - //$this->selectAdd($d->_query['data_select']); + //$this->selectAdd($d->_query['data_select']); -- this will cause the same dataIndex... $this->_join .= " LEFT JOIN {$d->tableName()} ON {$this->tableName()}.onid = {$d->tableName()}.id {$d->_join} @@ -140,6 +142,24 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject $this->whereAdd( "join_person_id_id.name LIKE '{$this->escape($q['query']['person_id_name'])}%'"); } + if (!empty($q['query']['status'])) { + switch ($q['query']['status']) { + + case 'SUCCESS'; + $this->whereAdd("event_id < 0"); + break; + case 'FAILED'; + $this->whereAdd('event_id > 0 AND act_when <= NOW() '); + + break; + case 'PENDING'; + $this->whereAdd('event_id = 0 OR (event_id > 0 AND act_when > NOW() )'); + break; + case 'ALL': + default: + break; + } + }