Bug 11803: use $dbh consistently in _koha_modify_item
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 20 Feb 2014 18:39:10 +0000 (19:39 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 25 Feb 2014 14:55:32 +0000 (14:55 +0000)
This is just some code cleanup, no behavior change expected.
Also replacing errstr with err in testing the results. (See DBI.)

Test plan:
Modify an item and save it.

Followed test plan. No problems found.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Items.pm

index 5680db7..12dce85 100644 (file)
@@ -2316,10 +2316,10 @@ sub _koha_modify_item {
     $query =~ s/,$//;
     $query .= " WHERE itemnumber=?";
     push @bind, $item->{'itemnumber'};
-    my $sth = C4::Context->dbh->prepare($query);
+    my $sth = $dbh->prepare($query);
     $sth->execute(@bind);
-    if ( C4::Context->dbh->errstr ) {
-        $error.="ERROR in _koha_modify_item $query".$dbh->errstr;
+    if ( $sth->err ) {
+        $error.="ERROR in _koha_modify_item $query: ".$sth->errstr;
         warn $error;
     }
     return ($item->{'itemnumber'},$error);