From 8c1112eb1edf5f510372f53ca16c08fa8c0a1bcb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Sep 2013 10:01:34 +0200 Subject: [PATCH] Bug 10875: ensure adding order from a staged file does not display inactive funds by default When adding an order from a staged file, a link "show all funds" is now added on the top of the page. All inactive funds are hidden by default. Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Passes all tests and QA script. Works as described. - Loading the page, a fund needs to be selected. Before the patch the first fund was preselected. - Checking the checkbox, inactive funds show up, but are not visible otherwise. - If the fund is selected from the MARC file, the correct fund will be selected, even if it's inactive. Signed-off-by: Galen Charlton --- acqui/addorderiso2709.pl | 5 +++ .../prog/en/modules/acqui/addorderiso2709.tt | 40 ++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 456e8400b6..10d654934d 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -306,9 +306,14 @@ foreach my $r ( @{$budgets_hierarchy} ) { b_txt => $r->{budget_name}, b_sort1_authcat => $r->{'sort1_authcat'}, b_sort2_authcat => $r->{'sort2_authcat'}, + b_active => $r->{budget_period_active}, b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, }; } + +@{$budget_loop} = + sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop}; + $template->param( budget_loop => $budget_loop,); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 331cb03c39..a6a099a262 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -26,6 +26,29 @@ "aaSorting": [] } ) ); + //keep a copy of all budgets before removing the inactives + disabledBudgetsCopy = $("select[name='all_budget_id']").html(); + $("select[name='all_budget_id'] .b_inactive").remove(); + $("select[name='budget_id'] .b_inactive").remove(); + + $("#showallbudgets").click(function() { + if ($(this).is(":checked")) { + $("select[name='budget_id']").html(disabledBudgetsCopy); //Puts back all the funds + } + else { + $("select[name='budget_id'] .b_inactive").remove(); + } + }); + + $("#all_showallbudgets").click(function() { + if ($(this).is(":checked")) { + $("select[name='all_budget_id']").html(disabledBudgetsCopy); //Puts back all the funds + } + else { + $("select[name='all_budget_id'] .b_inactive").remove(); + } + }); + $("select[name='budget_id']").change(function(){ var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat'); var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat'); @@ -150,6 +173,8 @@
Check all Uncheck all + + @@ -207,12 +232,14 @@ [% Budget_name %] [% ELSE %] @@ -297,14 +324,15 @@
  • + +
  • [% END %] -- 2.39.5