Bug 4438: incorrect "Budget total exceeds period allocation" error when editing fund
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 13 Jan 2011 14:04:19 +0000 (09:04 -0500)
committerChris Nighswonger <chris.nighswonger@gmail.com>
Thu, 13 Jan 2011 21:51:41 +0000 (16:51 -0500)
The process in check_parent_total for period allocation was not good.
It took all the children of a period.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit 9bf9e2d9b4408579667d904ec94d064dc0c8f882)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
admin/check_parent_total.pl

index f5d5000..d5b784d 100755 (executable)
@@ -75,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  ); 
@@ -95,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;