From 005db35df95cc61f45ff98767cf30c7e175b73fc Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 23 Nov 2014 20:02:10 -0800 Subject: [PATCH] Fixes mail-copy function. --- e107_admin/mailout.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 6a1904e05..dda225b1c 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -527,9 +527,17 @@ class mailout_main_ui extends e_admin_ui } - function afterCopy($result,$id) + function afterCopy($firstInsert, $copied) { - if($result == true) + $num = array(); + $count = 0; + foreach($copied as $tmp) + { + $num[] = ($firstInsert + $count); + $count ++; + } + + if(!empty($firstInsert)) { $update = array( 'mail_content_status' => MAIL_STATUS_TEMP, @@ -541,14 +549,15 @@ class mailout_main_ui extends e_admin_ui 'mail_start_send' => '', 'mail_end_send' => '', 'mail_create_date' => time(), - 'WHERE' => "mail_source_id IN (".implode(",",$id).")" // FIXME Currently modifies the original instead of the copy. + 'WHERE' => "mail_source_id IN (".implode(",",$num).")" // FIXME Currently modifies the original instead of the copy. ); - + if(!e107::getDb()->update('mail_content',$update)) { - e107::getMessage()->addError(print_a($update,true)); + e107::getMessage()->addDebug(print_a($update,true)); } + } }