Added affiliate pages and email due invoices
This commit is contained in:
@@ -32,6 +32,7 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/email/view/'),
|
||||
'date_orig'=>array('label'=>'Date'),
|
||||
'email'=>array('label'=>'To'),
|
||||
'translate_resolve("subject")'=>array('label'=>'Subject'),
|
||||
'account->accnum()'=>array('label'=>'Cust ID'),
|
||||
'account->name()'=>array('label'=>'Customer'),
|
||||
|
@@ -28,17 +28,18 @@ class Email_Template {
|
||||
$language_id = $this->default_lang;
|
||||
|
||||
$this->etto = $this->template->email_template_translate->where('language_id','=',$language_id)->find();
|
||||
if (! $this->etto->loaded() AND
|
||||
($this->etto = $this->template->email_template_translate->where('language_id','=',$this->default_lang)->find()) AND ! $this->etto->loaded())
|
||||
if (! $this->etto->loaded())
|
||||
$this->etto = $this->template->email_template_translate->where('language_id','=',$this->default_lang)->find();
|
||||
|
||||
// @todo Change this to log/email the admin
|
||||
return;
|
||||
throw new Kohana_Exception('No template (:template) found for user language (:language_id) or default language (:default_lang)',
|
||||
array(':template'=>$this->template->name,':language_id'=>$language_id,':default_lang'=>$this->default_lang));
|
||||
// @todo Change this to log/email the admin
|
||||
return;
|
||||
#throw new Kohana_Exception('No template (:template) found for user language (:language_id) or default language (:default_lang)',
|
||||
# array(':template'=>$this->template->name,':language_id'=>$language_id,':default_lang'=>$this->default_lang));
|
||||
}
|
||||
|
||||
public function __set($key,$value) {
|
||||
switch ($key) {
|
||||
case 'bcc':
|
||||
case 'to':
|
||||
if (! is_array($value) OR ! array_intersect(array('email','account'),array_keys($value)))
|
||||
throw new Kohana_Exception('Values for to should be an array of either "mail" or "account", however :value was given',array(':value'=>serialize($value)));
|
||||
@@ -61,6 +62,7 @@ class Email_Template {
|
||||
|
||||
public function __get($key) {
|
||||
switch ($key) {
|
||||
case 'bcc':
|
||||
case 'to':
|
||||
if (empty($this->email_data[$key]))
|
||||
return array();
|
||||
@@ -134,6 +136,9 @@ class Email_Template {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->email_data['bcc']))
|
||||
$sm->setBcc($this->bcc);
|
||||
|
||||
if ($admin OR ($admin = Config::testmail($this->template->name))) {
|
||||
$sm->setTo($admin);
|
||||
$sa = array(1);
|
||||
@@ -155,6 +160,7 @@ class Email_Template {
|
||||
$elo->clear();
|
||||
|
||||
$elo->account_id = $id;
|
||||
$elo->email = implode(',',array_keys($this->to));
|
||||
$elo->email_template_translate_id = $this->etto->id;
|
||||
$elo->data = $data;
|
||||
$elo->save();
|
||||
|
Reference in New Issue
Block a user