[Koha-cvs] koha/cataloguing additem.pl [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Wed Feb 28 10:44:13 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	07/02/28 09:44:13

Modified files:
	cataloguing    : additem.pl 

Log message:
	reporting bug fix from 2.2.7.1 to rel_3_0
	LOG was :
		BUGFIX (minor) : when itemcallnumber systempref is set, after adding/modifying an item, the default automatic itemcallnumber was not calculated, due to multiple use of $temp variable.
		Quick & dirty fix, should probably be better to rewrite this code...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/cataloguing/additem.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.7.2.14&r2=1.7.2.15

Patches:
Index: additem.pl
===================================================================
RCS file: /sources/koha/koha/cataloguing/additem.pl,v
retrieving revision 1.7.2.14
retrieving revision 1.7.2.15
diff -u -b -r1.7.2.14 -r1.7.2.15
--- additem.pl	9 Feb 2007 09:12:08 -0000	1.7.2.14
+++ additem.pl	28 Feb 2007 09:44:13 -0000	1.7.2.15
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: additem.pl,v 1.7.2.14 2007/02/09 09:12:08 tipaul Exp $
+# $Id: additem.pl,v 1.7.2.15 2007/02/28 09:44:13 toins Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -52,7 +52,7 @@
     my $result;
     my $rq=$dbh->prepare("SELECT itemnumber from items where items.barcode=?");
     $rq->execute($barcode);
-    my ($result)=$rq->fetchrow;
+    ($result)=$rq->fetchrow;
     return($result);
 }
 
@@ -263,9 +263,12 @@
         if (!$value && $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) {
             my $CNtag = substr(C4::Context->preference('itemcallnumber'),0,3);
             my $CNsubfield = substr(C4::Context->preference('itemcallnumber'),3,1);
-            my $temp = $record->field($CNtag);
-            if ($temp) {
-                $value = $temp->subfield($CNsubfield);
+			my $CNsubfield2 = substr(C4::Context->preference('itemcallnumber'),4,1);
+			my $temp2 = $temp->field($CNtag);
+			if ($temp2) {
+				$value = ($temp2->subfield($CNsubfield)).' '.($temp2->subfield($CNsubfield2));
+#remove any trailing space incase one subfield is used
+			$value=~s/^\s+|\s+$//g;
             }
         }
         if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {





More information about the Koha-cvs mailing list