From cd96b0a9c297096446c662b447f07db53917dd38 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Oct 2014 21:41:15 +0100 Subject: [PATCH] Towards generalising comfirm box, postprocess delete function --- CRM/Activity/Form/Activity.php | 2 + CRM/Core/BAO/RecurringEntity.php | 14 ++ CRM/Core/Form/RecurringEntity.php | 1 + templates/CRM/Activity/Form/Activity.tpl | 28 ++++ .../Form/ManageEvent/ConfirmRepeatMode.tpl | 127 +++++++----------- templates/CRM/Event/Form/ManageEvent/Tab.tpl | 2 +- 6 files changed, 98 insertions(+), 76 deletions(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 2de952d77f..cedcdaf820 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -505,6 +505,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } if ($this->_action & CRM_Core_Action::UPDATE) { + $mapper = array('CRM_Activity_Form_Activity' => ''); + $this->assign('mapper', json_encode($mapper)); CRM_Core_Form_RecurringEntity::preProcess('activity'); } } diff --git a/CRM/Core/BAO/RecurringEntity.php b/CRM/Core/BAO/RecurringEntity.php index cf5e88d945..be7fff6abb 100644 --- a/CRM/Core/BAO/RecurringEntity.php +++ b/CRM/Core/BAO/RecurringEntity.php @@ -51,6 +51,20 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { public $isRecurringEntityRecord = TRUE; protected $recursion = NULL; + + static $_recurringEntityHelper = + array( + 'civicrm_event' => array( + 'helper_class' => 'CRM_Event_BAO_Event', + 'delete_func' => 'del', + 'count_func' => '' + ), + 'civicrm_activity' => array( + 'helper_class' => 'CRM_Activity_BAO_Activity', + 'delete_func' => 'del', + 'count_func' => '' + ) + ); static $_tableDAOMapper = array( diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index ea1578b671..340ff84261 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -360,6 +360,7 @@ class CRM_Core_Form_RecurringEntity { //Delete relations if any from recurring entity tables before inserting new relations for this entity id if ($params['entity_id']) { $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], 'civicrm_'.$type, TRUE); + if ($type == 'event') { $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities); //Check if participants exists for events diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index 613b811a91..bfcb5eb37d 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -330,3 +330,31 @@ {/if} {* end of form block*} {/if} {* end of snippet if*} +{literal} + +{/literal} +{foreach from=$mapper key=k item=item} + {$k} {$item} +{/foreach} +{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityType="activity" entityID=$activityId entityTable="civicrm_activity" mapper=$mapper} \ No newline at end of file diff --git a/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl b/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl index b38d3ff429..7a9955b785 100644 --- a/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl +++ b/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl @@ -25,100 +25,77 @@ *}
- {ts}How would you like this change to affect other events in the repetition set?{/ts}

+ {ts}How would you like this change to affect other {$entityType}s in the repetition set?{/ts}

- +
-
{ts}All other events in the series will remain same.{/ts}
+
{ts}All other {$entityType}s in the series will remain same.{/ts}
- +
-
{ts}Change applies to this and all the following events.{/ts}
+
{ts}Change applies to this and all the following {$entityType}s.{/ts}
- +
-
{ts}Change applies to all the events in the series.{/ts}
+
{ts}Change applies to all the {$entityType}s in the series.{/ts}
-{if $isRepeat eq 'repeat'} {literal} - -{/literal} -{/if} + }); + } + } + }); + + {/literal} \ No newline at end of file diff --git a/templates/CRM/Event/Form/ManageEvent/Tab.tpl b/templates/CRM/Event/Form/ManageEvent/Tab.tpl index eca262bef7..36b790fbe7 100644 --- a/templates/CRM/Event/Form/ManageEvent/Tab.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Tab.tpl @@ -107,4 +107,4 @@ CRM.$(function($) { {/literal} -{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl"} +{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityType="event"} -- 2.25.1