From 88a58538d1bc8f4dcd50fa16cfdad1512db2f1fb Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Tue, 11 Oct 2016 20:55:25 +0530 Subject: [PATCH] CRM-19485, Fixed selector issue on Batch Transaction form ---------------------------------------- * CRM-19485: Selector issue on Batch trxn assignment page https://issues.civicrm.org/jira/browse/CRM-19485 --- .../CRM/Financial/Form/BatchTransaction.tpl | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/templates/CRM/Financial/Form/BatchTransaction.tpl b/templates/CRM/Financial/Form/BatchTransaction.tpl index 2a6a457fa6..487d16138c 100644 --- a/templates/CRM/Financial/Form/BatchTransaction.tpl +++ b/templates/CRM/Financial/Form/BatchTransaction.tpl @@ -52,6 +52,7 @@ {else}   {/if} + {include file="CRM/Contribute/Form/Search/Common.tpl"}
{include file="CRM/common/formButtons.tpl" location="bottom"}
@@ -143,20 +144,10 @@ CRM.$(function($) { }); CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").click( function() { - if (CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").is(':checked')) { - CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',true); - } - else { - CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',false); - } + toggleFinancialSelections('#toggleSelect', 'assign'); }); CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").click( function() { - if (CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").is(':checked')) { - CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',true); - } - else { - CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',false); - } + toggleFinancialSelections('#toggleSelects', 'remove'); }); {/literal}{else}{literal} buildTransactionSelectorRemove(); @@ -172,6 +163,19 @@ function enableActions( type ) { } } +function toggleFinancialSelections(toggleID, toggleClass) { + mark = 'x'; + if (toggleClass == 'remove') { + mark = 'y'; + } + if (CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} " + toggleID).is(':checked')) { + CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} input[id^='mark_" + mark + "_']").prop('checked',true); + } + else { + CRM.$("#crm-transaction-selector-" + toggleClass + "-{/literal}{$entityID}{literal} input[id^='mark_" + mark + "_']").prop('checked',false); + } +} + function buildTransactionSelectorAssign(filterSearch) { var columns = ''; var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Financial_Page_AJAX&fnName=getFinancialTransactionsList&snippet=4&context=financialBatch&entityID=$entityID¬Present=1&statusID=$statusID"}'{literal}; @@ -238,12 +242,14 @@ function buildTransactionSelectorAssign(filterSearch) { CRM.$.ajax({ "dataType": 'json', "type": "POST", + 'async': false, "url": sSource, "data": aoData, "success": fnCallback }); } }); +toggleFinancialSelections('#toggleSelect', 'assign'); } function buildTransactionSelectorRemove( ) { @@ -295,10 +301,12 @@ function buildTransactionSelectorRemove( ) { "type": "POST", "url": sSource, "data": aoData, + 'async': false, "success": fnCallback }); } }); +toggleFinancialSelections('#toggleSelects', 'remove'); } function selectAction( id, toggleSelectId, checkId ) { -- 2.25.1