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();
};