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)
return !empty($this->msgid);
}
+ function whereAddUndelivered()
+ {
+ $tn = $this->tableName();
+ $this->whereAdd("$tn.msgid IS NULL OR $tn.msgid = ''");
+ }
+
function status() // used by commandline reporting at present..
{
switch($this->event_id) {
case -1:
- return 'DELIVERED';
+ return 'DELIVERED'; //not valid..
case 0:
return 'PENDING';
default:
//DB_DAtaObject::DebugLevel(1);
// then we can build a join..
$d = DB_DataObject::Factory($q['ontable']);
- $d->autoJoin();
+ $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 .= "
LEFT JOIN {$d->tableName()} ON {$this->tableName()}.onid = {$d->tableName()}.id
switch ($q['query']['status']) {
case 'SUCCESS';
- $this->whereAdd("msgid != ''");
+ $this->whereAdd("msgid != ''");
break;
case 'FAILED';
- $this->whereAdd('event_id > 0 AND act_when <= NOW() ');
- $this->is_active = 0;
+
+ $this->whereAdd("msgid = '' AND event_id > 0 AND act_when < NOW()");
+
break;
case 'PENDING';
-
- $this->is_active = 0;
+ $this->whereAdd('event_id = 0 OR (event_id > 0 AND act_when > NOW() )');
break;
case 'ALL':
default: