}
-
+ function testData($person, $dt , $core_notify)
+ {
+
+ // should return the formated email???
+ $pg = HTML_FlexyFramework::get()->page;
+
+
+
+
+ if(empty($this->test_class)){
+ $pg->jerr("[{$this->name}] does not has test class");
+ }
+
+ require_once "{$this->test_class}.php";
+
+ $cls = str_replace('/', '_', $this->test_class);
+
+ $x = new $cls;
+
+ $method = "test_{$this->name}";
+
+ if(!method_exists($x, $method)){
+ $pg->jerr("{$method} does not exists in {$cls}");
+ }
+
+ $content = $x->{$method}($this, $person);
+ $content['to'] = $person->getEmailFrom();
+
+ $content['bcc'] = array();
+ $data = $this->toMailerData($content);
+ return $data;
+
+
+ }
}
<?php
/**
*
- * Table is designed to be used with a mailer to notify or issue
+ * Table iend designed to be used with a mailer to notify or issue
* emails (or maybe others later??)
*
*
}
- function sendManual()
+ function sendManual($debug=false)
{
require_once 'Pman/Core/NotifySend.php';
$send = new Pman_Core_NotifySend();
$send->error_handler = 'exception';
+ if ($debug) {
+ $send->get($this->id, array());
+ return true;
+ }
+
try {
$send->get($this->id, array());
} catch (Exception $e) {
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);