Bugzilla – Attachment 33776 Details for
Bug 13320
Some prices calculation are done in template side
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13320: Move price calculation from tt to pl
Bug-13320-Move-price-calculation-from-tt-to-pl.patch (text/plain), 4.57 KB, created by
Jonathan Druart
on 2014-11-21 11:37:15 UTC
(
hide
)
Description:
Bug 13320: Move price calculation from tt to pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-11-21 11:37:15 UTC
Size:
4.57 KB
patch
obsolete
>From 05154dffd7a6bd815f6a3beb5db1f4e83638f543 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 19 Nov 2014 13:37:03 +0100 >Subject: [PATCH] Bug 13320: Move price calculation from tt to pl > >In parcel.tt, total are calculated for subtotal. > >This could be done in the pl script for more consistency. > >Test plan: >Go on a parcel page with several already received orders. >Orders must be linked to different funds. >If possible ecost and unitprice (price on ordering and on receiving) >should changed (different values will be displayed in the table). > >The values displayed before and after the patch must be the same. >--- > acqui/parcel.pl | 13 +++++++++---- > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 21 +++------------------ > 2 files changed, 12 insertions(+), 22 deletions(-) > >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 5902a22..5edd171 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -122,6 +122,7 @@ my %foot; > my $total_gste = 0; > my $total_gsti = 0; > >+my $subtotal_for_funds; > for my $order ( @orders ) { > $order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 }); > $order->{'unitprice'} += 0; >@@ -164,8 +165,11 @@ for my $order ( @orders ) { > } > } > >- my $budget = GetBudget( $line{budget_id} ); >- $line{budget_name} = $budget->{'budget_name'}; >+ my $budget_name = GetBudgetName( $line{budget_id} ); >+ $line{budget_name} = $budget_name; >+ >+ $subtotal_for_funds->{ $line{budget_name} }{ecost} += $order->{ecost} * $order->{quantity}; >+ $subtotal_for_funds->{ $line{budget_name} }{unitprice} += $order->{total}; > > push @loop_received, \%line; > } >@@ -263,8 +267,8 @@ unless( defined $invoice->{closedate} ) { > $line{holds} = $holds; > $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; > >- my $budget = GetBudget( $line{budget_id} ); >- $line{budget_name} = $budget->{'budget_name'}; >+ my $budget_name = GetBudgetName( $line{budget_id} ); >+ $line{budget_name} = $budget_name; > > push @loop_orders, \%line; > } >@@ -289,6 +293,7 @@ $template->param( > (uc(C4::Context->preference("marcflavour"))) => 1, > total_gste => $total_gste, > total_gsti => $total_gsti, >+ subtotal_for_funds => $subtotal_for_funds, > sticky_filters => $sticky_filters, > ); > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index 6d581f4..2032dd7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -326,21 +326,6 @@ > > > [% IF ( loop_received ) %] >- [% SET funds = {} %] >- [% SET estimated_total = 0 %] >- >- [% FOREACH loop_receive IN loop_received %] >- [% IF (funds.${ loop_receive.budget.budget_name }.estimated == '') %] >- [% SET funds.${ loop_receive.budget.budget_name }.estimated = 0 %] >- [% END %] >- [% IF (funds.${ loop_receive.budget.budget_name }.actual == '') %] >- [% SET funds.${ loop_receive.budget.budget_name }.actual = 0 %] >- [% END %] >- [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %] >- [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%] >- [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %] >- [% END %] >- > <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform"> > <table id="receivedt"> > <thead> >@@ -360,12 +345,12 @@ > </tr> > </thead> > <tfoot> >- [% FOREACH key IN funds.keys.sort %] >+ [% FOREACH key IN subtotal_for_funds.keys.sort %] > <tr> > <td colspan="6" class="total">(Tax exc.)</td> > <td colspan="2"><i>Subtotal for</i> [% key %]</td> >- <td>[% funds.$key.estimated | $Price %]</td> >- <td>[% funds.$key.actual | $Price %]</td> >+ <td>[% subtotal_for_funds.$key.ecost | $Price %]</td> >+ <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td> > <td> </td> > <td> </td> > </tr> >-- >2.1.0
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 13320
:
33776
|
34033
|
34755
|
34756
|
34759
|
34760
|
34812
|
35429
|
35430
|
35563
|
35564
|
35565