From 48ee69e69c049e8fd64c2023683679b88f7a1917 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 17 May 2023 12:32:34 -0300 Subject: [PATCH] Bug 8179: (follow-up) Restore funds dropdown and checkbox This patch reintroduces the dropdown that got lost in some refactoring of the patchset. It also introduces a couple minor fixes. Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/acqui/orderreceive.tt | 65 ++++++++++++++++--- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 1ff5f56314..b2ab673a26 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -266,15 +266,42 @@
  • + Required + +
  • @@ -492,6 +519,8 @@ var invoice_id = "[% invoiceid | html %]"; $(document).ready(function(){ + // keep a copy for re-rendering + var $funds_tree = $('#bookfund').html(); var base_query = { "order_id": {"in": [[% multiple_orders | html %]]}}; var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1"; var options = { @@ -1059,7 +1088,7 @@ .filter(function(name){ return name }) - .join(', ')+' ('+SUGGESTION.format(row.biblio.suggestions[0].suggestionid)+')' + .join(', ')+' ('+SUGGESTION.format(row.biblio.suggestions[0].suggestion_id)+')' ); } else { $("#biblio_suggestion_suggester").parent().hide(); @@ -1084,10 +1113,16 @@ var effective_create_items = row.basket.create_items || AcqCreateItem; $("#datereceived").val(row.date_received||$date(new Date().toISOString())); - $("#bookfund option[value='']").html(FUND_KEEP.format(row.fund.budget.budget_period_description, row.fund.name)); - if(row.fund_id != row.fund.fund_id) { + // restore the full tree + $("#bookfund").html($funds_tree); + $("#selected_bookfund") + .html(FUND_KEEP.format(row.fund.budget.budget_period_description, row.fund.name)) + .attr( 'data-sort1-authcat', row.fund.sort1_authcat ) + .attr( 'data-sort2-authcat', row.fund.sort2_authcat ); + if (row.fund_id != row.fund.fund_id) { $("#bookfund").val(row.fund_id); } + $("#bookfund").select2({ width: '100%' }); $("#current-fund").html(FUNC_CUR.format(row.fund.budget.budget_period_description, row.fund.name)); $("#creator").html([row.creator.surname, row.creator.firstname].filter(function(name){return name}).join(', ')+" ("+row.creator.patron_id+')') $("#quantity_to_receive").val(row.quantity).prop('readonly', !row.subscription_id); @@ -1181,6 +1216,18 @@ $("#invoice_currency").val(active_currency); $("#invoice_unitprice").val(''); } + + disabledBudgetsCopy = $('#bookfund').html(); + $('#bookfund .inactive_budget').remove(); + + $('#showallbudgets').click(function() { + if ($(this).is(":checked")) { + $('#bookfund').html(disabledBudgetsCopy); //Puts back all the funds + } + else { + $('#bookfund .inactive_budget').remove(); + } + }); set_modal_buttons(); }; -- 2.39.5