CRM-20892 Fix issue where saving to the database wasn't creating a new modified_date
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 11 Sep 2017 05:43:57 +0000 (15:43 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 11 Sep 2017 06:37:36 +0000 (16:37 +1000)
CRM/Mailing/BAO/Mailing.php

index 3d3cced20b13e20d6b8a4f1d544fabfeda38b7a7..766da13306e0d3628b5d5616faabcb94ea56236c 100644 (file)
@@ -1600,11 +1600,19 @@ ORDER BY   civicrm_email.is_bulkmail DESC
     ) {
       $params['replyto_email'] = $params['from_email'];
     }
-
     $mailing->copyValues($params);
 
+    // CRM-20892 Unset Modifed Date here so that MySQL can correctly set an updated modfied date.
+    unset($mailing->modified_date);
     $result = $mailing->save();
 
+    // CRM-20892 Re find record after saing so we can set the updated modified date in the result.
+    $mailing->find(TRUE);
+
+    if (isset($mailing->modified_date)) {
+      $result->modified_date = $mailing->modified_date;
+    }
+
     if (!empty($ids['mailing'])) {
       CRM_Utils_Hook::post('edit', 'Mailing', $mailing->id, $mailing);
     }