Bugzilla – Attachment 74374 Details for
Bug 18736
Problems in order calculations (rounding errors)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18736: [DO NOT PUSH] C4/Acquisition print scaffolding.
Bug-18736-DO-NOT-PUSH-C4Acquisition-print-scaffold.patch (text/plain), 4.91 KB, created by
Mark Tompsett
on 2018-04-17 18:09:21 UTC
(
hide
)
Description:
Bug 18736: [DO NOT PUSH] C4/Acquisition print scaffolding.
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-04-17 18:09:21 UTC
Size:
4.91 KB
patch
obsolete
>From 64592a6400c0411a1ddef111b3405babceb4749e Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Tue, 17 Apr 2018 18:08:07 +0000 >Subject: [PATCH] Bug 18736: [DO NOT PUSH] C4/Acquisition print scaffolding. > >Need to trigger all the print STDERR "C4/Acquisition.pm... >cases. >--- > C4/Acquisition.pm | 24 ++++++++++++++++++++---- > 1 file changed, 20 insertions(+), 4 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 6d06f1f..056c26a 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -96,6 +96,7 @@ BEGIN { > > &get_rounded_price > ); >+ print STDERR "C4/Acquisition.pm 1\n"; > } > > >@@ -1478,6 +1479,7 @@ sub ModReceiveOrder { > tax_value_on_receiving = quantity * | . _get_rounding_sql(q|unitprice_tax_excluded|) . q| * tax_rate_on_receiving > WHERE ordernumber = ? > |, undef, $order->{ordernumber}); >+ print STDERR "C4/Acquisition.pm 2\n"; > > delete $order->{ordernumber}; > $order->{budget_id} = ( $budget_id || $order->{budget_id} ); >@@ -1489,6 +1491,7 @@ sub ModReceiveOrder { > $order->{tax_rate_on_receiving} //= 0; > $order->{tax_value_on_ordering} = $order->{quantity} * get_rounded_price($order->{ecost_tax_excluded}) * $order->{tax_rate_on_ordering}; > $order->{tax_value_on_receiving} = $order->{quantity} * get_rounded_price($order->{unitprice_tax_excluded}) * $order->{tax_rate_on_receiving}; >+ print STDERR "C4/Acquisition.pm 3\n"; > $order->{datereceived} = $datereceived; > $order->{invoiceid} = $invoice->{invoiceid}; > $order->{orderstatus} = 'complete'; >@@ -1654,6 +1657,7 @@ sub CancelReceipt { > tax_value_on_receiving = quantity * | . _get_rounding_sql(q|unitprice_tax_excluded|) . q| * tax_rate_on_receiving > WHERE ordernumber = ? > |, undef, $parent_ordernumber); >+ print STDERR "C4/Acquisition.pm 4\n"; > > _cancel_items_receipt( $order_obj, $parent_ordernumber ); > # Delete order line >@@ -2013,8 +2017,12 @@ returns the correct SQL routine based on OrderPriceRounding system preference. > sub _get_rounding_sql { > my ( $round_string ) = @_; > my $rounding_pref = C4::Context->preference('OrderPriceRounding'); >- if ( $rounding_pref eq "nearest_cent" ) { return ("CAST($round_string*100 AS INTEGER)/100"); } >- else { return ("$round_string"); } >+ if ( $rounding_pref eq "nearest_cent" ) { >+ print STDERR "C4/Acquisition.pm 5\n"; >+ return ("CAST($round_string*100 AS INTEGER)/100"); } >+ else { >+ print STDERR "C4/Acquisition.pm 6\n"; >+ return ("$round_string"); } > } > > =head3 get_rounded_price >@@ -2028,8 +2036,12 @@ returns a price rounded as specified in OrderPriceRounding system preference. > sub get_rounded_price { > my ( $price ) = @_; > my $rounding_pref = C4::Context->preference('OrderPriceRounding'); >- if( $rounding_pref eq 'nearest_cent' ) { return Koha::Number::Price->new( $price )->format(); } >- else { return $price; } >+ if( $rounding_pref eq 'nearest_cent' ) { >+ print STDERR "C4/Acquisition.pm 7\n"; >+ return Koha::Number::Price->new( $price )->format(); } >+ else { >+ print STDERR "C4/Acquisition.pm 8\n"; >+ return $price; } > } > > >@@ -2189,6 +2201,7 @@ sub GetLateOrders { > (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * " . _get_rounding_sql("aqorders.rrp") . " AS subtotal, > DATEDIFF(CAST(now() AS date),closedate) AS latesince > "; >+ print STDERR "C4/Acquisition.pm 9\n"; > if ( defined $delay ) { > $from .= " AND (closedate <= DATE_SUB(CAST(now() AS date),INTERVAL ? DAY)) " ; > push @query_params, $delay; >@@ -2201,6 +2214,7 @@ sub GetLateOrders { > aqorders.quantity * "._get_rounding_sql("aqorders.rrp")." AS subtotal, > (CAST(now() AS date) - closedate) AS latesince > "; >+ print STDERR "C4/Acquisition.pm 10\n"; > if ( defined $delay ) { > $from .= " AND (closedate <= (CAST(now() AS date) -(INTERVAL ? DAY)) "; > push @query_params, $delay; >@@ -3034,6 +3048,7 @@ sub populate_order_with_prices { > # tax value = quantity * ecost tax excluded * tax rate > $order->{tax_value_on_ordering} = > $order->{quantity} * get_rounded_price($order->{ecost_tax_excluded}) * $order->{tax_rate_on_ordering}; >+ print STDERR "C4/Acquisition.pm 11\n"; > } > > if ($receiving) { >@@ -3068,6 +3083,7 @@ sub populate_order_with_prices { > > # tax value = quantity * unit price tax excluded * tax rate > $order->{tax_value_on_receiving} = $order->{quantity} * get_rounded_price($order->{unitprice_tax_excluded}) * $order->{tax_rate_on_receiving}; >+ print STDERR "C4/Acquisition.pm 12\n"; > } > > return $order; >-- >2.1.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 18736
:
64061
|
64065
|
70187
|
70188
|
70189
|
70768
|
71062
|
71063
|
71627
|
71628
|
71629
|
71630
|
71631
|
71632
|
74335
|
74336
|
74337
|
74338
|
74339
|
74340
|
74341
|
74342
|
74370
|
74371
|
74374
|
74397
|
74398
|
74422
|
74427
|
74438
|
76979
|
76980
|
76981
|
76982
|
76983
|
76984
|
76985
|
76986
|
76987
|
76988
|
76989
|
76990
|
76991
|
77614
|
77615
|
77616
|
77617
|
77618
|
78101
|
78120
|
78981
|
78982
|
78983
|
78984
|
78985
|
78986
|
78987
|
78988
|
79087
|
79088
|
79089
|
79090
|
79091
|
79092
|
79093
|
79094
|
79098
|
79099
|
79100
|
79101
|
79102
|
79103
|
79104
|
79105
|
79187
|
79223
|
79562
|
79563
|
82967
|
82968
|
82969
|
82970
|
82971
|
82972
|
82973
|
82974
|
82975
|
82976
|
82977
|
83212
|
83213
|
83214
|
83973
|
83974
|
83975
|
83976
|
83977
|
83978
|
83979
|
83980
|
83981
|
83982
|
83983
|
83984
|
83985
|
86646
|
86647
|
86648
|
86649
|
86650
|
86651
|
86652
|
86653
|
86654
|
86655
|
86656
|
86657
|
86658