[Koha-cvs] koha C4/Search.pm catalogue/detail.pl [rel_3_0]

paul poulain paul at koha-fr.org
Thu Nov 2 16:31:23 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	paul poulain <tipaul>	06/11/02 15:31:23

Modified files:
	C4             : Search.pm 
	catalogue      : detail.pl 

Log message:
	fix for MARCnotes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.120.2.19&r2=1.120.2.20
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/detail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.3&r2=1.6.2.4

Patches:
Index: C4/Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.120.2.19
retrieving revision 1.120.2.20
diff -u -b -r1.120.2.19 -r1.120.2.20
--- C4/Search.pm	31 Oct 2006 17:26:23 -0000	1.120.2.19
+++ C4/Search.pm	2 Nov 2006 15:31:23 -0000	1.120.2.20
@@ -39,7 +39,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.120.2.19 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.120.2.20 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -2390,26 +2390,21 @@
 } # sub getborrowercategoryinfo
 
 sub getMARCnotes {
-        my ($dbh, $bibid, $marcflavour) = @_;
-    my ($mintag, $maxtag);
+        my ($dbh, $biblionumber, $marcflavour) = @_;
+    my $scope;
     if ($marcflavour eq "MARC21") {
-            $mintag = "500";
-        $maxtag = "599";
+        $scope='5..';
     } else {           # assume unimarc if not marc21
-        $mintag = "300";
-        $maxtag = "399";
+        $scope='3..';
     }
 
-
-
-    my $record=MARCgetbiblio($dbh,$bibid);
-
+    my $record=MARCgetbiblio($dbh,$biblionumber);
     my @marcnotes;
     my $note = "";
     my $tag = "";
     my $marcnote;
 
-    foreach my $field ($record->field('5..')) {
+    foreach my $field ($record->field($scope)) {
         my $value = $field->as_string();
         if ( $note ne "") {
             $marcnote = {marcnote => $note,};
@@ -2449,7 +2444,8 @@
     my $subfield = "";
     my $marcsubjct;
 
-    foreach my $field ($record->field('6..')) {
+    foreach my $field ($record->fields) {
+        next unless $field->tag() >=$mintag && $field->tag() <=$maxtag;
         my @subfields_loop;
         #my $value = $field->subfield('a');
         #$marcsubjct = {MARCSUBJCT => $value,};

Index: catalogue/detail.pl
===================================================================
RCS file: /sources/koha/koha/catalogue/detail.pl,v
retrieving revision 1.6.2.3
retrieving revision 1.6.2.4
diff -u -b -r1.6.2.3 -r1.6.2.4
--- catalogue/detail.pl	30 Oct 2006 09:53:38 -0000	1.6.2.3
+++ catalogue/detail.pl	2 Nov 2006 15:31:23 -0000	1.6.2.4
@@ -15,7 +15,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: detail.pl,v 1.6.2.3 2006/10/30 09:53:38 tipaul Exp $
+# $Id: detail.pl,v 1.6.2.4 2006/11/02 15:31:23 tipaul Exp $
 
 use strict;
 require Exporter;
@@ -65,8 +65,7 @@
 $template->param(norequests => $norequests);
 
   ## get notes and subjects from MARC record
-my $marc = C4::Context->preference("marc");
-if ($marc eq "yes") {
+if (C4::Context->preference("marc")) {
 	my $dbh = C4::Context->dbh;
 	my $marcflavour = C4::Context->preference("marcflavour");
 	my $marcnotesarray = &getMARCnotes($dbh,$biblionumber,$marcflavour);





More information about the Koha-cvs mailing list