Bugzilla – Attachment 116702 Details for
Bug 23767
Spent and Ordered total values don't include child funds on acqui-home
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23767: Total children only if parents not visible
Bug-23767-Total-children-only-if-parents-not-visib.patch (text/plain), 5.95 KB, created by
Martin Renvoize (ashimema)
on 2021-02-11 10:39:15 UTC
(
hide
)
Description:
Bug 23767: Total children only if parents not visible
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-11 10:39:15 UTC
Size:
5.95 KB
patch
obsolete
>From 1782e96cb989d429866abf91575014952bd35f2e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 3 Feb 2021 14:48:37 +0000 >Subject: [PATCH] Bug 23767: Total children only if parents not visible > >This patch changes the way to calculate the footer. It adds the budget and parent ids to the cell >as custom data elements. When totaling we grab a list of all the rows we are showing - if a >row has a parent and the parent is showing then we skip adding its value to the total. > >As the function is used on both acqui-home and aqbudgets I adjusted both templates > >To test: >1 - Follow the test plan on previous patch >2 - Try filtering the table so you see only the child funds >3 - Confirm the totals show the child alone when it is visible >4 - Confirm the child total is excluded when the parent is visible > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/modules/acqui/acqui-home.tt | 12 ++------ > .../prog/en/modules/admin/aqbudgets.tt | 30 +++++-------------- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 9 +++++- > 3 files changed, 18 insertions(+), 33 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >index af67b5abac..3f9d38c9ba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >@@ -145,11 +145,7 @@ > </td> > <td>[% Branches.GetName( loop_budge.budget_branchcode ) | html %]</td> > <td class="data"> >- [% IF loop_budge.budget_parent_id %] >- [% loop_budge.budget_amount | $Price %] >- [% ELSE %] >- <span class="total_amount">[% loop_budge.budget_amount | $Price %]</span> >- [% END %] >+ <span class="total_amount" data-parent_id="[% loop_budge.budget_parent_id | html %]" data-self_id="[% loop_budge.budget_id | html %]">[% loop_budge.budget_amount | $Price %]</span> > </td> > <td class="data"> > <a href="ordered.pl?fund=[% loop_budge.budget_id | uri %]&fund_code=[% loop_budge.budget_code | uri %]"> >@@ -162,11 +158,7 @@ > </a> > </td> > <td class="data"> >- [% IF loop_budge.budget_parent_id %] >- [% loop_budge.budget_avail | $Price %] >- [% ELSE %] >- <span class="total_amount">[% loop_budge.budget_avail | $Price %]</span> >- [% END %] >+ <span class="total_amount" data-parent_id="[% loop_budge.budget_parent_id | html %]" data-self_id="[% loop_budge.budget_id | html %]">[% loop_budge.budget_avail | $Price %]</span> > </td> > </tr> > [% END %] >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 eea28784ea..9b7487a691 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >@@ -103,11 +103,7 @@ > <td>[% budget.budget_code | html %]</td> > <td>[% budget.budget_name | html %]</td> > <td class="data"> >- [% IF budget.budget_parent_id %] >- <span class="child_fund_amount">[% budget.budget_amount | $Price %]</span> >- [% ELSE %] >- <span class="total_amount">[% budget.budget_amount | $Price %]</span> >- [% END %] >+ <span class="total_amount" data-parent_id="[% budget.budget_parent_id | html %]" data-self_id="[% budget.budget_id | html %]">[% budget.budget_amount | $Price %]</span> > </td> > <td class="data"> > [% IF budget.budget_parent_id %] >@@ -140,24 +136,14 @@ > > > [% BLOCK colorcellvalue %] >- [% IF parent %] >- [% IF (value > 0) %] >- <span class="child_fund_amount" style="color: green;"> >- [% ELSIF (value < 0) %] >- <span class="child_fund_amount" style="color: red;"> >- [% ELSE %] >- <span class="child_fund_amount"> >- [% END %] >- [% ELSE %] >- [% IF (value > 0) %] >- <span class="total_amount" style="color: green;"> >- [% ELSIF (value < 0) %] >- <span class="total_amount" style="color: red;"> >- [% ELSE %] >- <span class="totalamount"> >- [% END %] >+ [% IF (value > 0) %] >+ <span class="total_amount" data-parent_id="[% budget.budget_parent_id | html %]" data-self_id="[% budget.budget_id | html %]" style="color: green;"> >+ [% ELSIF (value < 0) %] >+ <span class="total_amount" style="color: red;"> >+ [% ELSE %] >+ <span class="totalamount"> > [% END %] >- [% value | $Price %] >+ [% value | $Price %] > </span> > [% END %] > <td class="data"> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 8b6d18d85e..da01ac8ba0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -486,8 +486,15 @@ function footer_column_sum( api, column_numbers ) { > > var total = 0; > var cells = api.column( column_number, { page: 'current' } ).nodes().to$().find("span.total_amount"); >+ var budgets_totaled = []; >+ $(cells).each(function(){ budgets_totaled.push( $(this).data('self_id') ); }); > $(cells).each(function(){ >- total += intVal( $(this).html() ); >+ if( $(this).data('parent_id') && $.inArray( $(this).data('parent_id'), budgets_totaled) > -1 ){ >+ return; >+ } else { >+ total += intVal( $(this).html() ); >+ } >+ > }); > total /= 100; // Hard-coded decimal precision > >-- >2.20.1
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 23767
:
93828
|
94811
|
95334
|
95335
|
95840
|
95841
|
95987
|
95988
|
98618
|
116258
|
116284
|
116285
|
116701
| 116702