From 2292d21387c73770aa76d4ea9e1065aed5f6892f Mon Sep 17 00:00:00 2001 From: hdl Date: Mon, 16 Jul 2007 15:45:28 +0000 Subject: [PATCH] Adding Summary for UNIMARC authorities --- C4/AuthoritiesMarc.pm | 102 +++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 31 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index afee55c29d..dba3ca7716 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -753,6 +753,20 @@ sub BuildSummary{ my $dbh=C4::Context->dbh; my $authref = GetAuthType($authtypecode); my $summary = $authref->{summary}; + my %language; + $language{'fre'}="Français"; + $language{'eng'}="Anglais"; + $language{'ger'}="Allemand"; + $language{'ita'}="Italien"; + $language{'spa'}="Espagnol"; + my %thesaurus; + $thesaurus{'1'}="Peuples"; + $thesaurus{'2'}="Anthroponymes"; + $thesaurus{'3'}="Oeuvres"; + $thesaurus{'4'}="Chronologie"; + $thesaurus{'5'}="Lieux"; + $thesaurus{'6'}="Sujets"; + #thesaurus a remplir my @fields = $record->fields(); my $reported_tag; # if the library has a summary defined, use it. Otherwise, build a standard one @@ -779,35 +793,58 @@ sub BuildSummary{ } $summary =~ s/\[(.*?)]//g; $summary =~ s/\n/
/g; - } else { - my $heading; # = $authref->{summary}; - my $altheading; - my $seeheading; - my $see; - my @fields = $record->fields(); - if (C4::Context->preference('marcflavour') eq 'UNIMARC') { - # construct UNIMARC summary, that is quite different from MARC21 one - # accepted form - foreach my $field ($record->field('2..')) { - $heading.= $field->as_string(); - } - # rejected form(s) - foreach my $field ($record->field('4..')) { - $summary.= "   ".$field->as_string()."
"; - $summary.= "      see: ".$heading."
"; - } - # see : - foreach my $field ($record->field('5..')) { - $summary.= "   ".$field->as_string()."
"; - $summary.= "      see: ".$heading."
"; - } - # // form - foreach my $field ($record->field('7..')) { - $seeheading.= "      see also: ".$field->as_string()."
"; - $altheading.= "   ".$field->as_string()."
"; - $altheading.= "      see also: ".$heading."
"; - } - $summary = "".$heading."
".$seeheading.$altheading.$summary; + } else { + my $heading; + my $authid; + my $altheading; + my $seealso; + my $broaderterms; + my $narrowerterms; + my $see; + my $seeheading; + my $notes; + my @fields = $record->fields(); + if (C4::Context->preference('marcflavour') eq 'UNIMARC') { + # construct UNIMARC summary, that is quite different from MARC21 one + # accepted form + foreach my $field ($record->field('2..')) { + $heading.= $field->subfield('a'); + $authid=$field->subfield('3'); + } + # rejected form(s) + foreach my $field ($record->field('3..')) { + $notes.= ''.$field->subfield('a')."\n"; + } + foreach my $field ($record->field('4..')) { + my $thesaurus = "thes. : ".$thesaurus{"$field->subfield('2')"}." : " if ($field->subfield('2')); + $see.= ''.$thesaurus.$field->subfield('a')." -- \n"; + } + # see : + foreach my $field ($record->field('5..')) { + + if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { + $broaderterms.= ' '.$field->subfield('a')." -- \n"; + } elsif (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'h')){ + $narrowerterms.= ''.$field->subfield('a')." -- \n"; + } elsif ($field->subfield('a')) { + $seealso.= ''.$field->subfield('a')." -- \n"; + } + } + # // form + foreach my $field ($record->field('7..')) { + my $lang = substr($field->subfield('8'),3,3); + $seeheading.= ' En '.$language{$lang}.' : '.$field->subfield('a')."
\n"; + } + $broaderterms =~s/-- \n$//; + $narrowerterms =~s/-- \n$//; + $seealso =~s/-- \n$//; + $see =~s/-- \n$//; + $summary = "".$heading."
".($notes?"$notes
":""); + $summary.= '

TG : '.$broaderterms.'

' if ($broaderterms); + $summary.= '

TS : '.$narrowerterms.'

' if ($narrowerterms); + $summary.= '

TA : '.$seealso.'

' if ($seealso); + $summary.= '

EP : '.$see.'

' if ($see); + $summary.= '

'.$seeheading.'

' if ($seeheading); } else { # construct MARC21 summary foreach my $field ($record->field('1..')) { @@ -854,8 +891,8 @@ sub BuildSummary{ } $summary.=$heading.$seeheading.$altheading; } - } -return $summary; + } + return $summary; } =head2 BuildUnimarcHierarchies @@ -1155,6 +1192,9 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ +# Revision 1.49 2007/07/16 15:45:28 hdl +# Adding Summary for UNIMARC authorities +# # Revision 1.48 2007/06/25 15:01:45 tipaul # bugfixes on unimarc 100 handling (the field used for encoding) # -- 2.39.5