koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/C4 SearchMarc.pm [rel_2_2]


From: Ryan Higgins
Subject: [Koha-cvs] koha/C4 SearchMarc.pm [rel_2_2]
Date: Tue, 27 Feb 2007 17:24:39 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     Ryan Higgins <rych>     07/02/27 17:24:39

Modified files:
        C4             : SearchMarc.pm 

Log message:
        adding getMARCaddlAuthors sub | bugfix 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/SearchMarc.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.36.2.36&r2=1.36.2.37

Patches:
Index: SearchMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/SearchMarc.pm,v
retrieving revision 1.36.2.36
retrieving revision 1.36.2.37
diff -u -b -r1.36.2.36 -r1.36.2.37
--- SearchMarc.pm       29 Jan 2007 03:45:37 -0000      1.36.2.36
+++ SearchMarc.pm       27 Feb 2007 17:24:39 -0000      1.36.2.37
@@ -41,7 +41,7 @@
 =cut
 
 @ISA = qw(Exporter);
address@hidden = qw(&catalogsearch &findseealso &findsuggestion &getMARCnotes 
&getMARCsubjects);
address@hidden = qw(&catalogsearch &findseealso &findsuggestion &getMARCnotes 
&getMARCsubjects &getMARCaddlAuthors);
 
 =head1 findsuggestion($dbh,$values);
 
@@ -650,6 +650,34 @@
        return $marcnotesarray;
 }  # end getMARCnotes
 
+=item getMARCaddlAuthors($dbh,$bibid,$marcflavour)
+returns reference to array of hashrefs
+  with key 'author', suitable for passing
+  to HTML::Template.
+
+=cut
+
+sub getMARCaddlAuthors{
+        my ($dbh, $bibid, $marcflavour ) = @_;
+        my $subfield= 'a';  #We'll ignore other subfields.  
+        my $tagfieldstring ;
+        if ($marcflavour eq "MARC21") {
+                $tagfieldstring = "'700', '710','720'";
+        } else {           # assume unimarc if not marc21
+                $tagfieldstring = "'702', '712','722'";
+        }
+        my $sth=$dbh->prepare("SELECT subfieldvalue,tag FROM 
marc_subfield_table WHERE bibid=? AND tag IN ($tagfieldstring) AND 
subfieldcode=? ORDER BY tagorder");
+        my $numresults = $sth->execute($bibid,$subfield );
+        my @marcAddAuthors;
+        my $marcAddAuthor;
+
+        while (my $data=$sth->fetchrow_arrayref) {
+                push @marcAddAuthors, {author => $data->[0]};
+        }
+        $sth->finish;
+        return address@hidden;
+}  # end getMARCaddlAuthors
+
 
 sub getMARCsubjects {
     my ($dbh, $bibid, $marcflavour) = @_;




reply via email to

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