Bugzilla – Attachment 11269 Details for
Bug 8357
UNIMARCslim2OPACDetail.xsl, title without class and too links to views
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8204: fix UNIMARC display
Bug-8204-fix-UNIMARC-display.patch (text/plain), 13.71 KB, created by
Paul Poulain
on 2012-08-01 15:33:27 UTC
(
hide
)
Description:
Bug 8204: fix UNIMARC display
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2012-08-01 15:33:27 UTC
Size:
13.71 KB
patch
obsolete
>From f98bdca404de78685f6b0351d1a582e75287654a Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Thu, 26 Jul 2012 11:49:36 -0400 >Subject: [PATCH] Bug 8204: fix UNIMARC display > >UNIMARC display of authorities in the OPAC wasn't working due to >changes in the BuildSummary function since the code was originally >developed. > >Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> >Signed-off-by: Zeno Tajoli <tajoli@cilea.it> > >http://bugs.koha-community.org/show_bug.cgi?id=8357 >Signed-off-by: Zeno Tajoli <tajoli@cilea.it> >--- > C4/AuthoritiesMarc.pm | 229 ++++++++++++++++++++++++------------------------- > 1 files changed, 114 insertions(+), 115 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index d8f42ee..90c253a 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1008,140 +1008,139 @@ sub BuildSummary { > $resultstring =~ s/\[(.*?)\]//g; > $resultstring =~ s/\n/<br>/g; > $summary{summary} = $resultstring; >- } else { >- my @authorized; >- my @notes; >- my @seefrom; >- my @seealso; >- my @otherscript; >- my @fields = $record->fields(); >- if (C4::Context->preference('marcflavour') eq 'UNIMARC') { >+ } >+ my @authorized; >+ my @notes; >+ my @seefrom; >+ my @seealso; >+ my @otherscript; >+ 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..')) { >- push @authorized, { heading => $field->as_string('abcdefghijlmnopqrstuvwxyz'), field => $field->tag() }; >- } >+ foreach my $field ($record->field('2..')) { >+ push @authorized, { heading => $field->as_string('abcdefghijlmnopqrstuvwxyz'), field => $field->tag() }; >+ } > # rejected form(s) >- foreach my $field ($record->field('3..')) { >- push @notes, { note => $field->subfield('a'), field => $field->tag() }; >- } >- foreach my $field ($record->field('4..')) { >- my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : ''; >- push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom', field => $field->tag() }; >- } >+ foreach my $field ($record->field('3..')) { >+ push @notes, { note => $field->subfield('a'), field => $field->tag() }; >+ } >+ foreach my $field ($record->field('4..')) { >+ my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : ''; >+ push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom', field => $field->tag() }; >+ } > # see : >- foreach my $field ($record->field('5..')) { >- if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { >- push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader', field => $field->tag() }; >- } elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){ >- push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower', field => $field->tag() }; >- } elsif ($field->subfield('a')) { >- push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso', field => $field->tag() }; >- } >+ foreach my $field ($record->field('5..')) { >+ if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { >+ push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader', field => $field->tag() }; >+ } elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){ >+ push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower', field => $field->tag() }; >+ } elsif ($field->subfield('a')) { >+ push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso', field => $field->tag() }; > } >+ } > # // form >- foreach my $field ($record->field('7..')) { >- my $lang = substr($field->subfield('8'),3,3); >- push @otherscript, { lang => $lang, term => $field->subfield('a'), direction => 'ltr', field => $field->tag() }; >- } >- } else { >+ foreach my $field ($record->field('7..')) { >+ my $lang = substr($field->subfield('8'),3,3); >+ push @otherscript, { lang => $lang, term => $field->subfield('a'), direction => 'ltr', field => $field->tag() }; >+ } >+ } else { > # construct MARC21 summary > # FIXME - looping over 1XX is questionable > # since MARC21 authority should have only one 1XX >- my $subfields_to_report; >- foreach my $field ($record->field('1..')) { >- my $tag = $field->tag(); >- next if "152" eq $tag; >+ my $subfields_to_report; >+ foreach my $field ($record->field('1..')) { >+ my $tag = $field->tag(); >+ next if "152" eq $tag; > # FIXME - 152 is not a good tag to use > # in MARC21 -- purely local tags really ought to be > # 9XX >- if ($tag eq '100') { >- $subfields_to_report = 'abcdefghjklmnopqrstvxyz'; >- } elsif ($tag eq '110') { >- $subfields_to_report = 'abcdefghklmnoprstvxyz'; >- } elsif ($tag eq '111') { >- $subfields_to_report = 'acdefghklnpqstvxyz'; >- } elsif ($tag eq '130') { >- $subfields_to_report = 'adfghklmnoprstvxyz'; >- } elsif ($tag eq '148') { >- $subfields_to_report = 'abvxyz'; >- } elsif ($tag eq '150') { >- $subfields_to_report = 'abvxyz'; >- } elsif ($tag eq '151') { >- $subfields_to_report = 'avxyz'; >- } elsif ($tag eq '155') { >- $subfields_to_report = 'abvxyz'; >- } elsif ($tag eq '180') { >- $subfields_to_report = 'vxyz'; >- } elsif ($tag eq '181') { >- $subfields_to_report = 'vxyz'; >- } elsif ($tag eq '182') { >- $subfields_to_report = 'vxyz'; >- } elsif ($tag eq '185') { >- $subfields_to_report = 'vxyz'; >- } >- if ($subfields_to_report) { >- push @authorized, { heading => $field->as_string($subfields_to_report), field => $tag }; >- } else { >- push @authorized, { heading => $field->as_string(), field => $tag }; >- } >+ if ($tag eq '100') { >+ $subfields_to_report = 'abcdefghjklmnopqrstvxyz'; >+ } elsif ($tag eq '110') { >+ $subfields_to_report = 'abcdefghklmnoprstvxyz'; >+ } elsif ($tag eq '111') { >+ $subfields_to_report = 'acdefghklnpqstvxyz'; >+ } elsif ($tag eq '130') { >+ $subfields_to_report = 'adfghklmnoprstvxyz'; >+ } elsif ($tag eq '148') { >+ $subfields_to_report = 'abvxyz'; >+ } elsif ($tag eq '150') { >+ $subfields_to_report = 'abvxyz'; >+ } elsif ($tag eq '151') { >+ $subfields_to_report = 'avxyz'; >+ } elsif ($tag eq '155') { >+ $subfields_to_report = 'abvxyz'; >+ } elsif ($tag eq '180') { >+ $subfields_to_report = 'vxyz'; >+ } elsif ($tag eq '181') { >+ $subfields_to_report = 'vxyz'; >+ } elsif ($tag eq '182') { >+ $subfields_to_report = 'vxyz'; >+ } elsif ($tag eq '185') { >+ $subfields_to_report = 'vxyz'; > } >- foreach my $field ($record->field('4..')) { #See From >- my $type = 'seefrom'; >- $type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w')); >- if ($type eq 'notapplicable') { >- $type = substr $field->subfield('w'), 2, 1; >- $type = 'earlier' if $type && $type ne 'n'; >- } >- if ($type eq 'subfi') { >- push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() }; >- } else { >- push @seefrom, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() }; >- } >+ if ($subfields_to_report) { >+ push @authorized, { heading => $field->as_string($subfields_to_report), field => $tag }; >+ } else { >+ push @authorized, { heading => $field->as_string(), field => $tag }; > } >- foreach my $field ($record->field('5..')) { #See Also >- my $type = 'seealso'; >- $type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w')); >- if ($type eq 'notapplicable') { >- $type = substr $field->subfield('w'), 2, 1; >- $type = 'earlier' if $type && $type ne 'n'; >- } >- if ($type eq 'subfi') { >- push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() }; >- } else { >- push @seealso, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() }; >- } >+ } >+ foreach my $field ($record->field('4..')) { #See From >+ my $type = 'seefrom'; >+ $type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w')); >+ if ($type eq 'notapplicable') { >+ $type = substr $field->subfield('w'), 2, 1; >+ $type = 'earlier' if $type && $type ne 'n'; > } >- foreach my $field ($record->field('6..')) { >- push @notes, { note => $field->as_string(), field => $field->tag() }; >+ if ($type eq 'subfi') { >+ push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() }; >+ } else { >+ push @seefrom, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() }; > } >- foreach my $field ($record->field('880')) { >- my $linkage = $field->subfield('6'); >- my $category = substr $linkage, 0, 1; >- if ($category eq '1') { >- $category = 'preferred'; >- } elsif ($category eq '4') { >- $category = 'seefrom'; >- } elsif ($category eq '5') { >- $category = 'seealso'; >- } >- my $type; >- if ($field->subfield('w')) { >- $type = $marc21controlrefs{substr $field->subfield('w'), '0'}; >- } else { >- $type = $category; >- } >- my $direction = $linkage =~ m#/r$# ? 'rtl' : 'ltr'; >- push @otherscript, { term => $field->as_string($subfields_to_report), category => $category, type => $type, direction => $direction, linkage => $linkage }; >+ } >+ foreach my $field ($record->field('5..')) { #See Also >+ my $type = 'seealso'; >+ $type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w')); >+ if ($type eq 'notapplicable') { >+ $type = substr $field->subfield('w'), 2, 1; >+ $type = 'earlier' if $type && $type ne 'n'; >+ } >+ if ($type eq 'subfi') { >+ push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() }; >+ } else { >+ push @seealso, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() }; >+ } >+ } >+ foreach my $field ($record->field('6..')) { >+ push @notes, { note => $field->as_string(), field => $field->tag() }; >+ } >+ foreach my $field ($record->field('880')) { >+ my $linkage = $field->subfield('6'); >+ my $category = substr $linkage, 0, 1; >+ if ($category eq '1') { >+ $category = 'preferred'; >+ } elsif ($category eq '4') { >+ $category = 'seefrom'; >+ } elsif ($category eq '5') { >+ $category = 'seealso'; >+ } >+ my $type; >+ if ($field->subfield('w')) { >+ $type = $marc21controlrefs{substr $field->subfield('w'), '0'}; >+ } else { >+ $type = $category; > } >+ my $direction = $linkage =~ m#/r$# ? 'rtl' : 'ltr'; >+ push @otherscript, { term => $field->as_string($subfields_to_report), category => $category, type => $type, direction => $direction, linkage => $linkage }; > } >- $summary{mainentry} = $authorized[0]->{heading}; >- $summary{authorized} = \@authorized; >- $summary{notes} = \@notes; >- $summary{seefrom} = \@seefrom; >- $summary{seealso} = \@seealso; >- $summary{otherscript} = \@otherscript; > } >+ $summary{mainentry} = $authorized[0]->{heading}; >+ $summary{authorized} = \@authorized; >+ $summary{notes} = \@notes; >+ $summary{seefrom} = \@seefrom; >+ $summary{seealso} = \@seealso; >+ $summary{otherscript} = \@otherscript; > return \%summary; > } > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8357
:
11154
|
11188
|
11268
|
11269
|
11270