diff --git a/acqui.simple/additem.pl b/acqui.simple/additem.pl index 0db2f68656..2426e2f18d 100755 --- a/acqui.simple/additem.pl +++ b/acqui.simple/additem.pl @@ -119,9 +119,17 @@ if ($op eq "additem") { #------------------------------------------------------------------------------------------------------------------------------ } elsif ($op eq "delitem") { #------------------------------------------------------------------------------------------------------------------------------ -# retrieve item if exist => then, it's a modif - &NEWdelitem($dbh,$bibid,$itemnum); - $nextop="additem"; + # check that there is no issue on this item before deletion. + my $sth=$dbh->prepare("select * from issues i where i.returndate is null and i.itemnumber=?"); + $sth->execute($itemnum); + my $onloan=$sth->fetchrow; + push @errors,"book_on_loan" if ($onloan); ##error book_on_loan added to template as well + if ($onloan){ + $nextop = "additem"; + }else{ + &NEWdelitem($dbh,$bibid,$itemnum); + $nextop="additem"; + } #------------------------------------------------------------------------------------------------------------------------------ } elsif ($op eq "saveitem") { #------------------------------------------------------------------------------------------------------------------------------ @@ -212,6 +220,7 @@ for (my $i=0;$i<=$#big_array; $i++) { $items_data .="