From dc3c81b15c0a6a99eee32adf9af0fc58426cb145 Mon Sep 17 00:00:00 2001 From: monishdeb Date: Tue, 17 Mar 2015 15:38:07 +0530 Subject: [PATCH] Hide participant_role option on choosing 'Also Add' for Event's Schedule Reminder --- CRM/Admin/Page/AJAX.php | 2 +- CRM/Core/BAO/ActionSchedule.php | 10 +++++++--- templates/CRM/Admin/Form/ScheduleReminders.tpl | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index 3528dbeb2c..d583981771 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -300,7 +300,7 @@ LIMIT $limit"; CRM_Utils_JSON::output(array('status' => 'error', 'error_msg' => 'required params missing.')); } - $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection1($_GET['mappingID']); + $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection1($_GET['mappingID'], $_GET['isLimit']); $output = array( 'sel4' => array(), diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index a194c0ecdc..4638e48035 100755 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -266,10 +266,11 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { /** * @param int $id + * @param int $isLimit * * @return array */ - public static function getSelection1($id = NULL) { + public static function getSelection1($id = NULL, $isLimit = NULL) { $mapping = self::getMapping($id); $sel4 = $sel5 = array(); $options = array( @@ -298,8 +299,11 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule { break; case 'event_contacts': - $eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name'); - $sel5[$id] = $eventContacts + $options; + //CRM-15536, don't provide participant_role option on choosing 'Also Include' for Event entity + if ($isLimit == 1) { + $options += CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name'); + } + $sel5[$id] = $options; $recipientMapping += CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, 'name', TRUE, FALSE, 'name'); break; diff --git a/templates/CRM/Admin/Form/ScheduleReminders.tpl b/templates/CRM/Admin/Form/ScheduleReminders.tpl index 868f167ab2..68347d4ddb 100644 --- a/templates/CRM/Admin/Form/ScheduleReminders.tpl +++ b/templates/CRM/Admin/Form/ScheduleReminders.tpl @@ -236,8 +236,9 @@ function buildSelects() { var mappingID = $('#entity_0', $form).val(); + var isLimit = $('#limit_to', $form).val(); - $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID}, + $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID, isLimit: isLimit}, function (result) { CRM.utils.setOptions($('#start_action_date', $form), result.sel4); CRM.utils.setOptions($('#end_date', $form), result.sel4); -- 2.25.1