From 8e76a806bca23239a6e5341e21b5b3231f3abf50 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 31 Oct 2007 19:57:28 -0500 Subject: [PATCH] Working on fixing bug for acquisition bookfund modifying, work in progress Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Bookfund.pm | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/C4/Bookfund.pm b/C4/Bookfund.pm index 403a1f3c8c..50bd464fe7 100644 --- a/C4/Bookfund.pm +++ b/C4/Bookfund.pm @@ -322,26 +322,46 @@ on database. =cut sub ModBookFund { - my ($bookfundname,$bookfundid,$branchcode) = @_; + my ($bookfundname,$bookfundid,$current_branch, $branchcode) = @_; + my $dbh = C4::Context->dbh; +=c my $query = " UPDATE aqbookfund - SET bookfundname = ? + SET bookfundname = ?, + branchcode = ? WHERE bookfundid = ? AND branchcode= ? "; - warn "name : $bookfundname"; + warn "$bookfundname,$branchcode, $bookfundid,$current_branch"; + my $sth=$dbh->prepare($query); - $sth->execute($bookfundname,$bookfundid,"$branchcode"); + $sth->execute($bookfundname,"$branchcode", $bookfundid,"$current_branch"); +=cut + + my $retval = $dbh->do(' + UPDATE aqbookfund + SET bookfundname = $bookfundname, + branchcode = $branchcode + WHERE bookfundid = $bookfundid + AND branchcode= $current_branch + '); + + warn "$bookfundname,$branchcode, $bookfundid,$current_branch"; +### $retval + + + # budgets depending on a bookfund must have the same branchcode # if the bookfund branchcode is set if (defined $branchcode) { $query = " - UPDATE aqbudget - SET branchcode = ? + UPDATE aqbudget + SET branchcode = ? + WHERE bookfundid = ? "; $sth=$dbh->prepare($query); - $sth->execute($branchcode); + $sth->execute($branchcode, $bookfundid) ; } } @@ -445,7 +465,7 @@ sub Countbookfund { AND branchcode = ? "; my $sth = $dbh->prepare($query); - $sth->execute($bookfundid,$branchcode); + $sth->execute($bookfundid,"$branchcode"); return $sth->fetchrow; } -- 2.39.5