From bcec4b421ba045a45e8ca4394100824698ca7905 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 29 Aug 2014 17:14:15 +0100 Subject: [PATCH] CRM-15058 - Remove unneeded code --- CRM/Admin/Page/AJAX.php | 28 ------------------- CRM/Core/xml/Menu/Admin.xml | 5 ---- js/Common.js | 8 ------ .../CRM/Admin/Form/ScheduleReminders.tpl | 9 +++--- .../Form/ManageEvent/ScheduleReminders.tpl | 9 +++--- 5 files changed, 8 insertions(+), 51 deletions(-) diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index f05acc485c..008afeb407 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -340,33 +340,5 @@ LIMIT $limit"; CRM_Utils_JSON::output($result); } - function recipient() { - if (empty($_GET['recipient'])) { - CRM_Utils_JSON::output(array('status' => 'error', 'error_msg' => 'required params missing.')); - } - - switch ($_GET['recipient']) { - case 'Participant Status': - $values = CRM_Event_PseudoConstant::participantStatus(); - break; - - case 'participant_role': - $values = CRM_Event_PseudoConstant::participantRole(); - break; - - default: - exit; - } - - $elements = array(); - foreach ($values as $id => $name) { - $elements[] = array( - 'value' => $name, - 'key' => $id, - ); - } - - CRM_Utils_JSON::output($elements); - } } diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index 6a80791f23..14bfe7cc68 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -715,11 +715,6 @@ CRM_Admin_Page_AJAX::mappingList1 administer CiviCRM,access CiviCRM - - civicrm/ajax/populateRecipient - CRM_Admin_Page_AJAX::recipient - administer CiviCRM,access CiviCRM - civicrm/admin/sms/provider Sms Providers diff --git a/js/Common.js b/js/Common.js index c7856defcc..c28c851973 100644 --- a/js/Common.js +++ b/js/Common.js @@ -80,14 +80,6 @@ function on_load_init_blocks(showBlocks, hideBlocks, elementType) { * @param invert Boolean - if true, we HIDE target on value match; if false, we SHOW target on value match */ function showHideByValue(trigger_field_id, trigger_value, target_element_id, target_element_type, field_type, invert) { - if (target_element_type == null) { - var target_element_type = 'block'; - } - else { - if (target_element_type == 'table-row') { - var target_element_type = ''; - } - } if (field_type == 'select') { var trigger = trigger_value.split("|"); diff --git a/templates/CRM/Admin/Form/ScheduleReminders.tpl b/templates/CRM/Admin/Form/ScheduleReminders.tpl index 7dee089b7e..f5a89b4360 100644 --- a/templates/CRM/Admin/Form/ScheduleReminders.tpl +++ b/templates/CRM/Admin/Form/ScheduleReminders.tpl @@ -200,11 +200,10 @@ var recipient = $("#recipient", $form).val(); if (recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') { - $.getJSON(CRM.url('civicrm/ajax/populateRecipient'), {recipient: recipientMapping[recipient]}, - function (result) { - CRM.utils.setOptions($('#recipient_listing', $form), result); - } - ); + CRM.api3('participant', 'getoptions', {field: recipientMapping[recipient] == 'participant_role' ? 'role_id' : 'status_id', sequential: 1}) + .done(function(result) { + CRM.utils.setOptions($('#recipient_listing', $form), result.values); + }); $("#recipientList", $form).show(); $('#is_recipient_listing', $form).val(1); } else { diff --git a/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl b/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl index ada0d04c2b..6095070c6a 100755 --- a/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl +++ b/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl @@ -159,11 +159,10 @@ var recipient = $("#recipient", $form).val(); if (recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') { - $.getJSON(CRM.url('civicrm/ajax/populateRecipient'), {recipient: recipientMapping[recipient]}, - function (result) { - CRM.utils.setOptions($('#recipient_listing', $form), result); - } - ); + CRM.api3('participant', 'getoptions', {field: recipientMapping[recipient] == 'participant_role' ? 'role_id' : 'status_id', sequential: 1}) + .done(function(result) { + CRM.utils.setOptions($('#recipient_listing', $form), result.values); + }); $("#recipientList", $form).show(); $('#is_recipient_listing', $form).val(1); } else { -- 2.25.1