From 2b48399288c24be5cf99f476138252ea90e19813 Mon Sep 17 00:00:00 2001 From: acli Date: Sun, 7 Mar 2004 05:38:45 +0000 Subject: [PATCH] This should fix bug 734. Added a test for the "zero rows affected" condition when trying to update aqorderbreakdown. According to DBI(3), execute() returns the "number of rows affected", so we know whether the update has succeeded, or whether we need to redo the update as an insert. The error condition (return value -1) is still not being handled. But the old code did not check for errors either, so this would be reasonable for the time being. --- C4/Catalogue.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Catalogue.pm b/C4/Catalogue.pm index d17ada3901..87d4824661 100644 --- a/C4/Catalogue.pm +++ b/C4/Catalogue.pm @@ -270,7 +270,11 @@ sub modorder { $query="update aqorderbreakdown set bookfundid=? where ordernumber=?"; $sth=$dbh->prepare($query); - $sth->execute($bookfund,$ordnum); + if ($sth->execute($bookfund,$ordnum) == 0) { # zero rows affected [Bug 734] + $query="insert into aqorderbreakdown (ordernumber,bookfundid) values (?,?)"; + $sth=$dbh->prepare($query); + $sth->execute($ordnum,$bookfund); + } $sth->finish; } -- 2.39.5