Bugzilla – Attachment 184120 Details for
Bug 31606
Enhance acquisitions to allow ordering on next year's budget when still in current year.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31606: Make acquisitions fund dropdown consistently show budget name
Bug-31606-Make-acquisitions-fund-dropdown-consiste.patch (text/plain), 47.80 KB, created by
Aleisha Amohia
on 2025-07-15 22:55:34 UTC
(
hide
)
Description:
Bug 31606: Make acquisitions fund dropdown consistently show budget name
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2025-07-15 22:55:34 UTC
Size:
47.80 KB
patch
obsolete
>From 77e79584cc2c1c924290b01034cb18abfd1546d2 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 5 Jun 2024 05:12:59 +0000 >Subject: [PATCH] Bug 31606: Make acquisitions fund dropdown consistently show > budget name > >This patch moves the budget/fund dropdown into a reusable block. So far it has only been applied to dropdowns encountered along the basic order & receive process. > >To test: > >1) Apply patch and restart services >2) Create two budgets. Under each budget, create funds with the same codes (this is so we can depend on the budget names to differentiate between funds). Make one or more funds inactive. >3) Find or create a vendor and an open basket > >4) Click Add to basket >5) Search for an existing record >6) Click Add order for your chosen record >7) Fill out required item information >8) Scroll down to Accounting details and open the Fund dropdown. Confirm funds show as expected with their budgets >9) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >10) Cancel or Save your order > >11) In another tab, go to Suggestions >12) Click New purchase suggestion >13) Fill out required bibliographic information >14) Scroll down to Acquisition information and open the Fund dropdown. Confirm funds show as expected with their budgets >15) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >16) Submit your suggestion >17) Check the checkbox for your suggestion and mark it as Accepted >18) In your other tab with your basket, click Add to basket >19) Choose From a suggestion >20) Click Order for your suggestion >21) Fill out required item information >22) Scroll down to Accounting details and open the Fund dropdown. Confirm funds show as expected with their budgets >23) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >24) Cancel or Save your order > >25) In another tab, go to Serials >26) Click New subscription >27) Fill out required record and serials planning information and Save >28) In your other tab with your basket, click Add to basket >29) Choose From a subscription >30) Search for your subscription and choose Order >31) Scroll down to Accounting details and open the Fund dropdown. Confirm funds show as expected with their budgets >32) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >33) Cancel or Save your order > >34) Click Add to basket >35) Choose From existing orders (copy) >36) Open the Fund dropdown. Confirm funds show as expected with their budgets >37) Do a search and check the checkbox for an order, then click Next >38) Open the Fund dropdown. Confirm funds show as expected with their budgets >39) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >40) Cancel or Duplicate orders > >41) Click Add to basket >42) Choose From a new file >43) Upload a MARC file and stage a record for import, then choose Add staged files to basket >44) Select a checkbox for a record to expand it >45) Open the Fund dropdown. Confirm funds show as expected with their budgets >46) Go to the Default accounting details tab >47) Open the Fund dropdown. Confirm funds show as expected with their budgets >48) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >49) Save your order > >50) Close the basket >51) Click Receive shipments >52) Open the Shipping fund dropdown. Confirm funds show as expected with their budgets >53) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected >54) Fill out required invoice information and Save >55) Click Receive for one of your orders >56) Open the Fund dropdown. Confirm funds show as expected with their budgets >57) Toggle the 'Show inactive' checkbox and confirm it shows and hides inactive funds as expected > >Sponsored-by: Friends of Round Rock Library >Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov> >--- > acqui/addorderiso2709.pl | 18 +-- > acqui/duplicate_orders.pl | 26 +++-- > acqui/invoice.pl | 27 ++--- > acqui/neworderempty.pl | 13 ++- > acqui/orderreceive.pl | 2 +- > acqui/parcels.pl | 27 +++-- > .../prog/en/includes/budgets_loop.inc | 28 +++++ > .../prog/en/modules/acqui/addorderiso2709.tt | 104 +++++++----------- > .../prog/en/modules/acqui/duplicate_orders.tt | 12 +- > .../prog/en/modules/acqui/invoice.tt | 10 +- > .../prog/en/modules/acqui/neworderempty.tt | 29 +---- > .../prog/en/modules/acqui/orderreceive.tt | 39 +------ > .../prog/en/modules/acqui/parcels.tt | 8 +- > .../prog/en/modules/suggestion/suggestion.tt | 12 +- > suggestion/suggestion.pl | 31 ++++-- > 15 files changed, 159 insertions(+), 227 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/budgets_loop.inc > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index a1533ec338f..7cfa45776ac 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -314,12 +314,16 @@ my $patron = Koha::Patrons->find($loggedinuser)->unblessed; > my $budget = GetBudget($budget_id); > > # build budget list >-my $budget_loop = []; >+my %budget_loops; > my $budgets_hierarchy = GetBudgetHierarchy; > foreach my $r ( @{$budgets_hierarchy} ) { > next unless ( CanUserUseBudget( $patron, $r, $userflags ) ); >- push @{$budget_loop}, >- { >+ unless ( defined $budget_loops{ $r->{budget_period_id} } ) { >+ $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; >+ $budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; >+ $budget_loops{ $r->{budget_period_id} }->{funds} = []; >+ } >+ push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { > b_id => $r->{budget_id}, > b_txt => $r->{budget_name}, > b_code => $r->{budget_code}, >@@ -327,12 +331,10 @@ foreach my $r ( @{$budgets_hierarchy} ) { > b_sort2_authcat => $r->{'sort2_authcat'}, > b_active => $r->{budget_period_active}, > b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, >- }; >+ b_level => $r->{budget_level}, >+ }; > } > >-@{$budget_loop} = >- sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop}; >- >-$template->param( budget_loop => $budget_loop, ); >+$template->param( budget_loop => \%budget_loops ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/acqui/duplicate_orders.pl b/acqui/duplicate_orders.pl >index 3b065153aac..acedccad3dd 100755 >--- a/acqui/duplicate_orders.pl >+++ b/acqui/duplicate_orders.pl >@@ -102,28 +102,30 @@ if ( $op eq 'select' ) { > @ordernumbers = $input->multi_param('ordernumber'); > > # build budget list >- my $budget_loop = []; >- my $budgets_hierarchy = GetBudgetHierarchy; >- foreach my $r ( @{$budgets_hierarchy} ) { >- next >- unless ( C4::Budgets::CanUserUseBudget( $patron, $r, $userflags ) ); >- >- push @{$budget_loop}, >- { >+ my %budget_loops; >+ my $budgets = GetBudgetHierarchy; >+ foreach my $r ( @{$budgets} ) { >+ next unless ( CanUserUseBudget( $patron, $r, $userflags ) ); >+ unless ( defined $budget_loops{ $r->{budget_period_id} } ) { >+ $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; >+ $budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; >+ $budget_loops{ $r->{budget_period_id} }->{funds} = []; >+ } >+ push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { > b_id => $r->{budget_id}, > b_txt => $r->{budget_name}, > b_code => $r->{budget_code}, > b_sort1_authcat => $r->{'sort1_authcat'}, > b_sort2_authcat => $r->{'sort2_authcat'}, > b_active => $r->{budget_period_active}, >- }; >+ b_sel => ( $r->{budget_id} == scalar $input->param('budget') ) ? 1 : 0, >+ b_level => $r->{budget_level}, >+ }; > } >- @{$budget_loop} = >- sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop}; > > $template->param( > currencies => Koha::Acquisition::Currencies->search, >- budget_loop => $budget_loop, >+ budget_loop => \%budget_loops, > ); > } elsif ( $op eq 'cud-do_duplicate' ) { > my @fields_to_copy = $input->multi_param('copy_existing_value'); >diff --git a/acqui/invoice.pl b/acqui/invoice.pl >index d38a83d217b..52af61b9e75 100755 >--- a/acqui/invoice.pl >+++ b/acqui/invoice.pl >@@ -287,27 +287,28 @@ push @foot_loop, map { $_ } values %foot; > my $shipmentcost_budgetid = $details->{shipmentcost_budgetid}; > > # build budget list >-my $budget_loop = []; >-my $budgets = GetBudgetHierarchy(); >+my %budget_loops; >+my $budgets = GetBudgetHierarchy; > foreach my $r ( @{$budgets} ) { > next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) ); > >- my $selected = $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0; >- >- push @{$budget_loop}, >- { >+ unless ( defined $budget_loops{ $r->{budget_period_id} } ) { >+ $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; >+ $budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; >+ $budget_loops{ $r->{budget_period_id} }->{funds} = []; >+ } >+ push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { > b_id => $r->{budget_id}, > b_txt => $r->{budget_name}, >- b_active => $r->{budget_period_active}, >- selected => $selected, >+ b_code => $r->{budget_code}, > b_sort1_authcat => $r->{'sort1_authcat'}, > b_sort2_authcat => $r->{'sort2_authcat'}, >- }; >+ b_active => $r->{budget_period_active}, >+ b_sel => $shipmentcost_budgetid ? $r->{budget_id} eq $shipmentcost_budgetid : 0, >+ b_level => $r->{budget_level}, >+ }; > } > >-@{$budget_loop} = >- sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop}; >- > my $adjustments = Koha::Acquisition::Invoice::Adjustments->search( { invoiceid => $details->{'invoiceid'} } ); > if ($adjustments) { $template->param( adjustments => $adjustments ); } > >@@ -337,7 +338,7 @@ $template->param( > total_tax_included_shipment => $total_tax_included + $shipmentcost, > invoiceincgst => $bookseller->invoiceincgst, > currency => $active_currency, >- budgets => $budget_loop, >+ budget_loop => \%budget_loops, > budget => GetBudget($shipmentcost_budgetid), > has_invoice_unitprice => $has_invoice_unitprice, > ); >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index b68ace84742..a1b1a0598e8 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -333,11 +333,16 @@ my $patron = Koha::Patrons->find($loggedinuser)->unblessed; > my $budget = GetBudget($budget_id); > > # build budget list >-my $budget_loop = []; >-my $budgets = GetBudgetHierarchy; >+my %budget_loops; >+my $budgets = GetBudgetHierarchy; > foreach my $r ( @{$budgets} ) { > next unless ( CanUserUseBudget( $patron, $r, $userflags ) ); >- push @{$budget_loop}, { >+ unless ( defined $budget_loops{ $r->{budget_period_id} } ) { >+ $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; >+ $budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; >+ $budget_loops{ $r->{budget_period_id} }->{funds} = []; >+ } >+ push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { > b_id => $r->{budget_id}, > b_txt => $r->{budget_name}, > b_sort1_authcat => $r->{'sort1_authcat'}, >@@ -484,7 +489,7 @@ $template->param( > author => $data->{'author'}, > publicationyear => $data->{'publicationyear'} ? $data->{'publicationyear'} : $data->{'copyrightdate'}, > editionstatement => $data->{'editionstatement'}, >- budget_loop => $budget_loop, >+ budget_loop => \%budget_loops, > isbn => $data->{'isbn'}, > ean => $data->{'ean'}, > seriestitle => $data->{'seriestitle'}, >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 06564c730a3..ba9931b8bc3 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -197,7 +197,7 @@ foreach my $budget ( @{$budgets} ) { > b_level => $budget->{budget_level}, > }; > } >-$template->{'VARS'}->{'budget_loops'} = \%budget_loops; >+$template->{'VARS'}->{'budget_loop'} = \%budget_loops; > > my $op = $input->param('op'); > if ( $op and $op eq 'cud-edit' ) { >diff --git a/acqui/parcels.pl b/acqui/parcels.pl >index ee3e3d6a060..888a4676304 100755 >--- a/acqui/parcels.pl >+++ b/acqui/parcels.pl >@@ -204,20 +204,27 @@ if ($count_parcels) { > } > > # build budget list >-my $budget_loop = []; >-my $budgets = GetBudgetHierarchy; >+my %budget_loops; >+my $budgets = GetBudgetHierarchy; > foreach my $r ( @{$budgets} ) { > next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) ); >- push @{$budget_loop}, { >- b_id => $r->{budget_id}, >- b_txt => $r->{budget_name}, >- b_active => $r->{budget_period_active}, >+ unless ( defined $budget_loops{ $r->{budget_period_id} } ) { >+ $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; >+ $budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; >+ $budget_loops{ $r->{budget_period_id} }->{funds} = []; >+ } >+ push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { >+ b_id => $r->{budget_id}, >+ b_txt => $r->{budget_name}, >+ b_code => $r->{budget_code}, >+ b_sort1_authcat => $r->{'sort1_authcat'}, >+ b_sort2_authcat => $r->{'sort2_authcat'}, >+ b_active => $r->{budget_period_active}, >+ b_sel => ( $r->{budget_id} == $shipmentcost_budgetid ) ? 1 : 0, >+ b_level => $r->{budget_level}, > }; > } > >-@{$budget_loop} = >- sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$budget_loop}; >- > $template->param( > orderby => $order, > filter => $code, >@@ -229,7 +236,7 @@ $template->param( > shipmentdate_today => dt_from_string, > booksellerid => $booksellerid, > GST => C4::Context->preference('TaxRates'), >- budgets => $budget_loop, >+ budgets => \%budget_loops, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets_loop.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/budgets_loop.inc >new file mode 100644 >index 00000000000..9ffa8510abf >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/budgets_loop.inc >@@ -0,0 +1,28 @@ >+[% FOREACH budget_period_id IN budget_loop.keys %] >+ [% SET budget_period = budget_loop.$budget_period_id %] >+ <optgroup class="[% UNLESS budget_period.active %][% inactive_class | html %][% END %]" label="[% budget_period.description | html %][% UNLESS budget_period.active %](Inactive)[% END %]"> >+ [% FOREACH budget_loo IN budget_period.funds %] >+ [% level_indent_cnt = 0 %] >+ [% level_indent = "" %] >+ [% WHILE level_indent_cnt < budget_loo.b_level %] >+ [% level_indent = level_indent _ " -- " %] >+ [% level_indent_cnt = level_indent_cnt +1 %] >+ [% END %] >+ [% IF ( budget_loo.b_sel ) %] >+ [% active_count = 0 #select no other fund %] >+ <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >+ [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %] >+ </option> >+ [% ELSIF active_count==1 && budget_loo.b_active %] >+ <option value="[% budget_loo.b_id | html %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >+ [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %] >+ </option> >+ [% ELSE %] >+ [% bdgclass=budget_loo.b_active? "": inactive_class | html %] >+ <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >+ [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %] >+ </option> >+ [% END %] >+ [% END %] >+ </optgroup> >+[% END %] >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 d0e834b57a3..684751f1627 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >@@ -179,6 +179,7 @@ > [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %] > <span>Match found</span> > [% ELSE %] >+<<<<<<< HEAD > [% biblio_lis.overlay_status | html %] > [% END %] > [% IF ( biblio.match_biblionumber ) %] >@@ -239,41 +240,7 @@ > <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label> > <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]"> > <option value="">Select a fund (will use default if set)</option> >- [% FOREACH budget IN budget_loop %] >- [% IF ( budget.b_id == biblio.budget_id ) %] >- [% IF budget.b_active %] >- <option >- value="[% budget.b_id | html %]" >- data-sort1-authcat="[% budget.b_sort1_authcat | html %]" >- data-sort2-authcat="[% budget.b_sort2_authcat | html %]" >- selected="selected" >- >[% budget.b_txt | html %]</option >- > >- [% ELSE %] >- <option >- value="[% budget.b_id | html %]" >- data-sort1-authcat="[% budget.b_sort1_authcat | html %]" >- data-sort2-authcat="[% budget.b_sort2_authcat | html %]" >- selected="selected" >- >[% budget.b_txt | html %] (inactive)</option >- > >- [% END %] >- [% ELSE %] >- [% IF budget.b_active %] >- <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" >- >[% budget.b_txt | html %]</option >- > >- [% ELSE %] >- <option >- value="[% budget.b_id | html %]" >- class="b_inactive" >- data-sort1-authcat="[% budget.b_sort1_authcat | html %]" >- data-sort2-authcat="[% budget.b_sort2_authcat | html %]" >- >[% budget.b_txt | html %] (inactive)</option >- > >- [% END %] >- [% END %] >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > <span class="required" style="display:none">Required</span> > [% END %] >@@ -302,6 +269,41 @@ > <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option> > [% ELSE %] > <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option> >+======= >+ <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label> >+ <select id="fund_record_[% biblio.import_record_id | html %]" name="budget_id_[% biblio.import_record_id | html %]"> >+ <option value="">Select a fund (will use default if set)</option> >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] >+ </select> >+ <span class="required" style="display:none">Required</span> >+ [% END %] >+ </li> >+ <li class="sort1"> >+ <label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label> >+ <input id="sort1_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort1_[% biblio.import_record_id | html %]" value="[% biblio.sort1 | html %]" /> >+ </li> >+ <li class="sort2"> >+ <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label> >+ <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2_[% biblio.import_record_id | html %]" value="[% biblio.sort2 | html %]" /> >+ </li> >+ </ol> >+ [% IF ( biblio.iteminfos.size ) %] >+ <div class="item_edit_form"> >+ [% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %] >+ [% FOREACH item IN biblio.iteminfos %] >+ <fieldset class="rows"> >+ <legend>Item record [% item.item_id | html %]</legend> >+ <ol> >+ <li> >+ <label for="homebranch_item_[% item.item_id | html %]">homebranch</label> >+ <select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% biblio.import_record_id | html %]"> >+ [% FOREACH l IN libraries %] >+ [% IF l.branchcode == item.homebranch %] >+ <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option> >+ [% ELSE %] >+ <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option> >+ [% END %] >+>>>>>>> Bug 31606: Make acquisitions fund dropdown consistently show budget name > [% END %] > [% END %] > </select> >@@ -409,21 +411,7 @@ > disabled="disabled" > > > <option value="">Select a fund (will use default if set)</option> >- [% FOREACH budget_loo IN budget_loop %] >- [% 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 %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "budget_item_inactive" %] > </select> > <span class="item_fund required">Required</span> > </li> >@@ -602,21 +590,7 @@ > <label for="all_budget_id">Fund: </label> > <select id="all_budget_id" name="all_budget_id"> > <option value="">Select a fund (will populate orders/items if set)</option> >- [% FOREACH budget_loo IN budget_loop %] >- [% IF ( budget_loo.b_active ) %] >- <option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]" >- >[% budget_loo.b_txt | html %]</option >- > >- [% ELSE %] >- <option >- value="[% budget_loo.b_id | html %]" >- class="b_inactive" >- data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" >- data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]" >- >[% budget_loo.b_txt | html %] (inactive)</option >- > >- [% END %] >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > <label for="all_showallbudgets" style="float:none;width:auto;"> Show inactive:</label> > <input type="checkbox" id="all_showallbudgets" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt >index c2aa5452452..4a667e1478b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt >@@ -215,17 +215,7 @@ > <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" /> > <select id="all_budget_id" name="all_budget_id"> > <option value="">Select a fund</option> >- [% FOREACH budget_loo IN budget_loop %] >- [% IF ( budget_loo.b_active ) %] >- <option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]" >- >[% budget_loo.b_txt | html %]</option >- > >- [% ELSE %] >- <option value="[% budget_loo.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]" >- >[% budget_loo.b_txt | html %] (inactive)</option >- > >- [% END %] >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;"> Show inactive:</label> > <input type="checkbox" id="all_showallbudgets" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >index 91ef1acade2..87c097aabfc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >@@ -10,7 +10,7 @@ > <select id="[% form_id | html %]" name="[% form_name | html %]" class="fund_dropdown" data-selected="[% selected | html %]"> </select> > <label style="float:none;width:auto;" > > Show inactive: >- <input type="checkbox" data-select-id="[% form_id | html %]" class="showallfunds" /> >+ <input type="checkbox" data-select-id="[% form_id | html %]" class="showallfunds" id="showallfunds" /> > </label> > [% END %] > >@@ -527,13 +527,7 @@ > <div style="display:none;"> > <select id="all_fund_dropdown"> > <option value="">No fund</option> >- [% FOREACH budget IN budgets %] >- [% IF ( budget.b_active ) %] >- <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option> >- [% ELSE %] >- <option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat |html %]">[% budget.b_txt | html %] (inactive)</option> >- [% END %] >- [% END # /FOREACH budget %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > </div> > <!-- /#all_fund_dropdown --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 5516e05f1c8..850fa1e0d0b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -584,35 +584,8 @@ > </li> > <li> > <label class="required" for="budget_id">Fund: </label> >- [% active_count = 0 %] >- [% IF !ordernumber %] >- [% FOREACH budget_loo IN budget_loop %] >- [% active_count= active_count + budget_loo.b_active %] >- [% END %] >- [% END %] > <select class="select2" id="budget_id" name="budget_id"> >- <option value="">Select a fund</option> >- [% FOREACH budget_loo IN budget_loop %] >- [% level_indent_cnt = 0 %] >- [% level_indent = "" %] >- [% WHILE level_indent_cnt < budget_loo.b_level %] >- [% level_indent = level_indent _ " -- " %] >- [% level_indent_cnt = level_indent_cnt +1 %] >- [% END %] >- >- [% SET bdgclass = "" %] >- [% IF ( budget_loo.b_sel ) %] >- [% active_count = 0 #select no other fund %] >- [% ELSIF active_count==1 && budget_loo.b_active %] >- >- [% ELSE %] >- [% bdgclass=budget_loo.b_active? "": "b_inactive" | html %] >- [% END %] >- >- <option value="[% budget_loo.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]"> >- [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %] >- </option> >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > <span class="required">Required</span> > <label for="showallbudgets" style="float:none;"> Show inactive:</label> >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 b36f1d39b92..b5b532976ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -284,44 +284,7 @@ > <optgroup label="Current"> > <option id="selected_bookfund" selected="selected"></option> > </optgroup> >- [% FOREACH budget_period_id IN budget_loops.keys %] >- [% SET budget_period = budget_loops.$budget_period_id %] >- [% SET optgroup_class = "" %] >- [% SET optgroup_label = budget_period.description %] >- [% IF budget_period.active %] >- [% SET optgroup_class = "inactive_budget" %] >- [% SET optgroup_label = t("{budget_description} (Inactive)", {budget_description = budget_period.description}) %] >- [% END %] >- >- <optgroup class="inactive_budget" label="[% optgroup_label | html %]"> >- [% FOREACH budget_loo IN budget_period.funds %] >- [% level_indent_cnt = 0 %] >- [% level_indent = "" %] >- [% WHILE level_indent_cnt < budget_loo.b_level %] >- [% level_indent = level_indent _ " -- " %] >- [% level_indent_cnt = level_indent_cnt +1 %] >- [% END %] >- >- [% SET bdgclass = "" %] >- [% IF ( budget_loo.b_sel ) %] >- [% active_count = 0 #select no other fund %] >- [% ELSIF active_count==1 && budget_loo.b_active %] >- >- [% ELSE %] >- [% bdgclass=budget_loo.b_active? "": "inactive_budget" | html %] >- [% END %] >- >- <option >- value="[% budget_loo.b_id | html %]" >- class="[% bdgclass | html %]" >- data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" >- data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]" >- > >- [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %](inactive)[% END %] >- </option> >- [% END %] >- </optgroup> >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "inactive_budget" %] > </select> > <span class="required">Required</span> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >index 08b89893a13..d76c84f2923 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >@@ -182,13 +182,7 @@ > <label for="shipmentcost_budgetid">Shipping fund: </label> > <select id="shipmentcost_budgetid" name="shipmentcost_budgetid"> > <option value="">No fund</option> >- [% FOREACH budget IN budgets %] >- [% IF ( budget.b_active ) %] >- <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option> >- [% ELSE %] >- <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option> >- [% END %] >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label> > <input type="checkbox" id="showallfunds" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index c6b25551d24..930b6cf71f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -1218,19 +1218,11 @@ > [% ELSE %] > <option value="__NONE__">None</option> > [% END %] >- [% FOREACH budget IN sugg_budgets %] >- [% IF ( budget.selected ) %] >- <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option> >- [% ELSIF ( budget.b_active ) %] >- <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option> >- [% ELSE %] >- <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option> >- [% END %] >- [% END %] >+ [% INCLUDE 'budgets_loop.inc' inactive_class = "b_inactive" %] > </select> > <!-- this is needed --> > <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label> >- <input type="checkbox" class="showallfunds" /> >+ <input type="checkbox" class="showallfunds" id="showallfunds" /> > [% END %] > > [% MACRO jsinclude BLOCK %] >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 39521c6495c..4364ebb0e2d 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -545,21 +545,28 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); > $template->param( patron_reason_loop => $patron_reason_loop ); > > # Budgets for suggestion add or edition >-my $sugg_budget_loop = []; >-my $sugg_budgets = GetBudgetHierarchy(); >+my %budget_loops; >+my $sugg_budgets = GetBudgetHierarchy; > foreach my $r ( @{$sugg_budgets} ) { > next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) ); >- my $selected = ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0; >- push @{$sugg_budget_loop}, >- { >- b_id => $r->{budget_id}, >- b_txt => $r->{budget_name}, >- b_active => $r->{budget_period_active}, >- selected => $selected, >- }; >+ unless ( defined $budget_loops{ $r->{budget_period_id} } ) { >+ $budget_loops{ $r->{budget_period_id} }->{description} = $r->{budget_period_description}; >+ $budget_loops{ $r->{budget_period_id} }->{active} = $r->{budget_period_active}; >+ $budget_loops{ $r->{budget_period_id} }->{funds} = []; >+ } >+ push @{ $budget_loops{ $r->{budget_period_id} }->{funds} }, { >+ b_id => $r->{budget_id}, >+ b_txt => $r->{budget_name}, >+ b_code => $r->{budget_code}, >+ b_sort1_authcat => $r->{'sort1_authcat'}, >+ b_sort2_authcat => $r->{'sort2_authcat'}, >+ b_active => $r->{budget_period_active}, >+ b_sel => ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0, >+ b_level => $r->{budget_level}, >+ }; > } >-@{$sugg_budget_loop} = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$sugg_budget_loop}; >-$template->param( sugg_budgets => $sugg_budget_loop ); >+ >+$template->param( budget_loop => \%budget_loops ); > > if ( $suggestion_ref->{STATUS} ) { > $template->param( >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31606
:
140860
|
140958
|
141004
|
148574
|
167427
|
167505
|
167522
|
167908
|
168043
|
168044
|
169264
|
169265
|
169442
|
169521
|
169767
|
169768
|
169769
| 184120 |
184121
|
184122