public $owner_id;
public $is_system;
public $active;
- public $bcc_group;
+ public $bcc_group_id;
public $test_class;
-
-
+
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
$tn.subject LIKE '%{$this->escape($q['search']['nameortitle'])}%'
");
}
-
+ $cgm = DB_DataObject::Factory('core_group_member')->tableName();;
+
$this->selectAdd("
- (
- SELECT
- count(user_id)
- FROM
- core_group_member
- WHERE
- to_group_id = core_group_member.group_id
- )
- AS group_member_count
+ (
+ SELECT
+ count(id)
+ FROM
+ {$cgm}
+ WHERE
+ to_group_id = {$cgm}.group_id
+ ) AS group_member_count,
+
+ (
+ SELECT
+ count(id)
+ FROM
+ {$cgm}
+ WHERE
+ bcc_group_id = {$cgm}.group_id
+ ) AS bcc_group_member_count
");
}
}
- if ($this->to_group != -1) {
- $c = DB_DataObject::factory('core_group_member');
- //$c->groud_id = $this->to_group;
-
- $c->setFrom(array(
- 'groud_id' => $this->to_group
- ));
-
- if (!$c->find(true)) {
- echo "not found";
+ if ($this->to_group_id != -1) {
+
+ $c = DB_DataObject::factory('core_group_member');
+ $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));
+ }
+ } else {
+ $roo->jerr('no_member',array('errcode'=> 100));
+ }
}
- print_r($this->to_group);
- //print_r($c);
- print_r($c->count());exit;
}
}
// fill in BCC
- if (!empty($this->bcc_group) && empty($contents['rcpts_group'])) {
- $admin = DB_DAtaObject::Factory('core_group')->lookupMembersByGroupId($this->bcc_group,'email');
+ if (!empty($this->bcc_group_id) && empty($contents['rcpts_group'])) {
+ $admin = DB_DAtaObject::Factory('core_group')->lookupMembersByGroupId($this->bcc_group_id,'email');
if (empty($admin)) {
return $p->raiseError("template [{$contents['template']}] - bcc group is empty");
$cfg = array_merge($contents['mailer_opts'], $cfg);
}
+ if(isset($contents['css_inline'])){
+ $cfg['css_inline'] = $contents['css_inline'];
+ }
+
$r = new Pman_Core_Mailer($cfg);
$imageCache = session_save_path() . '/email-cache-' . $ui['name'] . '/mail/' . $this->tableName() . '-' . $this->id . '-images.txt';
$images = json_decode(file_get_contents($imageCache), true);
$r->images = $images;
}
-
+ print_r($r);exit;
return $r;
}
function toMailerData($obj,$force=false)
mkdir(dirname($cachePath), 0700, true);
}
- file_put_contents($cachePath, $this->bodytext);
+ if (empty($this->use_file)) {
+ file_put_contents($cachePath, $this->bodytext);
+ return;
+ }
+ // 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($cachePath,$parts[2]);
+
}
function cachedImages()
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();