X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_notify.php;h=87b5a74ce6cfa1f63cc54f8c87e4debbe239e38d;hb=960e3f15f3e5b55365c4d382b8882d144f222592;hp=c6e8f5e2408208e030c07c05b8aa02a570274415;hpb=437e9d6c1855f6074743f1476b1f06ce9ef861d1;p=Pman.Core diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php index c6e8f5e2..87b5a74c 100644 --- a/DataObjects/Core_notify.php +++ b/DataObjects/Core_notify.php @@ -77,6 +77,11 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject return false; } + function beforeDelete($dependants_array, $roo) { + if ($this->delivered()) { + $roo->jerr("you can not delete a record of a successfull delivery"); + } + } function act_start($set = false) @@ -109,7 +114,7 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject { switch($this->event_id) { case -1: - return 'DELIVERED'; + return 'DELIVERED'; //not valid.. case 0: return 'PENDING'; default: @@ -130,7 +135,13 @@ 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']); - $d->autoJoin(); + $ji = $d->autoJoin(); + //print_R($jinfo); + // get cols + foreach($ji['cols'] as $cname=>$fname) { + $this->selectAdd($fname . ' as ontable_id_' . $cname ); + } + //$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 @@ -146,10 +157,11 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject switch ($q['query']['status']) { case 'SUCCESS'; - $this->whereAdd("event_id < 0"); + $this->whereAdd("msgid != ''"); break; case 'FAILED'; - $this->whereAdd('event_id > 0 AND act_when <= NOW() '); + + $this->whereAdd("msgid = '' AND event_id > 0 AND act_when < NOW()"); break; case 'PENDING';