From fe87e754e0840da55520a62eccc354769c4fb029 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Nov 2014 12:27:15 +0000 Subject: [PATCH] few notice fixes during webtest for recurring entities --- CRM/Activity/Form/Activity.php | 4 +++- CRM/Core/Form/RecurringEntity.php | 9 ++++++--- .../WebTest/Activity/AddRecurringActivityTest.php | 2 +- tests/phpunit/WebTest/Event/AddRecurringEventTest.php | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 901d2cb162..2198265d8b 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -977,7 +977,9 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $params['parent_entity_id'] = $params['entity_id']; $scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($params['entity_id'], $params['entity_table']); } - $params['schedule_reminder_id'] = $scheduleReminderDetails->id; + if (property_exists($scheduleReminderDetails, 'id')) { + $params['schedule_reminder_id'] = $scheduleReminderDetails->id; + } } $params['dateColumns'] = array('activity_date_time'); diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 193027768d..2a7ef7a977 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -238,7 +238,7 @@ class CRM_Core_Form_RecurringEntity { $errors = array(); //Process this function only when you get this variable if ($values['allowRepeatConfigToSubmit'] == 1) { - $dayOfTheWeek = array(monday,tuesday,wednesday,thursday,friday,saturday,sunday); + $dayOfTheWeek = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); //Repeats if (!CRM_Utils_Array::value('repetition_frequency_unit', $values)) { $errors['repetition_frequency_unit'] = ts('This is a required field'); @@ -337,7 +337,8 @@ class CRM_Core_Form_RecurringEntity { } //Save post params to the schedule reminder table - $dbParams = CRM_Core_BAO_RecurringEntity::mapFormValuesToDB($params); + $recurobj = new CRM_Core_BAO_RecurringEntity(); + $dbParams = $recurobj->mapFormValuesToDB($params); //Delete repeat configuration and rebuild if (CRM_Utils_Array::value('id', $params)) { @@ -459,7 +460,9 @@ class CRM_Core_Form_RecurringEntity { $recursion->excludeDates = $excludeDateList; $recursion->excludeDateRangeColumns = $params['excludeDateRangeColumns']; } - $recursion->intervalDateColumns = $params['intervalDateColumns']; + if (CRM_Utils_Array::value('intervalDateColumns', $params)) { + $recursion->intervalDateColumns = $params['intervalDateColumns']; + } $recursion->entity_id = $params['entity_id']; $recursion->entity_table = $params['entity_table']; if (!empty($linkedEntities)) { diff --git a/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php b/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php index 891ddd5549..e98a8dbd20 100644 --- a/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php +++ b/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php @@ -105,7 +105,7 @@ class WebTest_Activity_AddRecurringActivityTest extends CiviSeleniumTestCase { } $this->type('start_action_offset', $occurrences); $this->click('_qf_Activity_upload-bottom'); - $this->waitForTextPresent('Based on your repeat configuration here is the list of dates, Do you wish to create recurring set of these dates?'); + $this->waitForTextPresent('Based on your repeat configuration, here is the list of dates. Do you wish to create a recurring set with these dates?'); $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Ok']"); $this->waitForPageToLoad(); diff --git a/tests/phpunit/WebTest/Event/AddRecurringEventTest.php b/tests/phpunit/WebTest/Event/AddRecurringEventTest.php index 4b4a3ef25b..f42703489c 100644 --- a/tests/phpunit/WebTest/Event/AddRecurringEventTest.php +++ b/tests/phpunit/WebTest/Event/AddRecurringEventTest.php @@ -62,7 +62,7 @@ class WebTest_Event_AddRecurringEventTest extends CiviSeleniumTestCase { $this->webtestFillDate("exclude_date", "12/05/2015"); $this->click('add_to_exclude_list'); $this->click('_qf_Repeat_submit-bottom'); - $this->waitForTextPresent('Based on your repeat configuration here is the list of dates, Do you wish to create recurring set of these dates?'); + $this->waitForTextPresent('Based on your repeat configuration, here is the list of dates. Do you wish to create a recurring set with these dates?'); $this->click("xpath=//div[@class='ui-dialog-buttonset']/button/span[text()='Ok']"); $this->waitForAjaxContent(); $this->checkCRMAlert('Repeat Configuration has been saved'); -- 2.25.1