From 88a58538d1bc8f4dcd50fa16cfdad1512db2f1fb Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Tue, 11 Oct 2016 20:55:25 +0530 Subject: [PATCH 1/2] 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 2a6a457fa604..487d16138c24 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 ) { From 160fc6646ae45f50f85e6219bcd4d63502ea795c Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 20 Oct 2016 18:40:58 +0530 Subject: [PATCH 2/2] CRM-19485, removed async method since its depricated and called function for toggling in success ---------------------------------------- * CRM-19485: Selector issue on Batch trxn assignment page https://issues.civicrm.org/jira/browse/CRM-19485 --- .../CRM/Financial/Form/BatchTransaction.tpl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/CRM/Financial/Form/BatchTransaction.tpl b/templates/CRM/Financial/Form/BatchTransaction.tpl index 487d16138c24..be8b3f0bda28 100644 --- a/templates/CRM/Financial/Form/BatchTransaction.tpl +++ b/templates/CRM/Financial/Form/BatchTransaction.tpl @@ -164,7 +164,7 @@ function enableActions( type ) { } function toggleFinancialSelections(toggleID, toggleClass) { - mark = 'x'; + var mark = 'x'; if (toggleClass == 'remove') { mark = 'y'; } @@ -242,14 +242,16 @@ function buildTransactionSelectorAssign(filterSearch) { CRM.$.ajax({ "dataType": 'json', "type": "POST", - 'async': false, "url": sSource, "data": aoData, - "success": fnCallback + "success": function(b) { + fnCallback(b); + toggleFinancialSelections('#toggleSelect', 'assign'); + } }); } }); -toggleFinancialSelections('#toggleSelect', 'assign'); + } function buildTransactionSelectorRemove( ) { @@ -301,12 +303,13 @@ function buildTransactionSelectorRemove( ) { "type": "POST", "url": sSource, "data": aoData, - 'async': false, - "success": fnCallback + "success": function(b) { + fnCallback(b); + toggleFinancialSelections('#toggleSelects', 'remove'); + } }); } }); -toggleFinancialSelections('#toggleSelects', 'remove'); } function selectAction( id, toggleSelectId, checkId ) {