Bugzilla – Attachment 74397 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] Print scaffolding for C4/Budgets.pm
Bug-18736-DO-NOT-PUSH-Print-scaffolding-for-C4Budg.patch (text/plain), 3.68 KB, created by
Mark Tompsett
on 2018-04-17 23:39:40 UTC
(
hide
)
Description:
Bug 18736: [DO NOT PUSH] Print scaffolding for C4/Budgets.pm
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-04-17 23:39:40 UTC
Size:
3.68 KB
patch
obsolete
>From 4847a4f1b21066218d9cd9f620359e0249d12de9 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Tue, 17 Apr 2018 23:38:10 +0000 >Subject: [PATCH] Bug 18736: [DO NOT PUSH] Print scaffolding for C4/Budgets.pm > >The ELSE case is a pain. Please get it to return something >rather than undef. >--- > C4/Budgets.pm | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 07aa522..d7c4c19 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -210,6 +210,7 @@ sub GetBudgetsPlanCell { > my ($actual, $sth); > my $dbh = C4::Context->dbh; > my $roundsql = _get_rounding_sql(qq|ecost_tax_included|); >+ print STDERR "C4/Budgets.pm 1\n"; > if ( $cell->{'authcat'} eq 'MONTHS' ) { > # get the actual amount > # FIXME we should consider quantity >@@ -219,6 +220,7 @@ sub GetBudgetsPlanCell { > WHERE budget_id = ? AND > entrydate like "$cell->{'authvalue'}%" | > ); >+ print STDERR "C4/Budgets.pm 2\n"; > $sth->execute( $cell->{'budget_id'} ); > } elsif ( $cell->{'authcat'} eq 'BRANCHES' ) { > # get the actual amount >@@ -231,6 +233,7 @@ sub GetBudgetsPlanCell { > LEFT JOIN items > ON (aqorders_items.itemnumber = items.itemnumber) > WHERE budget_id = ? AND homebranch = ? | ); >+ print STDERR "C4/Budgets.pm 3\n"; > > $sth->execute( $cell->{'budget_id'}, $cell->{'authvalue'} ); > } elsif ( $cell->{'authcat'} eq 'ITEMTYPES' ) { >@@ -242,6 +245,7 @@ sub GetBudgetsPlanCell { > ON (biblioitems.biblionumber = aqorders.biblionumber ) > WHERE aqorders.budget_id = ? and itemtype = ? | > ); >+ print STDERR "C4/Budgets.pm 4\n"; > $sth->execute( $cell->{'budget_id'}, > $cell->{'authvalue'} ); > } >@@ -257,12 +261,14 @@ sub GetBudgetsPlanCell { > ((aqbudgets.sort1_authcat = ? AND sort1 =?) OR > (aqbudgets.sort2_authcat = ? AND sort2 =?)) | > ); >+ print STDERR "C4/Budgets.pm 5\n"; > $sth->execute( $cell->{'budget_id'}, > $budget->{'sort1_authcat'}, > $cell->{'authvalue'}, > $budget->{'sort2_authcat'}, > $cell->{'authvalue'} > ); >+ print STDERR "USING ",$cell->{'budget_id'},"--",$budget->{'sort1_authcat'},"--",$cell->{'authvalue'},"--",$budget->{'sort2_authcat'},"--",$cell->{'authvalue'},"\n"; > } > $actual = $sth->fetchrow_array; > >@@ -339,6 +345,7 @@ sub GetBudgetSpent { > quantityreceived > 0 AND > datecancellationprinted IS NULL > |); >+ print STDERR "C4/Budgets.pm 6\n"; > $sth->execute($budget_id); > my $sum = $sth->fetchrow_array; > >@@ -365,6 +372,7 @@ sub GetBudgetOrdered { > quantityreceived = 0 AND > datecancellationprinted IS NULL > |); >+ print STDERR "C4/Budgets.pm 7\n"; > $sth->execute($budget_id); > my $sum = $sth->fetchrow_array; > >@@ -1294,8 +1302,12 @@ returns the correct SQL routine based on OrderPriceRounding system preference. > sub _get_rounding_sql { > my $to_round = shift; > my $rounding_pref = C4::Context->preference('OrderPriceRounding'); >- if ($rounding_pref eq 'nearest_cent') { return "CAST($to_round*100 AS INTEGER)/100"; } >- else { return "$to_round"; } >+ if ($rounding_pref eq 'nearest_cent') { >+ print STDERR "C4/Budgets.pm 8\n"; >+ return "CAST(($to_round*100) AS INTEGER)/100"; } >+ else { >+ print STDERR "C4/Budgets.pm 9\n"; >+ return "$to_round"; } > } > > END { } # module clean-up code here (global destructor) >-- >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