From e02347ec2312f886335c59054a45eb3a4faa60e7 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sun, 30 Dec 2007 16:42:40 -0600 Subject: [PATCH] Fix for bug 1319, can no longer delete an item with a waiting reserve on it Signed-off-by: Joshua Ferraro --- cataloguing/additem.pl | 18 ++++++++++++++---- .../prog/en/modules/cataloguing/additem.tmpl | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index a82b621b42..88b9f4952c 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -135,13 +135,23 @@ if ($op eq "additem") { my $sth=$dbh->prepare("select * from issues i where i.returndate is null and i.itemnumber=?"); $sth->execute($itemnumber); my $onloan=$sth->fetchrow; + $sth->finish(); push @errors,"book_on_loan" if ($onloan); ##error book_on_loan added to template as well if ($onloan){ - $nextop="additem"; + $nextop="additem"; } else { - &DelItem($dbh,$biblionumber,$itemnumber); - print $input->redirect("additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode"); - #$nextop="additem"; + # check it doesnt have a waiting reserve + $sth=$dbh->prepare("SELECT * FROM reserves WHERE found = 'w' AND cancellationdate IS NULL AND itemnumber = ?"); + $sth->execute($itemnumber); + my $reserve=$sth->fetchrow; + if ($reserve){ + push @errors,"book_reserved"; + $nextop="additem"; + } + else { + &DelItem($dbh,$biblionumber,$itemnumber); + print $input->redirect("additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode"); + } } #------------------------------------------------------------------------------- } elsif ($op eq "saveitem") { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl index 786429c7d9..c436308d64 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tmpl @@ -159,6 +159,7 @@ function CreateKey(){
Error saving item: Barcode must be unique.
Cannot Delete: item is checked out.
+
Cannot Delete: item has a waiting hold.
-- 2.39.5