Added possibility to duplicate a campaign

This commit is contained in:
Andreas Teuber 2019-03-07 19:15:28 +01:00
parent f2ed0e8ce2
commit 2b11a319b4
3 changed files with 30 additions and 0 deletions

View file

@ -365,6 +365,17 @@ module.exports.getLinks = (id, linkId, callback) => {
});
};
module.exports.duplicate = (id, callback) => module.exports.get(id, true, (err, campaign) => {
if (err) {
return callback(err);
}
if (!campaign) {
return callback(new Error(_('Campaign does not exist')));
}
campaign.name = campaign.name + ' Copy';
return module.exports.create(campaign, false, callback);
});
module.exports.create = (campaign, opts, callback) => {
campaign = tools.convertKeys(campaign);