X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=MessagePreview.php;h=6a7e94feeed9e5ab73e7613e066c8550ae8f649c;hb=dff7116c31985c523f927df3e8e7cf50670ef428;hp=badc88b757ced5b74fe8ad11fbd35de3bed075bb;hpb=adde45bdedee4fc1cd726036d974feed77c5906d;p=Pman.Core diff --git a/MessagePreview.php b/MessagePreview.php index badc88b7..6a7e94fe 100644 --- a/MessagePreview.php +++ b/MessagePreview.php @@ -20,6 +20,7 @@ class Pman_Core_MessagePreview extends Pman function get($v, $opts=array()) { + if(empty($_REQUEST['_id']) || empty($_REQUEST['_table'])){ $this->jerr('Missing Options'); } @@ -51,8 +52,8 @@ class Pman_Core_MessagePreview extends Pman 'ontable' => $_REQUEST['_table'], 'person_id' => $this->authUser->id, 'person_table' => 'Person', - 'act_when' => $cn->sqlValue("NOW()"), - 'act_start' => $cn->sqlValue("NOW()") + 'act_when' => $cn->sqlValue("NOW() + INTERVAL 10 MINUTE"), + 'act_start' => $cn->sqlValue("NOW() + INTERVAL 10 MINUTE") )); $cn->insert(); @@ -110,9 +111,38 @@ class Pman_Core_MessagePreview extends Pman if(!method_exists($x, $method)){ $this->jerr("{$method} does not exists in {$cls}"); } - + /* $content = $x->{$method}($this, $this->authUser); + $content['bcc'] = array(); + */ + + + $cn = DB_DataObject::factory('core_notify'); + $cn->setFrom(array( + 'evtype' => 'Core_email::testData', + 'onid' => $_REQUEST['_id'], + 'ontable' => $_REQUEST['_table'], + 'person_id' => $this->authUser->id, + 'person_table' => 'Person', + 'act_when' => $cn->sqlValue("NOW()"), + 'act_start' => $cn->sqlValue("NOW()") + )); + + $cn->insert(); + + $sent = $cn->sendManual(); + + if(get_class($sent) != 'Pman_Core_NotifySend_Exception_Success'){ + $this->jerr($sent->getMessage()); + } + + $this->jok("SUCCESS"); + + + + + $sent = $core_email->send($content); if(is_object($sent)){