From 529394e2a4770c9955ab2aa241d935aac451fac3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 11 Sep 2013 10:01:34 +0200 Subject: [PATCH] [PASSED QA] Bug 10875: Add order from a staged file should not display inactive funds 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. --- 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 456e840..10d6549 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 e5a5641..b725e0e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -31,6 +31,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'); @@ -155,6 +178,8 @@
Check all Uncheck all + + @@ -212,12 +237,14 @@ [% Budget_name %] [% ELSE %] @@ -302,14 +329,15 @@
  • + +
  • [% END %] -- 1.8.3.2