From 5ce0e962d742139110bf3c8b286ad07a70ec55d4 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 8 May 2024 13:22:58 +0000 Subject: [PATCH] Bug 34444: [22.11.x] Correct handling of sort1 and sort2 values Removed extraneous sort_1 data elements Update selectors to use field names for statistics field Updated code to set the value after finding the correct selector To test: * Make sure you have at least 2 funds with different stat settings, using AV and not * Create a basket with an order line * Close it and receive shipment * Create an invoice and receive the order line * Finish receiving * Click "Modify fund" * Switch fund, verify the stat fields are updated accordingly * Change values for statistical values * Update fund * Edit fund again, pull downs are correct * Change values in form and close, do not update * Click 'Modify fund' - confrim form is filled with the saved values Signed-off-by: wainuiwitikapark --- .../prog/en/modules/acqui/invoice.tt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index c2e359abdc..cbc2ce147d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -382,7 +382,7 @@ [% order.budget_name | html %]
- Modify fund + Modify fund [% END # /FOREACH order %] @@ -615,16 +615,16 @@ $("#update_fund").data('order_id',$(this).data('order_id')); $("#modify_budget_id").html(disabledBudgetsCopy); $("#modify_budget_id").val(selected).find('option[value="'+selected+'"]').removeClass('b_inactive'); - $("#sort1").val(sort1); - $("#sort2").val(sort2); + $("#updateFund").find('[name="sort1"]').val(sort1); + $("#updateFund").find('[name="sort2"]').val(sort2); $("#modify_budget_id").find('.b_inactive').remove(); $("#modify_budget_id").change(); $("#updateFund").modal('show'); }); $("#update_fund").on('click',function(){ var new_fund = $("#modify_budget_id").val(); - var sort1 = $("#sort1").val(); - var sort2 = $("#sort2").val(); + var sort1 = $("#updateFund").find('[name="sort1"]').val(); + var sort2 = $("#updateFund").find('[name="sort2"]').val(); var new_fund_name = $('#modify_budget_id option[value="'+new_fund+'"]').text(); var order_id = $(this).data('order_id'); let options = { @@ -642,6 +642,8 @@ $("#updateFund").modal('hide'); $('#updateFund .showallfunds').prop('checked',false); $('.modify_fund[data-order_id="'+order_id+'"]').data('budget_id',new_fund); + $('.modify_fund[data-order_id="'+order_id+'"]').data('sort1',sort1); + $('.modify_fund[data-order_id="'+order_id+'"]').data('sort2',sort2); $('.order_name[data-order_id="'+order_id+'"]').text(new_fund_name); humanMsg.displayAlert( _("Order updated"), { className: 'humanError' } ); }) @@ -652,16 +654,16 @@ $("#modify_budget_id").change(function(){ var destination_sort1 = $(this).parents('.modal-body').find('input[name="sort1"]'); var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat'); - var sort1 = $(destination_sort1).val() || ""; if ( destination_sort1.length < 1 ) { destination_sort1 = $(this).parents('.modal-body').find('select[name="sort1"]'); } + var sort1 = $(destination_sort1).val() || ""; var destination_sort2 = $(this).parents('.modal-body').find('input[name="sort2"]'); var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat'); - var sort2 = $(destination_sort2).val() || ""; if ( destination_sort2.length < 1 ) { destination_sort2 = $(this).parents('.modal-body').find('select[name="sort2"]'); } + var sort2 = $(destination_sort2).val() || ""; getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 ); getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 ); }); -- 2.39.5