Bug 22712: Make 'Show inactive funds' button on addorderiso2907.pl work for item budgets

This requires enabling MarcItemFieldsToOrder, see bug 34645

Add an inactive Budget and some funds to your system

Import a file with multiple biblios

Confirm the button hids/displays the funds for all item orders

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 60ed1898a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit b49fc7ea34)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2023-10-23 19:56:21 +00:00 committed by Matt Blenkinsop
parent de61718dc9
commit 7aa5ac9c75
2 changed files with 30 additions and 3 deletions

View file

@ -335,11 +335,21 @@
</li>
<li>
<label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
<select class="budget_code_item" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% biblio.import_record_id | html %]">
<select class="budget_code_item bci_all" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% biblio.import_record_id | html %]" hidden="hidden" disabled="disabled">
<option value="">Select a fund (will use default if set)</option>
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
[% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
[% IF ( budget_loo.b_active ) %]
[% IF ( budget_loo.b_id ) == ( item.budget_id ) %]
<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
[% ELSE %]
<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
[% END %]
[% ELSE %]
[% IF ( budget_loo.b_id ) == ( item.budget_id ) %]
<option value="[% budget_loo.b_id | html %]" class="buget_item_inactive" selected="selected">[% budget_loo.b_txt | html %] (inactive)</option>
[% ELSE %]
<option value="[% budget_loo.b_id | html %]" class="budget_item_inactive">[% budget_loo.b_txt | html %] (inactive)</option>
[% END %]
[% END %]
[% END %]
</select>

View file

@ -6,12 +6,29 @@ $(document).ready(function() {
$("select[name='all_budget_id'] .b_inactive").remove();
$("select[name='budget_id'] .b_inactive").remove();
$(".budget_code_item").each(function(){
let active_only = $(this).clone();
active_only.children().remove('.budget_item_inactive');
active_only.attr('id', this.id + '_active');
active_only.prop('hidden',false);
active_only.prop('disabled',false);
active_only.removeClass('bci_all').addClass('bci_active');
$(this).after(active_only);
});
$(".budget_code_item").change(function(){
$(this).siblings('select').val( $(this).val() );
});
$("#showallbudgets").click(function() {
if ($(this).is(":checked")) {
$("select[name='budget_id']").html(disabledBudgetsCopy)
$(".bci_active").prop('disabled',true).prop('hidden',true);
$(".bci_all").prop('disabled',false).prop('hidden',false);
}
else {
$("select[name='budget_id'] .b_inactive").remove();
$(".bci_active").prop('disabled',false).prop('hidden',false);
$(".bci_all").prop('disabled',true).prop('hidden',true);
}
});