delete relations from recurring entity and highlight repeat on event dashboard
authorunknown <priyanka.karan26@gmail.com>
Sat, 6 Sep 2014 21:58:51 +0000 (22:58 +0100)
committerdeepak-srivastava <deepak.srivastava.0303@gmail.com>
Fri, 3 Oct 2014 08:55:16 +0000 (09:55 +0100)
CRM/Core/BAO/RecurringEntity.php
CRM/Core/Form/RecurringEntity.php
CRM/Event/BAO/Event.php
CRM/Event/Page/ManageEvent.php

index 3622a4b0cb5d4a8d98e4ea928aeecbb14b20a2f1..173674125d6e8137b2b740e51833f36f07dc19fa 100644 (file)
@@ -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()){
index 7cb10b4031de8303f4d17e4880b6d8b4a55246d5..5f8ae2c68f4486224bfe7647f47f0cb4418e08b1 100644 (file)
@@ -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');
index 6139c692473297f00490cbe6bdf929e6be335562..a941e2b1ea09f455aa1f7290d5f6d97058c0e4c5 100644 (file)
@@ -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) {
index 0f4f6916a9c05100b45ce0a0734a9d5fe49b7e72..baf2f3668a4f624d0d9321ec7f5f30b4ac194585 100644 (file)
@@ -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',
         );
 
     }