Update copied event reminders to link to new event when creating from template using...
authorufundo <ufundo@gmail.com>
Mon, 18 Apr 2022 14:13:12 +0000 (14:13 +0000)
committerufundo <ufundo@gmail.com>
Mon, 18 Apr 2022 22:37:56 +0000 (22:37 +0000)
CRM/Event/BAO/Event.php

index 0aadbbae0d020bc45214d52da9da88beb7846539..559e651d67fa71f6039de47bfbce95f1894feaf4 100644 (file)
@@ -112,6 +112,19 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event {
         $copy = self::copy($params['template_id']);
         $params['id'] = $copy->id;
         unset($params['template_id']);
+
+        //fix for api from template creation bug
+        civicrm_api4('ActionSchedule', 'update', [
+          'checkPermissions' => FALSE,
+          'values' => [
+            'mapping_id' => CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID,
+          ],
+          'where' => [
+            ['entity_value', '=', $copy->id],
+            ['mapping_id', '=', CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID],
+          ],
+        ]);
+
       }
     }