From 49d61c3a217f1126241649b6f57b5e439489429e Mon Sep 17 00:00:00 2001 From: monishdeb Date: Fri, 14 Nov 2014 02:35:12 +0530 Subject: [PATCH] QA fixes --- CRM/Admin/Form/ScheduleReminders.php | 7 +++---- CRM/Core/BAO/ActionSchedule.php | 2 +- templates/CRM/Admin/Form/ScheduleReminders.tpl | 10 ++++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 947b18ce1b..aaf2cf62ca 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -207,7 +207,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { FALSE, array('onchange' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);") ); - if (!empty($_POST['is_recipient_listing'])) { + if (!empty($this->_submitValues['recipient_listing'])) { $recipientListingOptions = CRM_Core_BAO_ActionSchedule::getRecipientListing($_POST['entity'][0], $_POST['recipient']); } elseif (!empty($this->_values['recipient_listing'])) { @@ -215,7 +215,6 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { } $this->add('select', 'recipient_listing', ts('Recipient Roles'), $recipientListingOptions, FALSE, array('multiple' => TRUE, 'class' => 'crm-select2 huge', 'placeholder' => TRUE)); - $this->add('hidden', 'is_recipient_listing', (int) !empty($recipientListingOptions)); $this->addEntityRef('recipient_manual_id', ts('Manual Recipients'), array('multiple' => TRUE, 'create' => TRUE)); @@ -287,8 +286,8 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { 'target_id' => 'recipient_manual_id' ) ); - if (!empty($fields['limit_to']) && array_key_exists($fields['recipient'], $recipientKind)) { - $errors[$recipientKind[$fields['recipient']]['target_id']] = ts('If "Also include" or "Limit to" are selected, you must specify atleast one %1', array(1 => $recipientKind[$fields['recipient']]['name'])); + if (!empty($fields['limit_to']) && array_key_exists($fields['recipient'], $recipientKind) && empty($fields[$recipientKind[$fields['recipient']]['target_id']])) { + $errors[$recipientKind[$fields['recipient']]['target_id']] = ts('If "Also include" or "Limit to" are selected, you must specify at least one %1', array(1 => $recipientKind[$fields['recipient']]['name'])); } if (!empty($errors)) { diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index 99a023e05b..bfcba4953e 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -1425,7 +1425,7 @@ WHERE m.owner_membership_id IS NOT NULL AND switch ($mapping['entity']) { case 'civicrm_participant': - $eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name'); + $eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name', TRUE, FALSE, 'name'); if (empty($eventContacts[$recipientType])) { return $options; } diff --git a/templates/CRM/Admin/Form/ScheduleReminders.tpl b/templates/CRM/Admin/Form/ScheduleReminders.tpl index 943b1afb7a..d85e6720ec 100644 --- a/templates/CRM/Admin/Form/ScheduleReminders.tpl +++ b/templates/CRM/Admin/Form/ScheduleReminders.tpl @@ -45,7 +45,7 @@ {$form.start_action_offset.label} - {include file="CRM/common/jcalendar.tpl" elementName=absolute_date} {ts}OR{/ts}
+ {include file="CRM/common/jcalendar.tpl" elementName=absolute_date} OR
@@ -172,9 +172,9 @@ $('#absolute_date_display', $form).change(function() { if($(this).val()) { - $('#relativeDate, #relativeDateRepeat, #repeatFields', $form).hide(); + $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide(); } else { - $('#relativeDate, #relativeDateRepeat', $form).show(); + $('#relativeDate, #relativeDateRepeat, #OR', $form).show(); } }); if ($('#absolute_date_display', $form).val()) { @@ -203,7 +203,6 @@ function buildSelects() { var mappingID = $('#entity_0', $form).val(); - $('#is_recipient_listing').val(''); $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID}, function (result) { CRM.utils.setOptions($('#start_action_date', $form), result.sel4); @@ -222,10 +221,8 @@ CRM.utils.setOptions($('#recipient_listing', $form), result.values); }); $("#recipientList", $form).show(); - $('#is_recipient_listing', $form).val(1); } else { $("#recipientList", $form).hide(); - $('#is_recipient_listing', $form).val(''); if ($('#entity_0', $form).val() !== '1' && $('#limit_to').val() == '') { $('tr.recipient:visible').hide(); } @@ -241,6 +238,7 @@ $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}'); } else { + $('#recipient').show(); $("label[for='recipient']").text('{/literal}{$recipientLabels.activity}{literal}'); } } -- 2.25.1