[Koha-patches] [PATCH] Bug 4438: incorrect "Budget total exceeds period allocation" error when editing fund

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Thu Jan 13 11:57:08 CET 2011


The process in check_parent_total for period allocation was not good.
It took all the children of a period.

Signed-off-by: Sophie Meynieux <sophie.meynieux at biblibre.com>
---
 admin/check_parent_total.pl |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/admin/check_parent_total.pl b/admin/check_parent_total.pl
index c5630e0..cb62f0d 100755
--- a/admin/check_parent_total.pl
+++ b/admin/check_parent_total.pl
@@ -25,7 +25,6 @@ use C4::Context;
 use C4::Output;
 use C4::Auth;
 use C4::Budgets;
-
 =head1
 
 This script checks the amount unallocated from the new parent budget , or the period - if no parent_id is given
@@ -76,7 +75,7 @@ if ($parent) {
 # ELSE , IF NO PARENT PASSED, THEN CHECK UNALLOCATED FOR PERIOD, IF NOT THEN RETURN 2
 else {
     my $query = qq| SELECT SUM(budget_amount) as sum
-                FROM aqbudgets WHERE budget_period_id = ?|;
+                FROM aqbudgets WHERE budget_period_id = ? and budget_parent_id IS NULL|;
 
     my $sth = $dbh->prepare($query);
     $sth->execute($period_id);
@@ -96,7 +95,6 @@ if ($parent_id) {
     $returncode = 0;
 }
 
-$template->param( return => $returncode );
 
-output_html_with_http_headers $input, $cookie, $template->output;
+output_html_with_http_headers $input, $cookie, $returncode;
 1;
-- 
1.7.0.4



More information about the Koha-patches mailing list