koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Biblio.pm [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha/C4 Biblio.pm [rel_3_0]
Date: Tue, 09 Jan 2007 10:31:10 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        07/01/09 10:31:10

Modified files:
        C4             : Biblio.pm 

Log message:
        sync with dev_week. ( new function : GetMarcSeries )

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.178.2.44&r2=1.178.2.45

Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.178.2.44
retrieving revision 1.178.2.45
diff -u -b -r1.178.2.44 -r1.178.2.45
--- Biblio.pm   4 Jan 2007 17:41:32 -0000       1.178.2.44
+++ Biblio.pm   9 Jan 2007 10:31:09 -0000       1.178.2.45
@@ -31,7 +31,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.178.2.44 $' =~ /\d+/g; 
shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.178.2.45 $' =~ /\d+/g; 
shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 @ISA = qw( Exporter );
 
@@ -96,6 +96,7 @@
   &GetMarcSubjects
   &GetMarcBiblio
   &GetMarcAuthors
+  &GetMarcSeries
 );
 
 # Others functions
@@ -1605,6 +1606,69 @@
     return address@hidden;
 }
 
+=head2 GetMarcSeries
+
+$marcseriessarray = GetMarcSeries($record,$marcflavour);
+
+=cut
+
+sub GetMarcSeries {
+    my ($record, $marcflavour) = @_;
+    my ($mintag, $maxtag);
+    if ($marcflavour eq "MARC21") {
+        $mintag = "440";
+        $maxtag = "490";
+    } else {           # assume unimarc if not marc21
+        $mintag = "600";
+        $maxtag = "619";
+    }
+
+    my @marcseries;
+    my $subjct = "";
+    my $subfield = "";
+    my $marcsubjct;
+
+    foreach my $field ($record->field('440'), $record->field('490')) {
+        my @subfields_loop;
+        #my $value = $field->subfield('a');
+        #$marcsubjct = {MARCSUBJCT => $value,};
+        my @subfields = $field->subfields();
+        #warn "subfields:".join " ", @$subfields;
+        my $counter = 0;
+        my @link_loop;
+        for my $series_subfield (@subfields) {
+                       my $volume_number;
+                       undef $volume_number;
+                       # see if this is an instance of a volume
+                       if ($series_subfield->[0] eq 'v') {
+                               $volume_number=1;
+                       }
+
+            my $code = $series_subfield->[0];
+            my $value = $series_subfield->[1];
+            my $linkvalue = $value;
+            $linkvalue =~ s/(\(|\))//g;
+            my $operator = " and " unless $counter==0;
+            push @link_loop, {link => $linkvalue, operator => $operator };
+            my $separator = C4::Context->preference("authoritysep") unless 
$counter==0;
+                       if ($volume_number) {
+                       push @subfields_loop, {volumenum => $value};
+                       }
+                       else {
+            push @subfields_loop, {code => $code, value => $value, link_loop 
=> address@hidden, separator => $separator, volumenum => $volume_number};
+                       }
+            $counter++;
+        }
+        push @marcseries, { MARCSERIES_SUBFIELDS_LOOP => address@hidden };
+        #$marcsubjct = {MARCSUBJCT => $field->as_string(),};
+        #push @marcsubjcts, $marcsubjct;
+        #$subjct = $value;
+
+    }
+    my address@hidden;
+    return $marcseriessarray;
+}  #end getMARCseriess
+
 =head2 MARCmodbiblio
 
 MARCmodbibio($dbh,$biblionumber,$record,$frameworkcode,1);
@@ -3582,8 +3646,11 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.178.2.44 2007/01/04 17:41:32 tipaul Exp $
+# $Id: Biblio.pm,v 1.178.2.45 2007/01/09 10:31:09 toins Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.178.2.45  2007/01/09 10:31:09  toins
+# sync with dev_week. ( new function : GetMarcSeries )
+#
 # Revision 1.178.2.44  2007/01/04 17:41:32  tipaul
 # 2 major bugfixes :
 # - deletion of an item deleted the whole biblio because of a wrong API




reply via email to

[Prev in Thread] Current Thread [Next in Thread]