Bugzilla – Attachment 16395 Details for
Bug 7308
new column in admin/aqbudgets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7308: rework aqbudgets.pl table
0002-Bug-7308-rework-aqbudgets.pl-table.patch (text/plain), 9.56 KB, created by
Fridolin Somers
on 2013-03-19 14:09:04 UTC
(
hide
)
Description:
Bug 7308: rework aqbudgets.pl table
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-03-19 14:09:04 UTC
Size:
9.56 KB
patch
obsolete
>From 4e3f5ca0139e2efd87a49cbd40e0248ec05016c1 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 11 Oct 2012 14:14:20 +0200 >Subject: [PATCH 2/2] Bug 7308: rework aqbudgets.pl table > >admin/aqbudgets.pl should have the following columns: > >Base-level allocated (or just Allocated) >Base-level ordered >Total sub-levels ordered >Base-level spent >Total sub-levels spent >Base-level available >Total sub-levels available > >Base-level is always calculated for one level, without children. >Total sub-levels should include child funds. >Available is calculated as "allocated - (ordered + spent)". > >Signed-off-by: Cedric Vita <cedric.vita@dracenie.com> >--- > C4/Budgets.pm | 11 ++--- > admin/aqbudgets.pl | 52 +++++++++----------- > .../prog/en/modules/admin/aqbudgets.tt | 46 ++++++++++------- > 3 files changed, 57 insertions(+), 52 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 1005aeb..7931d97 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -589,16 +589,13 @@ sub GetBudgetHierarchy { > $r->{'budget_spent'} = GetBudgetSpent( $r->{'budget_id'} ); > $r->{budget_ordered} = GetBudgetOrdered( $r->{budget_id} ); > >- $r->{'budget_amount_total'} = $r->{'budget_amount'}; >- >+ $r->{budget_spent_sublevels} = 0; >+ $r->{budget_ordered_sublevels} = 0; > # foreach sub-levels >- my $unalloc_count ; >- > foreach my $sub (@subs_arr) { > my $sub_budget = GetBudget($sub); >- >- $r->{budget_spent_sublevel} += GetBudgetSpent( $sub_budget->{'budget_id'} ); >- $unalloc_count += $sub_budget->{'budget_amount'}; >+ $r->{budget_spent_sublevels} += GetBudgetSpent( $sub_budget->{'budget_id'} ); >+ $r->{budget_ordered_sublevels} += GetBudgetOrdered($sub); > } > } > return \@sort; >diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl >index bc2331d..40dec0c 100755 >--- a/admin/aqbudgets.pl >+++ b/admin/aqbudgets.pl >@@ -277,14 +277,14 @@ if ($op eq 'add_form') { > my $toggle = 0; > my @loop; > my $period_total = 0; >- my ( $period_alloc_total, $base_spent_total, $base_ordered_total ); >+ my ($period_alloc_total, $spent_total, $ordered_total, $available_total) = (0,0,0,0); > > #This Looks WEIRD to me : should budgets be filtered in such a way ppl who donot own it would not see the amount spent on the budget by others ? > > foreach my $budget (@budgets) { >- #Level and sublevels total spent >- $budget->{'total_levels_spent'} = GetChildBudgetsSpent($budget->{"budget_id"}); >- >+ #Level and sublevels total spent and ordered >+ $budget->{total_spent} = $budget->{budget_spent_sublevels} + $budget->{budget_spent}; >+ $budget->{total_ordered} = $budget->{budget_ordered_sublevels} + $budget->{budget_ordered}; > # PERMISSIONS > unless(CanUserModifyBudget($borrowernumber, $budget, $staffflags)) { > $budget->{'budget_lock'} = 1; >@@ -301,22 +301,29 @@ if ($op eq 'add_form') { > } > > ## TOTALS >+ $budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'budget_spent'} - $budget->{budget_ordered}; >+ $budget->{'total_remaining'} = $budget->{'budget_amount'} - $budget->{'total_spent'} - $budget->{total_ordered}; > # adds to total - only if budget is a 'top-level' budget >- $period_alloc_total += $budget->{'budget_amount_total'} if $budget->{'depth'} == 0; >- $base_spent_total += $budget->{'budget_spent'}; >- $base_ordered_total += $budget->{budget_ordered}; >- $budget->{'budget_remaining'} = $budget->{'budget_amount'} - $budget->{'total_levels_spent'}; >+ if ($budget->{depth} == 0) { >+ $period_alloc_total += $budget->{'budget_amount'}; >+ $spent_total += $budget->{total_spent}; >+ $ordered_total += $budget->{total_ordered}; >+ $available_total += $budget->{total_remaining}; >+ } > > # if amount == 0 dont display... > delete $budget->{'budget_unalloc_sublevel'} > if (!defined $budget->{'budget_unalloc_sublevel'} > or $budget->{'budget_unalloc_sublevel'} == 0); > >- $budget->{'remaining_pos'} = 1 if $budget->{'budget_remaining'} > 0; >- $budget->{'remaining_neg'} = 1 if $budget->{'budget_remaining'} < 0; >- for (grep {/total_levels_spent|budget_spent|budget_ordered|budget_amount|budget_remaining|budget_unalloc/} keys %$budget){ >+ for (grep {/total_spent|budget_spent|total_ordered|budget_ordered|budget_amount/} keys %$budget){ > $budget->{$_} = $num->format_price( $budget->{$_} ) if defined($budget->{$_}) > } >+ for (qw/budget_remaining total_remaining/) { >+ if (defined $budget->{$_}) { >+ $budget->{$_.'_display'} = $num->format_price($budget->{$_}); >+ } >+ } > > # Value of budget_spent equals 0 instead of undefined value > $budget->{"budget_spent"} = $num->format_price(0) unless defined($budget->{"budget_spent"}); >@@ -345,22 +352,10 @@ if ($op eq 'add_form') { > ); > } > >- my $budget_period_total; >- if ( $period->{budget_period_total} ) { >- $budget_period_total = >- $num->format_price( $period->{budget_period_total} ); >- } >- >- if ($period_alloc_total) { >- $period_alloc_total = $num->format_price($period_alloc_total); >- } >- >- if ($base_spent_total) { >- $base_spent_total = $num->format_price($base_spent_total); >- } >+ my $budget_period_total = $period->{budget_period_total}; > >- if ($base_ordered_total) { >- $base_ordered_total = $num->format_price($base_ordered_total); >+ foreach ($budget_period_total, $period_alloc_total, $spent_total, $ordered_total, $available_total) { >+ $_ = $num->format_price($_); > } > > $template->param( >@@ -368,8 +363,9 @@ if ($op eq 'add_form') { > budget => \@loop, > budget_period_total => $budget_period_total, > period_alloc_total => $period_alloc_total, >- base_spent_total => $base_spent_total, >- base_ordered_total => $base_ordered_total, >+ spent_total => $spent_total, >+ ordered_total => $ordered_total, >+ available_total => $available_total, > branchloop => \@branchloop2, > ); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >index 23d5166..83b9310 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >@@ -226,12 +226,13 @@ > <tr> > <th>Fund code</th> > <th>Fund name</th> >- <th>Total<br />allocated</th> > <th>Base-level<br />allocated</th> > <th>Base-level<br />ordered</th> >+ <th>Total ordered</th> > <th>Base-level<br />spent</th> >- <th>Total sublevels<br />spent</th> >- <th>Base-level<br />remaining</th> >+ <th>Total spent</th> >+ <th>Base-level<br />available</th> >+ <th>Total available</th> > <th class="tooltipcontent"> </th> > <th>Actions</th> > </tr> >@@ -240,12 +241,13 @@ > <tr> > <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %] </th> > <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th> >- <th nowrap="nowrap" class="data"> [% base_alloc_total %]</th> >- <th class="data">[% base_ordered_total %]</th> >- <th class="data">[% base_spent_total %]</th> >- <th class="data">[% base_spent_total %]</th> >- <th class="data">[% base_remaining_total %]</th> >+ <th></th> >+ <th class="data">[% ordered_total %]</th> >+ <th></th> >+ <th class="data">[% spent_total %]</th> >+ <th></th> > <th class="tooltipcontent"></th> >+ <th class="data">[% available_total %]</th> > <th></th> > </tr> > </tfoot> >@@ -260,19 +262,29 @@ > > <td>[% budge.budget_code_indent %]</td> > <td>[% budge.budget_name %]</td> >- <td class="data">[% budge.budget_amount_total %]</td> > <td class="data">[% budge.budget_amount %] </td> > <td class="data">[% budge.budget_ordered %]</td> >+ <td class="data">[% budge.total_ordered %]</td> > <td class="data">[% budge.budget_spent %] </td> >- <td class="data">[% budge.total_levels_spent %]</td> >- [% IF ( budge.remaining_pos ) %] >- <td class="data" style="color: green;"> >- [% ELSIF ( budge.remaining_neg ) %] >- <td class="data" style="color: red;"> >- [% ELSE %] >- <td class="data"> >+ <td class="data">[% budge.total_spent %]</td> >+ >+ [% BLOCK colorcellvalue %] >+ [% IF (value > 0) %] >+ <span style="color: green;"> >+ [% ELSIF (value < 0) %] >+ <span style="color: red;"> >+ [% ELSE %] >+ <span> >+ [% END %] >+ [% text %] >+ </span> > [% END %] >- [% budge.budget_remaining %] </td> >+ <td class="data"> >+ [% INCLUDE colorcellvalue value=budge.budget_remaining text=budge.budget_remaining_display %] >+ </td> >+ <td class="data"> >+ [% INCLUDE colorcellvalue value=budge.total_remaining text=budge.total_remaining_display %] >+ </td> > > <td class="tooltipcontent">[% IF ( budge.budget_owner_id ) %]<strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budge.budget_owner_id %]">[% budge.budget_owner_name %]</a>[% END %] > [% IF ( budge.budget_branchcode ) %]<br /><strong>Library: </strong>[% budge.budget_branchcode %][% END %] >-- >1.7.10.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 7308
:
9167
|
12769
|
16011
|
16012
|
16381
|
16394
|
16395
|
19824
|
19825
|
19826
|
19859
|
22462
|
24936
|
24937