From: Alan Knowles Date: Wed, 14 Oct 2015 06:50:02 +0000 (+0800) Subject: DataObjects/Core_notify.php X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=6abbcdd4b54448ce51e911dc9a5fa97d52871e94;hp=30209f25f39b9e8b800eaaa551ef9b236600f5a1 DataObjects/Core_notify.php --- diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php index 4c02e6f1..dc6bfcab 100644 --- a/DataObjects/Core_notify.php +++ b/DataObjects/Core_notify.php @@ -193,6 +193,42 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject } } + /** + * current state of process + * + * 0 = pending + * 1 = delivered + * -1 = failed + * + * + */ + function state() + { + + if ($this->msgid != '') { + return 1; + } + // msgid is empty now.. + if ($this->event_id > 0 && strtotime($this->act_when) < time()) { + return -1; + } + return 0; // pending + + $this->whereAdd("msgid = '' AND 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 'OPENED'; + $this->whereAdd('is_open > 0'); + break; + + + + } + function applyFilters($q, $au, $roo) {