});
},
// @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)
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};
});