Added possibility to duplicate a campaign
This commit is contained in:
parent
f2ed0e8ce2
commit
2b11a319b4
3 changed files with 30 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue