DataObjects/Core_email.php
[Pman.Core] / DataObjects / Core_email.php
index 5844e6d..ead232f 100644 (file)
@@ -88,6 +88,7 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
             $c->group_id = $this->to_group_id;
                         
             if (!$c->count()) {
+                //cannot go to second check
                 if (!empty($request['_ignore_group_count'])) {
                     if (!$request['_ignore_group_count']) {
                         $roo->jerr('no_member',array('errcode'=> 100));
@@ -359,7 +360,7 @@ class Pman_Core_DataObjects_Core_email extends DB_DataObject
         
         // fill in BCC
         
-        if (!empty($this->bcc_group_id) && empty($contents['rcpts_group'])) {
+        if (!empty($this->bcc_group_id) && $this->bcc_group_id > 0 && empty($contents['rcpts_group'])) {
             $admin = DB_DAtaObject::Factory('core_group')->lookupMembersByGroupId($this->bcc_group_id,'email');
             
             if (empty($admin)) {
@@ -539,16 +540,15 @@ Content-Transfer-Encoding: 7bit
             file_put_contents($cachePath, $this->bodytext);
             return;
         }
-        // use-file
-        $mailtext = file_get_contents($this->use_file);
-        
+        // use-file -- uses the original template...
+        $mailtext = file_get_contents($this->use_file);        
          
         require_once 'Mail/mimeDecode.php';
         require_once 'Mail/RFC822.php';
         
         $decoder = new Mail_mimeDecode($mailtext);
         $parts = $decoder->getSendArray();
-        file_put_contents($parts[2], $this->bodytext);
+        file_put_contents($cachePath,$parts[2]);
          
     }
     
@@ -597,6 +597,17 @@ Content-Transfer-Encoding: 7bit
             return false;
         }
         
+        if (!empty($this->use_file)) {
+            $ctime = filemtime($cachePath);
+            $mtime = filemtime($this->use_file);
+            if($ctime >= $mtime){
+                return true;
+            }
+            return false;
+            
+        }
+        
+        
         
         $ctime = filemtime($cachePath);
         $mtime = array();