X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FCore_notify.php;h=dbf012bb5b2c3aa37b43af22c5e35ffea6d2847f;hp=a445ded42b7a9d79c37aedfe4ab8303b515a894f;hb=1524f8b36295809a3eedd6da3c6494f8aa0d86f5;hpb=5059b4f75f6a221e9c7480b4e53176d6c189638f diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php index a445ded4..dbf012bb 100644 --- a/DataObjects/Core_notify.php +++ b/DataObjects/Core_notify.php @@ -20,7 +20,7 @@ CREATE TABLE core_notify ( ); **/ -require_once 'DB/DataObject.php'; +class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php'; class Pman_Core_DataObjects_Core_notify extends DB_DataObject { @@ -55,8 +55,6 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject if ($set !== false) { $this->person_table = is_object($set) ? $set->tableName() : ''; - - $person_table = empty($this->person_table) ? $def_pt : strtolower($this->person_table); $col = $person_table == $def_pt ? 'person_id' : $person_table . '_id'; @@ -71,7 +69,7 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject return $cache[$person_table .':'. $this->{$col}]; } - $c = DB_DataObject::Factory($person_table); + $c = DB_DataObject::Factory($person_table == 'person' ? 'core_person' : $person_table); $c->get($this->{$col}); $cache[$person_table .':'. $this->{$col}] = $c; return $c; @@ -318,4 +316,23 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject } + function sendManual() + { + require_once 'Pman/Core/NotifySend.php'; + + $send = new Pman_Core_NotifySend(); + $send->error_handler = 'exception'; + + try { + $send->get($this->id, array()); + } catch (Exception $e) { + ob_end_clean(); + return $e; + } + + ob_end_clean(); + + return true; + } + }