bugfix Move Item From Biblio - biblioitemnumber isn't the same as biblionumber

In the database and code biblioitemnumber is not guaranteed to be the same as
biblionumber.
This commit is contained in:
Michael Hafen 2009-12-04 15:37:26 -07:00 committed by Henri-Damien LAURENT
parent 77141dab35
commit 929d281e93
1 changed files with 5 additions and 2 deletions

View File

@ -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