From 72c67af6f1868984ca18374d6625368b10fcc2a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Sep 2014 22:58:51 +0100 Subject: [PATCH] delete relations from recurring entity and highlight repeat on event dashboard --- CRM/Core/BAO/RecurringEntity.php | 1 - CRM/Core/Form/RecurringEntity.php | 6 +++++- CRM/Event/BAO/Event.php | 5 ++++- CRM/Event/Page/ManageEvent.php | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CRM/Core/BAO/RecurringEntity.php b/CRM/Core/BAO/RecurringEntity.php index 3622a4b0cb..173674125d 100644 --- a/CRM/Core/BAO/RecurringEntity.php +++ b/CRM/Core/BAO/RecurringEntity.php @@ -406,7 +406,6 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { static public function generateRecursions($recursionObj, $params=array()){ $newParams = $recursionResult = array(); if($recursionObj && !empty($params)){ - //Proceed only if these keys are found in array if(CRM_Utils_Array::value('parent_event_start_date', $params) && CRM_Utils_Array::value('parent_event_id', $params)){ $count = 1; while($result = $recursionObj->next()){ diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 7cb10b4031..5f8ae2c68f 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -259,9 +259,13 @@ class CRM_Core_Form_RecurringEntity { } } + //Delete relations if any from recurring entity tables before inserting new relations for this entity id + if($params['parent_event_id']){ + CRM_Core_BAO_RecurringEntity::delEntityRelations($params['parent_event_id'], 'civicrm_event'); + } //Give call to create recursions $recurResult = CRM_Core_BAO_RecurringEntity::generateRecursions($recursionObject, $params); - if(!empty($recurResult)){ + if(!empty($recurResult) && $params['parent_event_id']){ CRM_Core_BAO_RecurringEntity::addEntityThroughRecursion($recurResult, $params['parent_event_id']); } $status = ts('Repeat Configuration has been saved'); diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 6139c69247..a941e2b1ea 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -403,13 +403,15 @@ SELECT civicrm_event.id as id, civicrm_event.title as event_title, civicrm_e civicrm_event.end_date as end_date, civicrm_event.is_online_registration, civicrm_event.is_monetary, civicrm_event.is_show_location,civicrm_event.is_map as is_map, civicrm_option_value.label as event_type, civicrm_tell_friend.is_active as is_friend_active, civicrm_event.slot_label_id, civicrm_event.summary as summary, - civicrm_pcp_block.id as is_pcp_enabled + civicrm_pcp_block.id as is_pcp_enabled, + civicrm_recurring_entity.id as is_repeating_event FROM civicrm_event LEFT JOIN civicrm_option_value ON ( civicrm_event.event_type_id = civicrm_option_value.value AND civicrm_option_value.option_group_id = %1 ) LEFT JOIN civicrm_tell_friend ON ( civicrm_tell_friend.entity_id = civicrm_event.id AND civicrm_tell_friend.entity_table = 'civicrm_event' ) LEFT JOIN civicrm_pcp_block ON ( civicrm_pcp_block.entity_id = civicrm_event.id AND civicrm_pcp_block.entity_table = 'civicrm_event') +LEFT JOIN civicrm_recurring_entity ON ( civicrm_event.id = civicrm_recurring_entity.entity_id AND civicrm_recurring_entity.entity_table = 'civicrm_event' ) WHERE civicrm_event.is_active = 1 AND ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0) AND civicrm_event.start_date >= DATE_SUB( NOW(), INTERVAL 7 day ) @@ -541,6 +543,7 @@ $event_summary_limit $eventSummary['events'][$dao->id]['is_subevent'] = $dao->slot_label_id; $eventSummary['events'][$dao->id]['is_pcp_enabled'] = $dao->is_pcp_enabled; $eventSummary['events'][$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mappingID); + $eventSummary['events'][$dao->id]['is_repeating_event'] = $dao->is_repeating_event; $statusTypes = CRM_Event_PseudoConstant::participantStatus(); foreach ($statusValues as $statusId => $statusValue) { diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php index 0f4f6916a9..baf2f3668a 100644 --- a/CRM/Event/Page/ManageEvent.php +++ b/CRM/Event/Page/ManageEvent.php @@ -165,7 +165,7 @@ class CRM_Event_Page_ManageEvent extends CRM_Core_Page { array( 'title' => ts('Repeat'), 'url' => 'civicrm/event/manage/repeat', - 'field' => 'is_recurring_event', + 'field' => 'is_repeating_event', ); } -- 2.25.1