From ebf980a10b3ffd2f17d351bedef85cad80ec6c20 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 20 Mar 2006 15:16:08 +0000 Subject: [PATCH] =?UTF-8?q?*=20check=20that=20an=20item=20is=20not=20on=20?= =?UTF-8?q?loan=20before=20deleting=20it=20(proposal=20from=20T=FCmer)=20*?= =?UTF-8?q?=20escape=20"=20to=20&?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- acqui.simple/additem.pl | 16 +++++++++++++--- .../default/en/acqui.simple/additem.tmpl | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) 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 .="".$big_array[$i]{$subfield_code}.""; } my %row_data; + $items_data =~ s/"/"/g; $row_data{item_value} = $items_data; $row_data{itemnum} = $big_array[$i]->{itemnum}; #reporting this_row values @@ -244,6 +253,7 @@ foreach my $tag (sort keys %{$tagslib}) { $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; my ($x,$value); ($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord); + $value =~ s/"/"/g; #testing branch value if IndependantBranches. my $test = (C4::Context->preference("IndependantBranches")) && ($tag eq $branchtagfield) && ($subfield eq $branchtagsubfield) && diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl index 37a375b70d..8ad4730261 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl @@ -66,6 +66,9 @@
ERROR : Barcode already exists !
+ +
ERROR : Item on loan : can't delete it !
+