Bugzilla – Attachment 169767 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), 39.95 KB, created by
ByWater Sandboxes
on 2024-07-26 17:17:53 UTC
(
hide
)
Description:
Bug 31606: Make acquisitions fund dropdown consistently show budget name
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2024-07-26 17:17:53 UTC
Size:
39.95 KB
patch
obsolete
>From 1cbe5ff1ae3012d3edd2f73ff4efd8049d974477 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 | 29 +++++++------- > acqui/duplicate_orders.pl | 26 +++++++------ > acqui/invoice.pl | 32 ++++++++-------- > acqui/neworderempty.pl | 29 ++++++++------ > acqui/orderreceive.pl | 2 +- > acqui/parcels.pl | 30 +++++++++------ > .../prog/en/includes/budgets_loop.inc | 28 ++++++++++++++ > .../prog/en/modules/acqui/addorderiso2709.tt | 38 ++----------------- > .../prog/en/modules/acqui/duplicate_orders.tt | 6 +-- > .../prog/en/modules/acqui/invoice.tt | 10 +---- > .../prog/en/modules/acqui/neworderempty.tt | 31 +-------------- > .../prog/en/modules/acqui/orderreceive.tt | 30 +-------------- > .../prog/en/modules/acqui/parcels.tt | 8 +--- > .../prog/en/modules/suggestion/suggestion.tt | 12 +----- > suggestion/suggestion.pl | 31 +++++++++------ > 15 files changed, 140 insertions(+), 202 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 4b4d899031..e777e64c17 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -400,25 +400,28 @@ 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}, >- { b_id => $r->{budget_id}, >- b_txt => $r->{budget_name}, >- b_code => $r->{budget_code}, >+ 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} == $budget_id ) ? 1 : 0, >- }; >+ 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 05b6b28628..a3666e8815 100755 >--- a/acqui/duplicate_orders.pl >+++ b/acqui/duplicate_orders.pl >@@ -102,28 +102,30 @@ elsif ( $op eq 'cud-batch_edit' ) { > @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' ) { >diff --git a/acqui/invoice.pl b/acqui/invoice.pl >index 2c88908086..41fdc000c8 100755 >--- a/acqui/invoice.pl >+++ b/acqui/invoice.pl >@@ -293,27 +293,27 @@ 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}, >- { >- 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 => $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 ); } > >@@ -345,7 +345,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 95c31d9aa8..082ccea63f 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -333,24 +333,29 @@ my $active_currency = Koha::Acquisition::Currencies->get_active; > # build bookfund list > my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; > >-my $budget = GetBudget($budget_id); >+my $budget = GetBudget($budget_id); >+ > # build budget list >-my $budget_loop = []; >+my %budget_loops; > my $budgets = GetBudgetHierarchy; >-foreach my $r (@{$budgets}) { >- next unless (CanUserUseBudget($patron, $r, $userflags)); >- push @{$budget_loop}, { >- b_id => $r->{budget_id}, >- b_txt => $r->{budget_name}, >+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_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, >- b_level => $r->{budget_level}, >+ b_active => $r->{budget_period_active}, >+ b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, >+ b_level => $r->{budget_level}, > }; > } > >- > $template->param( sort1 => $data->{'sort1'} ); > $template->param( sort2 => $data->{'sort2'} ); > >@@ -487,7 +492,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 550e41e810..1a660404f1 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -199,7 +199,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 0cbc6d7671..c9d458fb4c 100755 >--- a/acqui/parcels.pl >+++ b/acqui/parcels.pl >@@ -198,21 +198,27 @@ if ($count_parcels) { > } > > # build budget list >-my $budget_loop = []; >+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}, >+foreach my $r ( @{$budgets} ) { >+ next unless ( CanUserUseBudget( $loggedinuser, $r, $flags ) ); >+ 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, >@@ -223,7 +229,7 @@ $template->param( > shipmentdate_today => dt_from_string, > booksellerid => $booksellerid, > GST => C4::Context->preference('TaxRates'), >- budgets => $budget_loop, >+ budget_loop => \%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 0000000000..d23e0c40b3 >--- /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 %] >+ [% IF budget_period.active %] >+ <optgroup label="[% budget_period.description | html %]"> >+ [% ELSE %] >+ <optgroup class="[% inactive_class | html %]" label="[% budget_period.description | html %] (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 %]"> >+ [% 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 %]"> >+ [% 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 %]"> >+ [% END %] >+ [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %] >+ </option> >+ [% 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 09066e6795..12abc2f71b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >@@ -213,19 +213,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 %] >@@ -345,21 +333,7 @@ > <label for="budget_code_item_[% item.item_id | html %]">budget_code</label> > <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_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> >@@ -506,13 +480,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 7657df8bff..95ecfe6bb3 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 >@@ -211,11 +211,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 e4e2dd561c..1bd360f494 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 for="showallfunds" style="float:none;width:auto;"> Show inactive:</label> >- <input type="checkbox" class="showallfunds" /> >+ <input type="checkbox" class="showallfunds" id="showallfunds" /> > [% END %] > > [% INCLUDE 'doc-head-open.inc' %] >@@ -528,13 +528,7 @@ > > <span style="display:none;" 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" %] > </span> <!-- /#all_fund_dropdown --> > > [% MACRO jsinclude BLOCK %] >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 a8aa424cfe..86b8b8878b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -592,37 +592,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 %] >- >- [% 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 %]" >- > >- [% 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 %]" >- > >- [% ELSE %] >- [% bdgclass=budget_loo.b_active? "": "b_inactive" | 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 %]" >- > >- [% END %] >- [% 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 ba3e00dfb4..f156d90895 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -291,35 +291,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 %] >- [% IF budget_period.active %] >- <optgroup label="[% budget_period.description | html %]"> >- [% ELSE %] >- <optgroup class="inactive_budget" label="[% budget_period.description | html %] (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 %]"> >- [% 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 %]"> >- [% ELSE %] >- [% bdgclass=budget_loo.b_active? "": "inactive_budget" | 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 %]"> >- [% END %] >- [% 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 703227a53d..99556f73ff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >@@ -179,13 +179,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 4b5b7eb03f..9571fc6f67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -1280,19 +1280,11 @@ > <option value="__NONE__">None</option> > [% END %] > [% 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 2f6b53970f..a4fb5c634e 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -509,21 +509,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.2
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