Set current user and date when copying events
authorJKingsnorth <john@johnkingsnorth.co.uk>
Tue, 27 Aug 2019 09:34:33 +0000 (10:34 +0100)
committerJKingsnorth <john@johnkingsnorth.co.uk>
Tue, 27 Aug 2019 09:34:33 +0000 (10:34 +0100)
CRM/Event/BAO/Event.php

index 54e4b727bfe0558a11899a5a2594bdfbb7927803..5401999d829b811b4206d104aa2124d15f8f8a24 100644 (file)
@@ -926,6 +926,7 @@ WHERE civicrm_event.is_active = 1
    * @throws \CRM_Core_Exception
    */
   public static function copy($id, $params = []) {
+    $session = CRM_Core_Session::singleton();
     $eventValues = [];
 
     //get the required event values.
@@ -940,7 +941,15 @@ WHERE civicrm_event.is_active = 1
 
     CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $eventParams, $eventValues, $returnProperties);
 
-    $fieldsFix = ['prefix' => ['title' => ts('Copy of') . ' ']];
+    $fieldsFix = [
+      'prefix' => [
+        'title' => ts('Copy of') . ' ',
+      ],
+      'replace' => [
+        'created_id' => $session->get('userID'),
+        'created_date' => date('YmdHis'),
+      ],
+    ];
     if (empty($eventValues['is_show_location'])) {
       $fieldsFix['prefix']['is_show_location'] = 0;
     }