From 6abbcdd4b54448ce51e911dc9a5fa97d52871e94 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 14 Oct 2015 14:50:02 +0800 Subject: [PATCH] DataObjects/Core_notify.php --- DataObjects/Core_notify.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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) { -- 2.39.2