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

paul poulain paul at koha-fr.org
Tue Jul 25 14:30:51 CEST 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	paul poulain <tipaul>	06/07/25 12:30:51

Modified files:
	C4             : AuthoritiesMarc.pm 

Log message:
	adding some informations to the array that is passed as result to an authority search : mainly, the tag_to_report & the $3 information (unimarc specific)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.9.2.17&r2=1.9.2.18

Patches:
Index: AuthoritiesMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.9.2.17
retrieving revision 1.9.2.18
diff -u -b -r1.9.2.17 -r1.9.2.18
--- AuthoritiesMarc.pm	10 Apr 2006 20:06:15 -0000	1.9.2.17
+++ AuthoritiesMarc.pm	25 Jul 2006 12:30:51 -0000	1.9.2.18
@@ -151,6 +151,10 @@
 		my $authref = getauthtype($authtypecode);
 		my $authtype =$authref->{authtypetext};
 		my $summary = $authref->{summary};
+        my $query_auth_tag = "SELECT auth_tag_to_report FROM auth_types WHERE authtypecode=?";
+        my $sth = $dbh->prepare($query_auth_tag);
+        $sth->execute($authtypecode);
+        my $auth_tag_to_report = $sth->fetchrow;
 		# find biblio MARC field using this authtypecode (to jump to biblio)
 		my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?");
 		$sth->execute($authtypecode);
@@ -160,14 +164,20 @@
 			$tags_using_authtype.= $tagfield."9,";
 		}
 		chop $tags_using_authtype;
+		my $reported_tag;
 		# if the library has a summary defined, use it. Otherwise, build a standard one
 		if ($summary) {
 			my @fields = $record->fields();
+            $reported_tag = '$9'.$result[$counter];
 			foreach my $field (@fields) {
 				my $tag = $field->tag();
 				my $tagvalue = $field->as_string();
 				$summary =~ s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g;
 				if ($tag<10) {
+                    if ($tag eq '001') {
+                        $reported_tag.='$3'.$field->data();
+                    }
+
 				} else {
 					my @subf = $field->subfields;
 					for my $i (0..$#subf) {
@@ -175,6 +185,10 @@
 						my $subfieldvalue = $subf[$i][1];
 						my $tagsubf = $tag.$subfieldcode;
 						$summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
+                        if ($tag eq $auth_tag_to_report) {
+                            $reported_tag.='$'.$subfieldcode.$subfieldvalue;
+                        }
+
 					}
 				}
 			}
@@ -256,6 +270,7 @@
 		my %newline;
 		$newline{summary} = $summary;
 		$newline{authtype} = $authtype;
+		$newline{reported_tag} = $reported_tag;
 		$newline{authid} = $result[$counter];
 		$newline{used} = &AUTHcount_usage($result[$counter]);
 		$newline{biblio_fields} = $tags_using_authtype;
@@ -1077,8 +1092,11 @@
 
 =cut
 
-# $Id: AuthoritiesMarc.pm,v 1.9.2.17 2006/04/10 20:06:15 kados Exp $
+# $Id: AuthoritiesMarc.pm,v 1.9.2.18 2006/07/25 12:30:51 tipaul Exp $
 # $Log: AuthoritiesMarc.pm,v $
+# Revision 1.9.2.18  2006/07/25 12:30:51  tipaul
+# adding some informations to the array that is passed as result to an authority search : mainly, the tag_to_report & the $3 information (unimarc specific)
+#
 # Revision 1.9.2.17  2006/04/10 20:06:15  kados
 # Adding support for bulkauthimport of records where authid already exists.
 # This commit should be tested with other uses of AUTHaddauthority to ensure





More information about the Koha-cvs mailing list