From 596d6b74eaa38e2adb6f6540f0d5b7b26d000c11 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 8 May 2024 13:22:58 +0000 Subject: [PATCH] Bug 34444: 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: Chris Cormack Signed-off-by: Martin Renvoize --- .../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 be89ba07c3..e4e2dd561c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -389,7 +389,7 @@ [% order.budget_name | html %]
- Modify fund + Modify fund [% END # /FOREACH order %] @@ -620,16 +620,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 = { @@ -647,6 +647,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' } ); }) @@ -657,16 +659,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