From a50a97b8d6ba3051e1b5fdd0dbdefe9e279a638e Mon Sep 17 00:00:00 2001 From: deepak-srivastava Date: Fri, 3 Oct 2014 13:21:18 +0100 Subject: [PATCH] else to a new line, if-else space corrections --- CRM/Core/Form/RecurringEntity.php | 66 ++++++++++--------- CRM/Core/Page/AJAX/RecurringEntity.php | 26 ++++---- CRM/Event/BAO/Query.php | 10 +-- CRM/Event/Form/ManageEvent.php | 4 +- CRM/Event/Form/ManageEvent/Repeat.php | 56 ++++++++-------- CRM/Event/Form/ManageEvent/TabHeader.php | 2 +- CRM/Event/Page/ManageEvent.php | 7 +- .../CRM/Core/BAO/RecurringEntityTest.php | 2 +- 8 files changed, 92 insertions(+), 81 deletions(-) diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index d401f096b3..888c49b9f1 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -50,7 +50,7 @@ class CRM_Core_Form_RecurringEntity { $form->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units'); foreach ($form->_freqUnits as $val => $label) { - if($label == "day"){ + if ($label == "day") { $label = "dai"; } $freqUnitsDisplay[$val] = ts('%1ly', array(1 => $label)); @@ -68,7 +68,7 @@ class CRM_Core_Form_RecurringEntity { $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30); $form->add('select', 'repetition_frequency_interval', ts('Repeats every:'), $numericOptions, TRUE, array('style' => 'width:55px;')); $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime')); - foreach($dayOfTheWeek as $key => $val){ + foreach($dayOfTheWeek as $key => $val) { $startActionCondition[] = $form->createElement('checkbox', $key, NULL, substr($val." ", 0, 3)); } $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on')); @@ -128,62 +128,68 @@ class CRM_Core_Form_RecurringEntity { $dayOfTheWeek = array(monday,tuesday,wednesday,thursday,friday,saturday,sunday); //Repeats - if(!CRM_Utils_Array::value('repetition_frequency_unit', $values)){ + if (!CRM_Utils_Array::value('repetition_frequency_unit', $values)) { $errors['repetition_frequency_unit'] = ts('This is a required field'); } //Repeats every - if(!CRM_Utils_Array::value('repetition_frequency_interval', $values)){ + if (!CRM_Utils_Array::value('repetition_frequency_interval', $values)) { $errors['repetition_frequency_interval'] = ts('This is a required field'); } //Ends - if(CRM_Utils_Array::value('ends', $values)){ - if($values['ends'] == 1){ + if (CRM_Utils_Array::value('ends', $values)) { + if ($values['ends'] == 1) { if ($values['start_action_offset'] == "") { $errors['start_action_offset'] = ts('This is a required field'); - }else if($values['start_action_offset'] > 30){ + } + else if ($values['start_action_offset'] > 30) { $errors['start_action_offset'] = ts('Occurrences should be less than or equal to 30'); } } - if($values['ends'] == 2){ + if ($values['ends'] == 2) { if ($values['repeat_absolute_date'] != "") { $eventStartDate = CRM_Utils_Date::processDate($values['repetition_start_date']); $end = CRM_Utils_Date::processDate($values['repeat_absolute_date']); if (($end < $eventStartDate) && ($end != 0)) { $errors['repeat_absolute_date'] = ts('End date should be after event\'s start date'); } - }else{ + } + else { $errors['repeat_absolute_date'] = ts('This is a required field'); } } - }else{ + } + else { $errors['ends'] = ts('This is a required field'); } //Repeats BY - if(CRM_Utils_Array::value('repeats_by', $values)){ - if($values['repeats_by'] == 1){ - if($values['limit_to'] != ""){ - if($values['limit_to'] < 1 && $values['limit_to'] > 31){ + if (CRM_Utils_Array::value('repeats_by', $values)) { + if ($values['repeats_by'] == 1) { + if ($values['limit_to'] != "") { + if ($values['limit_to'] < 1 && $values['limit_to'] > 31) { $errors['limit_to'] = ts('Invalid day of the month'); } - }else{ + } + else { $errors['limit_to'] = ts('Invalid day of the month'); } } - if($values['repeats_by'] == 2){ - if($values['entity_status_1'] != "" ) { + if ($values['repeats_by'] == 2) { + if ($values['entity_status_1'] != "" ) { $dayOfTheWeekNo = array(first, second, third, fourth, last); - if(!in_array($values['entity_status_1'], $dayOfTheWeekNo)){ + if (!in_array($values['entity_status_1'], $dayOfTheWeekNo)) { $errors['entity_status_1'] = ts('Invalid option'); } - }else{ + } + else { $errors['entity_status_1'] = ts('Invalid option'); } - if($values['entity_status_2'] != "" ) { - if(!in_array($values['entity_status_2'], $dayOfTheWeek)){ + if ($values['entity_status_2'] != "" ) { + if (!in_array($values['entity_status_2'], $dayOfTheWeek)) { $errors['entity_status_2'] = ts('Invalid day name'); } - }else{ + } + else { $errors['entity_status_2'] = ts('Invalid day name'); } } @@ -199,7 +205,7 @@ class CRM_Core_Form_RecurringEntity { * @return None */ static function postProcess($params=array(), $type) { - if(!empty($type)){ + if (!empty($type)) { $params['used_for'] = $type; } @@ -207,7 +213,7 @@ class CRM_Core_Form_RecurringEntity { $dbParams = CRM_Core_BAO_RecurringEntity::mapFormValuesToDB($params); //Delete repeat configuration and rebuild - if(CRM_Utils_Array::value('id', $params)){ + if (CRM_Utils_Array::value('id', $params)) { CRM_Core_BAO_ActionSchedule::del($params['id']); unset($params['id']); } @@ -215,7 +221,7 @@ class CRM_Core_Form_RecurringEntity { //exclude dates $excludeDateList = array(); - if(CRM_Utils_Array::value('copyExcludeDates', $params) && CRM_Utils_Array::value('parent_event_id', $params)){ + if (CRM_Utils_Array::value('copyExcludeDates', $params) && CRM_Utils_Array::value('parent_event_id', $params)) { //Since we get comma separated values lets get them in array $exclude_date_list = array(); $exclude_date_list = explode(",", $params['copyExcludeDates']); @@ -226,7 +232,7 @@ class CRM_Core_Form_RecurringEntity { 'id', 'name' ); - if($optionGroupIdExists){ + if ($optionGroupIdExists) { CRM_Core_BAO_OptionGroup::del($optionGroupIdExists); } $optionGroupParams = @@ -237,10 +243,10 @@ class CRM_Core_Form_RecurringEntity { 'is_active' => 1 ); $opGroup = CRM_Core_BAO_OptionGroup::add($optionGroupParams); - if($opGroup->id){ + if ($opGroup->id) { $oldWeight= 0; $fieldValues = array('option_group_id' => $opGroup->id); - foreach($exclude_date_list as $val){ + foreach($exclude_date_list as $val) { $optionGroupValue = array( 'option_group_id' => $opGroup->id, @@ -258,12 +264,12 @@ class CRM_Core_Form_RecurringEntity { } //Delete relations if any from recurring entity tables before inserting new relations for this entity id - if($params['event_id']){ + if ($params['event_id']) { $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['event_id'], 'civicrm_event', TRUE); $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities); //Check if participants exists for events foreach ($getRelatedEntities as $key => $value) { - if(!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $params['event_id']){ + if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $params['event_id']) { CRM_Event_BAO_Event::del($value['id']); } } diff --git a/CRM/Core/Page/AJAX/RecurringEntity.php b/CRM/Core/Page/AJAX/RecurringEntity.php index 061a177364..d6536a8e0d 100644 --- a/CRM/Core/Page/AJAX/RecurringEntity.php +++ b/CRM/Core/Page/AJAX/RecurringEntity.php @@ -15,32 +15,34 @@ class CRM_Core_Page_AJAX_RecurringEntity { public static function updateMode() { - if(CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)){ + if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) { $finalResult = array(); $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer'); $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer'); $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String'); - if(CRM_Utils_Array::value('linkedEntityTable', $_REQUEST)){ + if (CRM_Utils_Array::value('linkedEntityTable', $_REQUEST)) { $result = array(); $result = CRM_Event_Form_ManageEvent_Repeat::updateModeRecurringEntityForEvent($entityId, $_REQUEST['linkedEntityTable']); } $dao = new CRM_Core_DAO_RecurringEntity(); - if(!empty($result)){ + if (!empty($result)) { $dao->entity_id = $result['entityId']; $dao->entity_table = $result['entityTable']; - }else{ + } + else { $dao->entity_id = $entityId; $dao->entity_table = $entityTable; } - if($dao->find(TRUE)){ + if ($dao->find(TRUE)) { $dao->mode = $mode; $dao->save(); $finalResult['status'] = 'Done'; - }else{ + } + else { $finalResult['status'] = 'Error'; } } @@ -48,10 +50,10 @@ class CRM_Core_Page_AJAX_RecurringEntity { CRM_Utils_System::civiExit(); } - public static function generatePreview(){ + public static function generatePreview() { $params = $formValues = $genericResult = array(); $formValues = $_REQUEST; - if(!empty($formValues)){ + if (!empty($formValues)) { $recursion = new CRM_Core_BAO_RecurringEntity(); $recursion->dateColumns = array('start_date'); $recursion->scheduleFormValues = $formValues; @@ -61,7 +63,7 @@ class CRM_Core_Page_AJAX_RecurringEntity { } $parentEventId = CRM_Core_BAO_RecurringEntity::getParentFor($formValues['event_id'], 'civicrm_event'); - if(!$parentEventId){ + if (!$parentEventId) { $parentEventId = $formValues['event_id']; } @@ -76,16 +78,16 @@ class CRM_Core_Page_AJAX_RecurringEntity { foreach ($result as $key => $value) { $result[$key]['start_date'] = date('M d, Y h:i:s A \o\n l', strtotime($value['start_date'])); - if($value['end_date']){ + if ($value['end_date']) { $result[$key]['end_date'] = date('M d, Y h:i:s A \o\n l', strtotime($value['end_date'])); } } //Show the list of participants registered for the events if any $getConnectedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($parentEventId, 'civicrm_event', TRUE); - if($getConnectedEntities){ + if ($getConnectedEntities) { $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getConnectedEntities); - if(!empty($participantDetails['countByName'])){ + if (!empty($participantDetails['countByName'])) { $result['participantData'] = $participantDetails['countByName']; } } diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index 94a64bd55a..a3379d942e 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -263,8 +263,8 @@ class CRM_Event_BAO_Query { */ //Get parent of this event $exEventId = ''; - if($query->_where[$grouping]){ - foreach($query->_where[$grouping] as $key => $val){ + if ($query->_where[$grouping]) { + foreach($query->_where[$grouping] as $key => $val) { if (strstr($val, 'civicrm_event.id =')) { $exEventId = $val; $extractEventId = explode(" ", $val); @@ -277,13 +277,13 @@ class CRM_Event_BAO_Query { unset($query->_where[$grouping][$key]); } $thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event'); - if($thisEventHasParent){ + if ($thisEventHasParent) { $getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event'); $allEventIds = array(); - foreach($getAllConnections as $key => $val){ + foreach($getAllConnections as $key => $val) { $allEventIds[] = $val['id']; } - if(!empty($allEventIds)){ + if (!empty($allEventIds)) { $op = "IN"; $value = "(".implode(",", $allEventIds).")"; } diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index d15b18a6af..76c60bf161 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -157,7 +157,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { $configureText = ts('Configure Event'); $title = CRM_Utils_Array::value('title', $eventInfo); //If it is a repeating event change title - if($this->_isRepeatingEvent){ + if ($this->_isRepeatingEvent) { $configureText = 'Configure Repeating Event'; } CRM_Utils_System::setTitle($configureText . " - $title"); @@ -189,7 +189,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { $this->_templateId = (int) CRM_Utils_Request::retrieve('template_id', 'Integer', $this); //Is a repeating event - if($this->_isRepeatingEvent){ + if ($this->_isRepeatingEvent) { $isRepeat = 'repeat'; $this->assign('isRepeat', $isRepeat); } diff --git a/CRM/Event/Form/ManageEvent/Repeat.php b/CRM/Event/Form/ManageEvent/Repeat.php index a0b9d4bee7..93a0965a3a 100644 --- a/CRM/Event/Form/ManageEvent/Repeat.php +++ b/CRM/Event/Form/ManageEvent/Repeat.php @@ -54,7 +54,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event'); $checkParentExistsForThisId; //If this ID has parent, send parent id - if($checkParentExistsForThisId){ + if ($checkParentExistsForThisId) { $this->_scheduleReminderDetails = self::getReminderDetailsByEventId($checkParentExistsForThisId, 'event'); $this->_parentEventId = $checkParentExistsForThisId; @@ -65,11 +65,11 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { //$allEventIds = CRM_Core_Form_RecurringEntity::getAllConnectedEvents($checkParentExistsForThisId); $allEventIdsArray = CRM_Core_BAo_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event'); $allEventIds = array(); - if(!empty($allEventIdsArray)){ - foreach($allEventIdsArray as $key => $val){ + if (!empty($allEventIdsArray)) { + foreach($allEventIdsArray as $key => $val) { $allEventIds[] = $val['id']; } - if(!empty($allEventIds)){ + if (!empty($allEventIds)) { $params = array(); $query = " SELECT * @@ -80,8 +80,8 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event'); $permissions = CRM_Event_BAO_Event::checkPermission(); - while($dao->fetch()){ - if(in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])){ + while($dao->fetch()) { + if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) { $manageEvent[$dao->id] = array(); CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]); } @@ -89,7 +89,8 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { } $this->assign('rows', $manageEvent); } - }else{ + } + else { //ELse send this id as parent $this->_scheduleReminderDetails = self::getReminderDetailsByEventId($this->_id, 'event'); $this->_parentEventId = $this->_id; @@ -111,8 +112,8 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { //$groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'event_repeat_exclude_dates_'.$this->_parentEventId, 'id', 'name'); CRM_Core_OptionValue::getValues(array('name' => 'event_repeat_exclude_dates_'.$this->_parentEventId), $optionValue); $excludeOptionValues = array(); - if(!empty($optionValue)){ - foreach($optionValue as $key => $val){ + if (!empty($optionValue)) { + foreach($optionValue as $key => $val) { $excludeOptionValues[$val['value']] = date('m/d/Y', strtotime($val['value'])); } $this->_excludeDateInfo = $excludeOptionValues; @@ -139,25 +140,25 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { list($defaults['repetition_start_date'], $defaults['repetition_start_date_time']) = CRM_Utils_Date::setDateDefaults($currentEventStartDate, 'activityDateTime'); // Check if there is id for this event in Reminder table - if($this->_scheduleReminderId){ + if ($this->_scheduleReminderId) { $defaults['repetition_frequency_unit'] = $this->_scheduleReminderDetails->repetition_frequency_unit; $defaults['repetition_frequency_interval'] = $this->_scheduleReminderDetails->repetition_frequency_interval; $defaults['start_action_condition'] = array_flip(explode(",",$this->_scheduleReminderDetails->start_action_condition)); - foreach($defaults['start_action_condition'] as $key => $val){ + foreach($defaults['start_action_condition'] as $key => $val) { $val = 1; $defaults['start_action_condition'][$key] = $val; } list($defaults['repeat_event_start_date'], $defaults['repeat_event_start_date_time']) = CRM_Utils_Date::setDateDefaults($this->_parentEventStartDate, 'activityDateTime'); $defaults['start_action_offset'] = $this->_scheduleReminderDetails->start_action_offset; - if($this->_scheduleReminderDetails->start_action_offset){ + if ($this->_scheduleReminderDetails->start_action_offset) { $defaults['ends'] = 1; } list($defaults['repeat_absolute_date']) = CRM_Utils_Date::setDateDefaults($this->_scheduleReminderDetails->absolute_date); - if($this->_scheduleReminderDetails->absolute_date){ + if ($this->_scheduleReminderDetails->absolute_date) { $defaults['ends'] = 2; } $defaults['limit_to'] = $this->_scheduleReminderDetails->limit_to; - if($this->_scheduleReminderDetails->limit_to){ + if ($this->_scheduleReminderDetails->limit_to) { $defaults['repeats_by'] = 1; } $explodeStartActionCondition = array(); @@ -166,7 +167,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { $defaults['entity_status_1'] = $explodeStartActionCondition[0]; $defaults['entity_status_2'] = $explodeStartActionCondition[1]; } - if($this->_scheduleReminderDetails->entity_status){ + if ($this->_scheduleReminderDetails->entity_status) { $defaults['repeats_by'] = 2; } } @@ -178,7 +179,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { } public function postProcess() { - if($this->_id){ + if ($this->_id) { $params = $this->controller->exportValues($this->_name); $params['event_id'] = $this->_id; $params['parent_event_id'] = $this->_parentEventId; @@ -194,7 +195,8 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { CRM_Core_Form_RecurringEntity::postProcess($params, 'event'); CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams)); - }else{ + } + else { CRM_Core_Error::fatal("Could not find Event ID"); } } @@ -209,12 +211,12 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { * * @return array */ - static public function getParticipantCountforEvent($listOfRelatedEntities = array()){ - if(!empty($listOfRelatedEntities)){ - $implodeRelatedEntities = implode(',', array_map(function($entity){ + static public function getParticipantCountforEvent($listOfRelatedEntities = array()) { + if (!empty($listOfRelatedEntities)) { + $implodeRelatedEntities = implode(',', array_map(function($entity) { return $entity['id']; }, $listOfRelatedEntities)); - if($implodeRelatedEntities){ + if ($implodeRelatedEntities) { $query = "SELECT p.event_id as event_id, concat_ws(' ', e.title, concat_ws(' - ', DATE_FORMAT(e.start_date, '%b %d %Y %h:%i %p'), DATE_FORMAT(e.end_date, '%b %d %Y %h:%i %p'))) as event_data, count(p.id) as participant_count @@ -243,13 +245,13 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { * * @return object */ - static public function getReminderDetailsByEventId($eventId, $used_for){ - if($eventId){ + static public function getReminderDetailsByEventId($eventId, $used_for) { + if ($eventId) { $query = " SELECT * FROM civicrm_action_schedule WHERE entity_value = %1"; - if($used_for){ + if ($used_for) { $query .= " AND used_for = %2"; } $params = array( @@ -269,9 +271,9 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { * @params string $linkedEntityTable Linked entity table name for this event * @return array */ - public static function updateModeRecurringEntityForEvent($entityId, $linkedEntityTable){ + public static function updateModeRecurringEntityForEvent($entityId, $linkedEntityTable) { $result = array(); - if( $entityId && $linkedEntityTable ){ + if ( $entityId && $linkedEntityTable ) { switch ($linkedEntityTable) { case 'civicrm_tell_friend': $dao = 'CRM_Friend_DAO_Friend'; @@ -299,7 +301,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { ); $defaults = array(); CRM_Core_DAO::commonRetrieve($dao, $params, $defaults); - if(CRM_Utils_Array::value('id', $defaults)){ + if (CRM_Utils_Array::value('id', $defaults)) { $result['entityId'] = $defaults['id']; $result['entityTable'] = $entityTable; } diff --git a/CRM/Event/Form/ManageEvent/TabHeader.php b/CRM/Event/Form/ManageEvent/TabHeader.php index 81528e6eca..66fdd03fdc 100644 --- a/CRM/Event/Form/ManageEvent/TabHeader.php +++ b/CRM/Event/Form/ManageEvent/TabHeader.php @@ -138,7 +138,7 @@ WHERE e.id = %1 if (!$dao->is_reminder) { $tabs['reminder']['valid'] = FALSE; } - if(!$dao->is_repeating_event){ + if (!$dao->is_repeating_event) { $tabs['repeat']['valid'] = FALSE; } } diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php index 64443ef77e..7461f36700 100644 --- a/CRM/Event/Page/ManageEvent.php +++ b/CRM/Event/Page/ManageEvent.php @@ -319,10 +319,11 @@ ORDER BY start_date desc $manageEvent[$dao->id] = array(); $isRepeatingEvent = CRM_Core_BAO_RecurringEntity::getParentFor($dao->id, 'civicrm_event'); $manageEvent[$dao->id]['repeat'] = ''; - if($isRepeatingEvent){ - if($dao->id == $isRepeatingEvent){ + if ($isRepeatingEvent) { + if ($dao->id == $isRepeatingEvent) { $manageEvent[$dao->id]['repeat'] = 'Repeating Event - (Parent)'; - }else{ + } + else { $manageEvent[$dao->id]['repeat'] = 'Repeating Event - (Child)'; } } diff --git a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php index c1d9af1071..2d888bc297 100644 --- a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php +++ b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php @@ -195,7 +195,7 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase { $resultDates = array_diff($actualDates, $expectedDates); $this->assertEquals(0, count($resultDates), "Check if all the value in expected array matches actual array"); - foreach($generatedEntities['civicrm_tell_friend'] as $key => $val){ + foreach($generatedEntities['civicrm_tell_friend'] as $key => $val) { $this->assertDBNotNull('CRM_Friend_DAO_Friend', $val, 'id', 'id', 'Check if friends were created in loop'); $this->assertDBCompareValue('CRM_Friend_DAO_Friend', $val, 'entity_id', 'id', $generatedEntities['civicrm_event'][$key], 'Check DB if correct FK was maintained with event for Friend'); } -- 2.25.1