Bugzilla – Attachment 25020 Details for
Bug 11675
Budget amount is not checked if a parent exist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11675: Budget total is not checked if a parent exists
Bug-11675-Budget-total-is-not-checked-if-a-parent-.patch (text/plain), 2.00 KB, created by
Jonathan Druart
on 2014-02-04 11:37:28 UTC
(
hide
)
Description:
Bug 11675: Budget total is not checked if a parent exists
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-04 11:37:28 UTC
Size:
2.00 KB
patch
obsolete
>From d1093d6bddb31cd7339b1948451a31eab16f96aa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 4 Feb 2014 12:15:42 +0100 >Subject: [PATCH] Bug 11675: Budget total is not checked if a parent exists > >The sth is created before the query. >The query was modified after the sth creation and an error was raised. > >Test plan: >0/ Don't apply the patch >1/ Create a budget A (amount=1000) >2/ Create a fund A1 (amount=1000) >3/ Create a child fund A11 (amount=1000) >4/ Edit A11 and change the amount to 2000 >You are able to do it, an error appears in the Koha log: > "check_parent_total.pl: DBD::mysql::st execute failed: called with 2 bind > variables when 1 are needed" >5/ Apply the patch, edit A11 and save. You get an error >6/ Edit A11 and change the amount to <=1000 >7/ Verify that there is no regression on adding/removing/editing budgets >and funds. >--- > admin/check_parent_total.pl | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > >diff --git a/admin/check_parent_total.pl b/admin/check_parent_total.pl >index 653a9f2..83fecc2 100755 >--- a/admin/check_parent_total.pl >+++ b/admin/check_parent_total.pl >@@ -61,19 +61,12 @@ my ($sub_unalloc , $period_sum, $budget_period_unalloc); > > if ($parent) { > my $query = " SELECT SUM(budget_amount) as sum FROM aqbudgets where budget_parent_id = ? "; >- my $sth = $dbh->prepare($query); > my @sql_params; >- push @sql_params, $parent->{'budget_id'} ; >- if ($budget_id){ >- $query.=qq| and budget_id <> ? |; >- push @sql_params,$budget_id; >- } >- $sth->execute( @sql_params ); >+ my $sth = $dbh->prepare($query); >+ $sth->execute( $parent->{'budget_id'} ); > my $sum = $sth->fetchrow_hashref; > $sth->finish; >- > $sub_unalloc = $parent->{'budget_amount'} - $sum->{sum}; >- > # TRICKY.. , IF THE PARENT IS THE CURRENT PARENT - THEN SUBSTRACT CURRENT BUDGET FROM TOTAL > $sub_unalloc += $budget->{'budget_amount'} if ( $budget->{'budget_parent_id'} == $parent_id ) ; > } >-- >1.7.10.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 11675
:
25020
|
25279
|
26130