Skip to content

Commit dd4d609

Browse files
authored
When copying a campaign use the same redirect approach as the other campaign actions (#859)
1 parent 6c6ef20 commit dd4d609

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

public_html/lists/admin/messages.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,22 +212,26 @@
212212
if (isset($_GET['duplicate'])) {
213213
verifyCsrfGetToken();
214214

215+
$idToDuplicate = sprintf('%d', $_GET['duplicate']);
216+
$action_result .= $GLOBALS['I18N']->get('Copying')." $idToDuplicate ..";
215217
Sql_Query(sprintf('insert into %s (uuid, subject, fromfield, tofield, replyto, message, textmessage, footer, entered,
216218
modified, embargo, repeatuntil, repeatinterval, requeueinterval, status, htmlformatted, sendformat, template, rsstemplate, owner)
217219
select "%s", subject, fromfield, tofield, replyto, message, textmessage, footer, now(),
218220
now(), now(), now(), repeatinterval, requeueinterval, "draft", htmlformatted,
219221
sendformat, template, rsstemplate, "%d" from %s
220222
where id = %d',
221223
$GLOBALS['tables']['message'], (string) Uuid::generate(4), $_SESSION['logindetails']['id'],$GLOBALS['tables']['message'],
222-
intval($_GET['duplicate'])));
224+
$idToDuplicate));
223225
if ($newId = Sql_Insert_Id()) { // if we don't have a newId then the copy failed
224226
Sql_Query(sprintf('insert into %s (id,name,data) '.
225227
'select %d,name,data from %s where name in ("sendmethod","sendurl","campaigntitle","excludelist","subject") and id = %d',
226-
$GLOBALS['tables']['messagedata'],$newId,$GLOBALS['tables']['messagedata'],intval($_GET['duplicate'])));
228+
$GLOBALS['tables']['messagedata'],$newId,$GLOBALS['tables']['messagedata'],$idToDuplicate));
227229
Sql_Query(sprintf('insert into %s (messageid, listid, entered) select %d, listid, now() from %s where messageid = %d',
228-
$GLOBALS['tables']['listmessage'],$newId,$GLOBALS['tables']['listmessage'],intval($_GET['duplicate'])));
230+
$GLOBALS['tables']['listmessage'],$newId,$GLOBALS['tables']['listmessage'],$idToDuplicate));
231+
$action_result .= '... '.$GLOBALS['I18N']->get('Done');
232+
} else {
233+
$action_result .= '... '.$GLOBALS['I18N']->get('failed');
229234
}
230-
231235
}
232236

233237
if (isset($_GET['resend'])) {

0 commit comments

Comments
 (0)