bcc_group_id = {$cgm}.group_id
) AS bcc_group_member_count
");
+
+ $this->selectAdd("
+ (
+ SELECT
+ COUNT(DISTINCT(crm_person_id))
+ FROM
+ core_notify cn
+ WHERE
+ evtype = 'MAIL'
+ AND
+ person_table = 'crm_person'
+ AND
+ crm_person_id != 0
+ AND
+ ontable = 'crm_mailing_list_queue'
+ AND
+ onid IN
+ (
+ SELECT
+ id
+ FROM
+ crm_mailing_list_queue cmlq
+ WHERE message_id = crm_mailing_list_message.id
+ )
+ AND
+ event_id > 0
+ AND
+ sent IS NOT NULL
+ )
+ +
+ (
+ SELECT
+ COUNT(DISTINCT(person_id))
+ FROM
+ core_notify cn
+ WHERE
+ evtype = 'MAIL'
+ AND
+ person_table = 'Person'
+ AND
+ person_id != 0
+ AND
+ ontable = 'crm_mailing_list_queue'
+ AND
+ onid IN
+ (
+ SELECT
+ id
+ FROM
+ crm_mailing_list_queue cmlq
+ WHERE message_id = crm_mailing_list_message.id
+ )
+ AND
+ event_id > 0
+ AND
+ sent IS NOT NULL
+ )
+ AS sent_to_count
+ ");
+
+ $this->selectAdd("
+ (
+ SELECT
+ COUNT(DISTINCT(crm_person_id))
+ FROM
+ core_notify cn
+ WHERE
+ evtype = 'MAIL'
+ AND
+ person_table = 'crm_person'
+ AND
+ crm_person_id != 0
+ AND
+ ontable = 'crm_mailing_list_queue'
+ AND
+ onid IN
+ (
+ SELECT
+ id
+ FROM
+ crm_mailing_list_queue cmlq
+ WHERE message_id = crm_mailing_list_message.id
+ )
+ AND
+ event_id > 0
+ AND
+ sent IS NOT NULL
+ AND
+ is_open = 1
+ )
+ +
+ (
+ SELECT
+ COUNT(DISTINCT(person_id))
+ FROM
+ core_notify cn
+ WHERE
+ evtype = 'MAIL'
+ AND
+ person_table = 'Person'
+ AND
+ person_id != 0
+ AND
+ ontable = 'crm_mailing_list_queue'
+ AND
+ onid IN
+ (
+ SELECT
+ id
+ FROM
+ crm_mailing_list_queue cmlq
+ WHERE message_id = crm_mailing_list_message.id
+ )
+ AND
+ event_id > 0
+ AND
+ sent IS NOT NULL
+ AND
+ is_open = 1
+ )
+ AS opened_by_count
+ ");
+
+ $this->selectAdd("
+ (
+ SELECT
+ MAX(sent)
+ FROM
+ core_notify cn
+ WHERE
+ evtype = 'MAIL'
+ AND
+ ontable = 'crm_mailing_list_queue'
+ AND
+ onid IN
+ (
+ SELECT
+ id
+ FROM
+ crm_mailing_list_queue cmlq
+ WHERE message_id = crm_mailing_list_message.id
+ )
+ AND
+ event_id > 0
+ AND
+ sent IS NOT NULL
+ )
+ AS last_sent
+ ");
if (!empty($_REQUEST['_hide_system_emails'])) {
$this->whereAddIn("!{$this->tableName()}.name", array('EVENT_ERRORS_REPORT'), 'string');
function get($id,$opts=array())
{
-
+
//print_r($opts);
if (!empty($opts['DB_DataObject-debug'])) {
DB_DataObject::debugLevel($opts['DB_DataObject-debug']);
if (!$w->get($id)) {
$this->errorHandler("invalid id\n");
}
+
if (!$force && strtotime($w->act_when) < strtotime($w->sent)) {
if ($email === false || isset($email['error']) || empty($p)) {
// object returned 'false' - it does not know how to send it..
- $ev = $this->addEvent('NOTIFY', $w, isset($email['error']) ?
+ $ev = $this->addEvent('NOTIFYFAIL', $w, isset($email['error']) ?
$email['error'] : "INTERNAL ERROR - We can not handle " . $w->ontable);
$ww = clone($w);
$w->sent = (!$w->sent || $w->sent == '0000-00-00 00:00:00') ? $w->sqlValue('NOW()') : $w->sent; // do not update if sent.....
require_once 'Validate.php';
if (!Validate::email($p->email, true)) {
- $ev = $this->addEvent('NOTIFY', $w, "INVALID ADDRESS: " . $p->email);
+ $ev = $this->addEvent('NOTIFYFAIL', $w, "INVALID ADDRESS: " . $p->email);
$ww = clone($w);
$w->sent = (!$w->sent || $w->sent == '0000-00-00 00:00:00') ? $w->sqlValue('NOW()') : $w->sent; // do not update if sent.....
$w->msgid = '';
$this->errorHandler(date('Y-m-d h:i:s') . " - MX LOOKUP FAILED\n");
}
- $ev = $this->addEvent('NOTIFY', $w, "BAD ADDRESS - BAD DOMAIN - ". $p->email );
+ $ev = $this->addEvent('NOTIFYFAIL', $w, "BAD ADDRESS - BAD DOMAIN - ". $p->email );
$w->sent = (!$w->sent || $w->sent == '0000-00-00 00:00:00') ? $w->sqlValue('NOW()') : $w->sent; // do not update if sent.....
$w->msgid = '';
$w->event_id = $ev->id;
if (!$force && strtotime($w->act_start) < strtotime('NOW - 14 DAY')) {
- $ev = $this->addEvent('NOTIFY', $w, "BAD ADDRESS - GIVE UP - ". $p->email );
+ $ev = $this->addEvent('NOTIFYFAIL', $w, "BAD ADDRESS - GIVE UP - ". $p->email );
$w->sent = (!$w->sent || $w->sent == '0000-00-00 00:00:00') ? $w->sqlValue('NOW()') :$w->sent; // do not update if sent.....
$w->msgid = '';
$w->event_id = $ev->id;
$errmsg= $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext'];
}
- $ev = $this->addEvent('NOTIFY', $w, ($fail ? "FAILED - " : "RETRY TIME EXCEEDED - ") .
+ $ev = $this->addEvent('NOTIFYFAIL', $w, ($fail ? "FAILED - " : "RETRY TIME EXCEEDED - ") .
$errmsg);
$w->sent = (!$w->sent || $w->sent == '0000-00-00 00:00:00') ? $w->sqlValue('NOW()') : $w->sent; // do not update if sent.....
$w->msgid = '';
// handle no host availalbe forever...
if (strtotime($w->act_start) < strtotime('NOW - 3 DAYS')) {
- $ev = $this->addEvent('NOTIFY', $w, "RETRY TIME EXCEEDED - ". $p->email);
+ $ev = $this->addEvent('NOTIFYFAIL', $w, "RETRY TIME EXCEEDED - ". $p->email);
$w->sent = (!$w->sent || $w->sent == '0000-00-00 00:00:00') ? $w->sqlValue('NOW()') : $w->sent; // do not update if sent.....
$w->msgid = '';
$w->event_id = $ev->id;
"name" : "Pman.Dialog.CoreEmail",
"parent" : "",
"title" : "",
- "path" : "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreEmail.bjs",
+ "path" : "/home/leon/gitlive/web.MediaOutreach/Pman/Core/Pman.Dialog.CoreEmail.bjs",
"permname" : "",
"modOrder" : "001",
"strings" : {
"items" : [
{
"xtype" : "LayoutRegion",
- "tabPosition" : "top",
"$ xns" : "Roo",
+ "tabPosition" : "top",
"* prop" : "center"
},
{
"hidden" : true,
- "title" : "Images / Attachments",
"xtype" : "LayoutRegion",
+ "title" : "Images / Attachments",
"width" : 500,
"$ xns" : "Roo",
"split" : true,
},
{
"autoScroll" : false,
- "fitToFrame" : true,
"region" : "center",
+ "fitToFrame" : true,
"xtype" : "NestedLayoutPanel",
"fitContainer" : true,
"$ xns" : "Roo",
"items" : [
{
"$ url" : "baseURL + '/Core/MailTemplateList.php'",
- "xtype" : "HttpProxy",
"method" : "GET",
+ "xtype" : "HttpProxy",
"$ xns" : "Roo.data",
"* prop" : "proxy"
},
"render" : "function (_self, width, height)\n{\n \n Roo.log(\"RESIZE, \" + width + ',' + height);\n \n var ew = Math.max(250, width-50);\n var eh = Math.max(250,height-50) ;\n \n \n\n}"
},
"autoScroll" : false,
- "background" : false,
"fitToFrame" : true,
+ "background" : false,
"region" : "center",
"title" : "Message",
"xtype" : "ContentPanel",
"items" : [
{
"$ url" : "baseURL + '/Roo/Core_group'",
- "method" : "GET",
"xtype" : "HttpProxy",
+ "method" : "GET",
"$ xns" : "Roo.data",
"* prop" : "proxy"
},
"items" : [
{
"hideLabels" : true,
- "style" : "text-align:center;",
"legend" : "Html Editor",
+ "style" : "text-align:center;",
"xtype" : "FieldSet",
"$ xns" : "Roo.form",
"items" : [
"autosave" : "function (_self)\n{\n Roo.log('autosave');\n \n var id = _this.form.findField('id').getValue() * 1;\n \n /*\n if(!_self.editorcore.sourceEditMode){\n _self.syncValue();\n }else{\n _self.pushValue();\n }\n */\n \n new Pman.Request({\n url : baseURL + '/Roo/Events.php',\n method :'POST',\n params : {\n id : 0,\n action : 'AUTOSAVE',\n on_id : (id > 0) ? id : 0,\n on_table : 'crm_mailing_list_message',\n remarks : 'BODY',\n source: _self.getValue()\n },\n success : function() {\n _self.originalValue = _self.getValue();\n \n },\n failure : function() \n {\n Roo.log('body autosave failed?!');\n }\n });\n \n}"
},
"bool allowComments" : true,
- "| function autosave" : "function() {\n \n var body = _this.form.findField('bodytext');\n \n if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){\n Roo.log('body not dirty');\n return;\n }\n \n Roo.log('body dirty, auto save!');\n \n body.fireEvent('autosave', body);\n \n}\n",
"xtype" : "HtmlEditor",
+ "| function autosave" : "function() {\n \n var body = _this.form.findField('bodytext');\n \n if(!body.wrap.isVisible(true) || body.getValue() == '' || !body.isDirty()){\n Roo.log('body not dirty');\n return;\n }\n \n Roo.log('body dirty, auto save!');\n \n body.fireEvent('autosave', body);\n \n}\n",
"$ cwhite" : "[ \n 'background',\n 'background-color',\n 'border',\n 'border-radius',\n 'border-bottom',\n 'border-left',\n 'border-right',\n 'border-top',\n 'border-collapse',\n 'border-color',\n 'border-style',\n 'border-width',\n\n \n 'box-shadow',\n 'clear',\n 'color',\n 'cursor',\n 'display',\n 'float' ,\n 'font-family',\n 'font-size',\n 'font-style', \n 'font-weight',\n\n 'height',\n 'left',\n 'line-height',\n 'list-style',\n 'margin',\n 'margin-bottom',\n 'margin-left',\n 'margin-right',\n 'margin-top',\n 'max-width',\n 'min-height',\n '-ms-interpolation-mode',\n 'mso-table-rspace',\n '-ms-text-size-adjust',\n 'outline',\n 'overflow',\n 'padding',\n 'padding-bottom',\n 'padding-left',\n 'padding-right',\n 'padding-top',\n 'position',\n 'right',\n 'text-align',\n 'text-decoration',\n 'top',\n 'vertical-align',\n '-webkit-text-size-adjust',\n 'width',\n 'width',\n 'z-index'\n ]",
"boolean autoClean" : false,
"$ xns" : "Roo.form",
"items" : [
{
"$ url" : "baseURL + '/Roo/Images.php'",
- "method" : "GET",
"xtype" : "HttpProxy",
+ "method" : "GET",
"$ xns" : "Roo.data",
"* prop" : "proxy"
},
"items" : [
{
"hideLabels" : true,
- "style" : "text-align:center;",
"legend" : "Plain Text",
+ "style" : "text-align:center;",
"xtype" : "FieldSet",
"$ xns" : "Roo.form",
"items" : [
"|activate" : "function() {\n _this.ipanel = this;\n if (_this.igrid) {\n _this.igrid.ds.load({});\n }\n}"
},
"autoScroll" : false,
- "background" : false,
"fitToframe" : true,
+ "background" : false,
"region" : "east",
"title" : "Images / Attachments",
"xtype" : "GridPanel",
"items" : [
{
"$ url" : "baseURL + '/Roo/Images.php'",
- "method" : "GET",
"xtype" : "HttpProxy",
+ "method" : "GET",
"$ xns" : "Roo.data",
"* prop" : "proxy"
},
},
{
"xtype" : "ColumnModel",
- "header" : "Filename",
"width" : 300,
+ "header" : "Filename",
"$ renderer" : "function(v,x,r)\n{\n var width = r.data.width;\n var height = r.data.height;\n \n if(width > 50){\n height = Math.round(height * 50 / width);\n width = 50;\n }\n \n return '<img src=\"' + baseURL + '/Images/' + r.data.id + '/' + r.data.filename + '\" width=\"' + width + '\" height=\"' + height + '\" />';\n}",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
},
{
"xtype" : "ColumnModel",
- "width" : 75,
"header" : "Displayorder",
+ "width" : 75,
"$ renderer" : "function(v) { return String.format('{0}', v); }",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
},
{
"xtype" : "ColumnModel",
- "header" : "Title",
"width" : 75,
+ "header" : "Title",
"$ renderer" : "function(v) { return String.format('{0}', v); }",
"$ xns" : "Roo.grid",
"* prop" : "colModel[]",
]
}
]
-}
\ No newline at end of file
+}