Bugzilla – Attachment 141733 Details for
Bug 31459
Make order receive page faster on systems with many budgets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31459: (follow-up) Preserve budget period display
Bug-31459-follow-up-Preserve-budget-period-display.patch (text/plain), 7.54 KB, created by
Nick Clemens (kidclamp)
on 2022-10-12 14:57:30 UTC
(
hide
)
Description:
Bug 31459: (follow-up) Preserve budget period display
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-10-12 14:57:30 UTC
Size:
7.54 KB
patch
obsolete
>From f58594268f1e384c90ba9d8dd3e3c5d490878468 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 12 Oct 2022 14:55:55 +0000 >Subject: [PATCH] Bug 31459: (follow-up) Preserve budget period display > >This patch adds a level to the budget_loops and displays the budgets >as optgroups for the funds >--- > acqui/orderreceive.pl | 30 ++++++----- > .../prog/en/modules/acqui/orderreceive.tt | 54 +++++++++++-------- > 2 files changed, 49 insertions(+), 35 deletions(-) > >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 43b9c109f7..31b0855889 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -170,22 +170,28 @@ if ( $suggestion ) { > } > > my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; >-my $budget_loop = []; >+my %budget_loops; > my $budgets = GetBudgetHierarchy( undef, undef, undef, 1 ); >-foreach my $r (@{$budgets}) { >- next unless (CanUserUseBudget($patron, $r, $userflags)); >- push @{$budget_loop}, { >- 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} == $order->budget_id ) ? 1 : 0, >- b_level => $r->{budget_level}, >+foreach my $budget (@{$budgets}) { >+ next unless (CanUserUseBudget($patron, $budget, $userflags)); >+ unless ( defined $budget_loops{$budget->{budget_period_id}} ){ >+ $budget_loops{$budget->{budget_period_id}}->{description} = $budget->{budget_period_description}; >+ $budget_loops{$budget->{budget_period_id}}->{active} = $budget->{budget_period_active}; >+ $budget_loops{$budget->{budget_period_id}}->{funds} = []; >+ } >+ push @{$budget_loops{$budget->{budget_period_id}}->{funds}}, { >+ b_id => $budget->{budget_id}, >+ b_txt => $budget->{budget_name}, >+ b_sort1_authcat => $budget->{'sort1_authcat'}, >+ b_sort2_authcat => $budget->{'sort2_authcat'}, >+ b_active => $budget->{budget_period_active}, >+ b_sel => ( $budget->{budget_id} == $order->budget_id ) ? 1 : 0, >+ b_level => $budget->{budget_level}, > }; > } >-$template->{'VARS'}->{'budget_loop'} = $budget_loop; >+$template->{'VARS'}->{'budget_loops'} = \%budget_loops; > >+warn Data::Dumper::Dumper( \%budget_loops ); > my $op = $input->param('op'); > if ($op and $op eq 'edit'){ > $template->param(edit => 1); >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 2d8660e01b..71524d8976 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -288,33 +288,41 @@ > <label class="required" for="bookfund">Fund: </label> > [% active_count = 0 %] > [% IF !ordernumber %] >- [% FOREACH budget_loo IN budget_loop %] >- [% active_count= active_count + budget_loo.b_active %] >+ [% FOREACH budget_period IN budget_loops.keys %] >+ [% FOREACH fund IN budget_loops.$budget_period.funds %] >+ [% active_count= active_count + fund.b_active %] >+ [% END %] > [% END %] > [% END %] > <select class="select2" id="bookfund" name="bookfund"> >- [% 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 %] >+ [% 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 %]"> >+ [% ELSE %] >+ <optgroup class="inactive_budget" label="[% budget_period.description %] (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? "": "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 %]" >- > >+ [% 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 %] >- [% level_indent | html %][% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %] >- </option> >+ </optgroup> > [% END %] > </select> > <span class="required">Required</span> >@@ -552,14 +560,14 @@ > > //keep a copy of all budgets before removing the inactives > disabledBudgetsCopy = $('#bookfund').html(); >- $('#bookfund .b_inactive').remove(); >+ $('#bookfund .inactive_budget').remove(); > > $('#showallbudgets').click(function() { > if ($(this).is(":checked")) { > $('#bookfund').html(disabledBudgetsCopy); //Puts back all the funds > } > else { >- $('#bookfund .b_inactive').remove(); >+ $('#bookfund .inactive_budget').remove(); > } > }); > >-- >2.30.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 31459
:
139767
|
140065
|
140168
|
141733
|
141734
|
141960
|
142019
|
142020
|
142021
|
142022