[Koha-cvs] koha acqui.simple/additem.pl koha-tmpl/intranet... [rel_2_2]

paul poulain paul at koha-fr.org
Mon Mar 20 16:16:09 CET 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	paul poulain <tipaul at savannah.gnu.org>	06/03/20 15:16:09

Modified files:
	acqui.simple   : additem.pl 
	koha-tmpl/intranet-tmpl/default/en/acqui.simple: additem.tmpl 

Log message:
	* check that an item is not on loan before deleting it (proposal from Tümer)
	* escape " to &amp;

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/acqui.simple/additem.pl.diff?only_with_tag=rel_2_2&tr1=1.27.2.16&tr2=1.27.2.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl.diff?only_with_tag=rel_2_2&tr1=1.20.2.6&tr2=1.20.2.7&r1=text&r2=text

Patches:
Index: koha/acqui.simple/additem.pl
diff -u koha/acqui.simple/additem.pl:1.27.2.16 koha/acqui.simple/additem.pl:1.27.2.17
--- koha/acqui.simple/additem.pl:1.27.2.16	Tue Mar  7 08:34:54 2006
+++ koha/acqui.simple/additem.pl	Mon Mar 20 15:16:08 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: additem.pl,v 1.27.2.16 2006/03/07 08:34:54 hdl Exp $
+# $Id: additem.pl,v 1.27.2.17 2006/03/20 15:16:08 tipaul Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -119,9 +119,17 @@
 #------------------------------------------------------------------------------------------------------------------------------
 } 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 @@
 		$items_data .="<td>".$big_array[$i]{$subfield_code}."</td>";
 	}
 	my %row_data;
+	$items_data =~ s/"/&quot;/g;
 	$row_data{item_value} = $items_data;
 	$row_data{itemnum} = $big_array[$i]->{itemnum};
 	#reporting this_row values
@@ -244,6 +253,7 @@
 		$subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable};
 		my ($x,$value);
 		($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord);
+		$value =~ s/"/&quot;/g;
 		#testing branch value if IndependantBranches.
 		my $test = (C4::Context->preference("IndependantBranches")) && 
 					($tag eq $branchtagfield) && ($subfield eq $branchtagsubfield) &&
Index: koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl
diff -u koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl:1.20.2.6 koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl:1.20.2.7
--- koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl:1.20.2.6	Fri Aug 26 12:21:50 2005
+++ koha/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl	Mon Mar 20 15:16:09 2006
@@ -66,6 +66,9 @@
 	<!-- TMPL_IF name="barcode_not_unique" -->
 		<div id="problem"><b>ERROR : Barcode already exists !<b></div>
 	<!-- /TMPL_IF -->
+	<!-- TMPL_IF name="book_on_loan" -->
+		<div id="problem"><b>ERROR : Item on loan : can't delete it !<b></div>
+	<!-- /TMPL_IF -->
 	<!-- TMPL_IF name="opisadd" -->
 	<input type="button" value="Add item" onClick="Check(this.form)" accesskey="w" class="button catalogue">
 	<!-- TMPL_ELSE -->





More information about the Koha-cvs mailing list