Bug 7329: Items onloan are deleted when undoing import into catalog

this patch checks the "on loan" and "reserved" status before deleting item, and
do noting in this case, so the record can't be deleted due to existing item.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit 0b39f30a69)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Christophe Croullebois 2011-12-07 11:54:29 +01:00 committed by Jared Camins-Esakov
parent 6c9b1f8bd8
commit 8251bdd673
1 changed files with 12 additions and 7 deletions

View File

@ -644,13 +644,18 @@ sub BatchRevertItems {
$sth->bind_param(1, $import_record_id);
$sth->execute();
while (my $row = $sth->fetchrow_hashref()) {
DelItem($dbh, $biblionumber, $row->{'itemnumber'});
my $updsth = $dbh->prepare("UPDATE import_items SET status = ? WHERE import_items_id = ?");
$updsth->bind_param(1, 'reverted');
$updsth->bind_param(2, $row->{'import_items_id'});
$updsth->execute();
$updsth->finish();
$num_items_deleted++;
my $error = DelItemCheck($dbh, $biblionumber, $row->{'itemnumber'});
if ($error == 1){
my $updsth = $dbh->prepare("UPDATE import_items SET status = ? WHERE import_items_id = ?");
$updsth->bind_param(1, 'reverted');
$updsth->bind_param(2, $row->{'import_items_id'});
$updsth->execute();
$updsth->finish();
$num_items_deleted++;
}
else {
next;
}
}
$sth->finish();
return $num_items_deleted;