DataObjects/Core_email.php
authorAlan Knowles <alan@roojs.com>
Fri, 3 Jun 2016 07:29:16 +0000 (15:29 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 3 Jun 2016 07:29:16 +0000 (15:29 +0800)
DataObjects/Core_email.php

index f9fc3bb..2c3c3fa 100644 (file)
@@ -296,7 +296,7 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
      *    
      * @param bool $force - force re-creation of cached version of email.
      *
-     * @returns Pman_Core_Mailer
+     * @returns Pman_Core_Mailer||PEAR_Error
      */
     
     function toMailer($obj,$force=false)
@@ -304,8 +304,18 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
         
         $contents = (array)$obj;
 
+         
+        if(empty($this->id) && !empty($contents['template'])){
+            $this->get('name', $contents['template']);
+        }
+        
+        if(empty($this->id)){
+            $p = new PEAR();
+            return $p->raiseError("template [{$contents['template']}] has not been set");
+        }
+        
         // fill in BCC
-        if (!empty($this->bcc_group)) {
+        if (!empty($this->bcc_group) && empty($contents['rcpts_group'])) {
             
             $group = DB_DataObject::factory('groups');
             $group->get($this->bcc_group);
@@ -314,16 +324,15 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
                 $contents->bcc = $ar;
             }
         }
+        if (!empty($contents['rcpts_group'])) {
+            
+            
+            
+        }
         
         
-        if(empty($this->id) && !empty($contents['template'])){
-            $this->get('name', $contents['template']);
-        }
+       
         
-        if(empty($this->id)){
-            $p = new PEAR();
-            return $p->raiseError("template [{$contents['template']}] has not been set");
-        }
         
         if(empty($contents['subject'])){
            $contents['subject'] = $this->subject;