From 657b8692086986e87ca254a332d04b48d9421010 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sun, 8 Feb 2015 15:40:48 -0800 Subject: [PATCH] CRM-15578 - Use server-provided defaults for new mailings. --- js/angular-crmMailing/services.js | 26 ++++++-------------------- js/angular-crmMailingAB/services.js | 12 +++++++++--- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/js/angular-crmMailing/services.js b/js/angular-crmMailing/services.js index c33a120ea2..398d6a0582 100644 --- a/js/angular-crmMailing/services.js +++ b/js/angular-crmMailing/services.js @@ -150,33 +150,19 @@ }); }, // @return Object Mailing (per APIv3) - create: function create() { - return { + create: function create(params) { + var defaults = { jobs: {}, // {jobId: JobRecord} + groups: {include: [], exclude: []}, + mailings: {include: [], exclude: []}, name: "", campaign_id: null, - from_name: crmFromAddresses.getDefault().author, - from_email: crmFromAddresses.getDefault().email, replyto_email: "", subject: "", - groups: {include: [], exclude: []}, - mailings: {include: [], exclude: []}, body_html: "", - body_text: "", - footer_id: null, // pickDefaultMailComponent('Footer'), - header_id: null, // pickDefaultMailComponent('Header'), - visibility: "Public Pages", - url_tracking: "1", - dedupe_email: "1", - forward_replies: "0", - auto_responder: "0", - open_tracking: "1", - override_verp: "1", - optout_id: pickDefaultMailComponent('OptOut'), - reply_id: pickDefaultMailComponent('Reply'), - resubscribe_id: pickDefaultMailComponent('Resubscribe'), - unsubscribe_id: pickDefaultMailComponent('Unsubscribe') + body_text: "" }; + return angular.extend({}, defaults, params); }, // @param mailing Object (per APIv3) diff --git a/js/angular-crmMailingAB/services.js b/js/angular-crmMailingAB/services.js index 61e44b4685..e525e97551 100644 --- a/js/angular-crmMailingAB/services.js +++ b/js/angular-crmMailingAB/services.js @@ -76,9 +76,15 @@ declare_winning_time: null, group_percentage: 10 }; - crmMailingAB.mailings.a = crmMailingMgr.create(); - crmMailingAB.mailings.b = crmMailingMgr.create(); - crmMailingAB.mailings.c = crmMailingMgr.create(); + var mailingDefaults = { + // Most defaults provided by Mailing.create API, but we + // want to force-enable tracking. + open_tracking: "1", + url_tracking: "1" + }; + crmMailingAB.mailings.a = crmMailingMgr.create(mailingDefaults); + crmMailingAB.mailings.b = crmMailingMgr.create(mailingDefaults); + crmMailingAB.mailings.c = crmMailingMgr.create(mailingDefaults); crmMailingAB.attachments.a = new CrmAttachments(function () { return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab.mailing_id_a}; }); -- 2.25.1