[Koha-patches] [PATCH 29/92] bugfix Move Item From Biblio - biblioitemnumber isn't the same as biblionumber
Henri-Damien LAURENT
henridamien.laurent at biblibre.com
Tue Dec 22 01:20:22 CET 2009
From: Michael Hafen <mdhafen at tech.washk12.org>
In the database and code biblioitemnumber is not guaranteed to be the same as
biblionumber.
---
C4/Items.pm | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/C4/Items.pm b/C4/Items.pm
index d2eee36..ccf8b05 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -2032,8 +2032,11 @@ Returns undef if the move failed or the biblionumber of the destination record o
sub MoveItemFromBiblio {
my ($itemnumber, $frombiblio, $tobiblio) = @_;
my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
- my $return = $sth->execute($tobiblio, $tobiblio, $itemnumber, $frombiblio);
+ my $sth = $dbh->prepare("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = ?");
+ $sth->execute( $tobiblio );
+ my ( $tobiblioitem ) = $sth->fetchrow();
+ $sth = $dbh->prepare("UPDATE items SET biblioitemnumber = ?, biblionumber = ? WHERE itemnumber = ? AND biblionumber = ?");
+ my $return = $sth->execute($tobiblioitem, $tobiblio, $itemnumber, $frombiblio);
if ($return == 1) {
# Getting framework
--
1.6.3.3
More information about the Koha-patches
mailing list