Bugzilla – Attachment 83824 Details for
Bug 21098
Add missing budget optgroups to parcels.tt and newemptyorder.tt
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21098: Add missing budget optgroups to parcels.tt and newemptyorder.tt
Bug-21098-Add-missing-budget-optgroups-to-parcelst.patch (text/plain), 11.11 KB, created by
José-Mario Monteiro-Santos
on 2019-01-11 19:54:28 UTC
(
hide
)
Description:
Bug 21098: Add missing budget optgroups to parcels.tt and newemptyorder.tt
Filename:
MIME Type:
Creator:
José-Mario Monteiro-Santos
Created:
2019-01-11 19:54:28 UTC
Size:
11.11 KB
patch
obsolete
>From 08f8ce46955805767fc5b9df72cc72e5f7c2aca8 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 20 Jul 2018 18:02:27 +1000 >Subject: [PATCH] Bug 21098: Add missing budget optgroups to parcels.tt and > newemptyorder.tt > >I noticed that orderreceive.tt organizes funds by budget, but neworderempty.tt >and parcels.tt do not. That is to say, when placing an order there is no >organisation of funds in the drop-down menu, but there is when you recive an order, >but not when you receive a shipment (ie choose a Shipping fund). > >This patch seeks to harmonize the user experience, so that users are always >seeing funds organised by budget. > >_TEST PLAN_ >1. Add two budgets >2. Add one fund to each budget >3. Add a vendor >4. Add a basket >5. Add an order >5b. Note that you can now see funds grouped by budget >6. Close the basket >7. Receive the shipment >7b. Note that you can now see funds groups by budget >8. Receive the order >8b. Note that the organisation of funds is the same as the > other two areas (even though the patch doesn't touch this one). > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Jose-Mario <jose-mario.monteiro-santos@inLibro.com> >--- > acqui/neworderempty.pl | 41 +++++++++++++------- > acqui/parcels.pl | 37 +++++++++++------- > .../prog/en/modules/acqui/neworderempty.tt | 44 ++++++++++++---------- > .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 14 ++++--- > 4 files changed, 84 insertions(+), 52 deletions(-) > >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 9ca2b5b..a30a5e7 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -318,21 +318,34 @@ my $patron = Koha::Patrons->find( $loggedinuser )->unblessed; > my $budget = GetBudget($budget_id); > # build budget list > my $budget_loop = []; >-my $budgets = GetBudgetHierarchy; >-foreach my $r (@{$budgets}) { >- next unless (CanUserUseBudget($patron, $r, $userflags)); >- if (!defined $r->{budget_amount} || $r->{budget_amount} <0) { >- next; >+my $periods = GetBudgetPeriods(); >+foreach my $period (@$periods) { >+ my $budget_hierarchy = GetBudgetHierarchy( $period->{'budget_period_id'} ); >+ my @funds; >+ foreach my $r (@{$budget_hierarchy}) { >+ next unless (CanUserUseBudget($patron, $r, $userflags)); >+ if (!defined $r->{budget_amount} || $r->{budget_amount} <0) { >+ next; >+ } >+ push @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}, >+ }; > } >- 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} == $budget_id ) ? 1 : 0, >- b_level => $r->{budget_level}, >- }; >+ >+ @funds = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @funds; >+ >+ push @$budget_loop, >+ { >+ 'id' => $period->{'budget_period_id'}, >+ 'description' => $period->{'budget_period_description'}, >+ 'funds' => \@funds >+ }; > } > > if ($close) { >diff --git a/acqui/parcels.pl b/acqui/parcels.pl >index c0a330b..85aecbd 100755 >--- a/acqui/parcels.pl >+++ b/acqui/parcels.pl >@@ -179,22 +179,31 @@ if ($count_parcels) { > > # build budget list > my $budget_loop = []; >-my $budgets = GetBudgetHierarchy; >-foreach my $r (@{$budgets}) { >- next unless (CanUserUseBudget($loggedinuser, $r, $flags)); >- if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) { >- next; >+my $periods = GetBudgetPeriods(); >+foreach my $period (@$periods) { >+ my $budget_hierarchy = GetBudgetHierarchy( $period->{'budget_period_id'} ); >+ my @funds; >+ foreach my $r (@{$budget_hierarchy}) { >+ next unless (CanUserUseBudget($loggedinuser, $r, $flags)); >+ if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) { >+ next; >+ } >+ push @funds, { >+ b_id => $r->{budget_id}, >+ b_txt => $r->{budget_name}, >+ b_active => $r->{budget_period_active}, >+ }; > } >- push @{$budget_loop}, { >- b_id => $r->{budget_id}, >- b_txt => $r->{budget_name}, >- b_active => $r->{budget_period_active}, >- }; >-} > >-@{$budget_loop} = >- sort { uc( $a->{b_txt}) cmp uc( $b->{b_txt}) } @{$budget_loop}; >+ @funds = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @funds; > >+ push @$budget_loop, >+ { >+ 'id' => $period->{'budget_period_id'}, >+ 'description' => $period->{'budget_period_description'}, >+ 'funds' => \@funds >+ }; >+} > > $template->param( > orderby => $order, >@@ -206,7 +215,7 @@ $template->param( > shipmentdate_today => dt_from_string, > booksellerid => $booksellerid, > GST => C4::Context->preference('gist'), >- budgets => $budget_loop, >+ budget_loop => $budget_loop, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >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 b3b8b41..74626a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -340,30 +340,36 @@ > <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 %] >+ [% FOREACH period IN budget_loop %] >+ [% FOREACH fund IN period.funds %] >+ [% active_count= active_count + fund.b_active %] >+ [% END %] > [% END %] > [% END %] > <select id="budget_id" size="1" name="budget_id"> > <option value="">Select a fund</option> >- [% FOREACH budget_loo IN budget_loop %] >- [% 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 %]" >- style="padding-left:[% budget_loo.b_level | html %]em;" >- > >- [% 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 %]" >- style="padding-left:[% budget_loo.b_level | html %]em;" >- > >- [% 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 %]" >- style="padding-left:[% budget_loo.b_level | html %]em;" >- > >+ [% FOREACH period IN budget_loop %] >+ <optgroup label="[% period.description | html %]"> >+ [% FOREACH fund IN period.funds %] >+ [% IF ( fund.b_sel ) %] >+ [% active_count = 0 #select no other fund %] >+ <option value="[% fund.b_id | html %]" selected="selected" data-sort1-authcat="[% fund.b_sort1_authcat | html %]" data-sort2-authcat="[% fund.b_sort2_authcat | html %]" >+ style="padding-left:[% fund.b_level | html %]em;" >+ > >+ [% ELSIF active_count==1 && fund.b_active %] >+ <option value="[% fund.b_id | html %]" selected="selected" data-sort1-authcat="[% fund.b_sort1_authcat | html %]" data-sort2-authcat="[% fund.b_sort2_authcat | html %]" >+ style="padding-left:[% fund.b_level | html %]em;" >+ > >+ [% ELSE %] >+ [% bdgclass=fund.b_active? "": "b_inactive" | html %] >+ <option value="[% fund.b_id | html %]" class="[% bdgclass | html %]" data-sort1-authcat="[% fund.b_sort1_authcat | html %]" data-sort2-authcat="[% fund.b_sort2_authcat | html %]" >+ style="padding-left:[% fund.b_level | html %]em;" >+ > >+ [% END %] >+ [% fund.b_txt | html %][% IF !fund.b_active %] (inactive)[% END %] >+ </option> > [% END %] >- [% budget_loo.b_txt | html %][% IF !budget_loo.b_active %] (inactive)[% END %] >- </option> >+ </optgroup> > [% END %] > </select> > <span class="required">Required</span> >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 8cade03..55af3f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >@@ -158,12 +158,16 @@ > <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> >+ [% FOREACH period IN budget_loop %] >+ <optgroup label="[% period.description | html %]"> >+ [% FOREACH fund IN period.funds %] >+ [% IF ( fund.b_active ) %] >+ <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option> >+ [% ELSE %] >+ <option value="[% fund.b_id | html %]" class="b_inactive">[% fund.b_txt | html %] (inactive)</option> >+ [% END %] > [% END %] >+ </optgroup> > [% END %] > </select> > <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label> >-- >2.7.4
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 21098
:
77153
|
82526
|
82878
| 83824