function processRelacements($replace_links = true)
{
- $cfg = HTML_FlexyFramework::get()->Pman_Crm;
+ $cfg = isset(HTML_FlexyFramework::get()->Pman_Crm) ? HTML_FlexyFramework::get()->Pman_Crm : false;
libxml_use_internal_errors (true);
$doc = new DOMDocument('1.0', 'UTF-8');
return;
}
- function send($obj)
+ function send($obj, $force = true, $send = true)
{
$contents = (array)$obj;
- $this->get('name', $contents['template']);
+ if(empty($this->id)){
+ $this->get('name', $contents['template']);
+ }
if(empty($this->id)){
- return false;
+ return PEAR::raiseError("template [{$contents['template']}]has not been set");
}
$contents['subject'] = $this->subject;
$cachePath = session_save_path() . '/email-cache-' . $ui['name'] . '/mail/' . $this->tableName() . '-' . $this->id . '.txt';
if(!$this->isGenerated($cachePath)){
- $this->cachedMailWithOutImages(true, false);
+ $this->cachedMailWithOutImages($force, false);
}
require_once 'Pman/Core/Mailer.php';
$templateDir = session_save_path() . '/email-cache-' . $ui['name'] ;
+
$r = new Pman_Core_Mailer(array(
'template'=> $this->tableName() . '-' . $this->id,
'templateDir' => $templateDir,
$ret = $r->toData();
+ if(!$send){
+ return $ret;
+ }
+
return $r->send($ret);
}