From 4847a4f1b21066218d9cd9f620359e0249d12de9 Mon Sep 17 00:00:00 2001 From: Mark Tompsett 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