Bugzilla – Attachment 21714 Details for
Bug 10985
Unimarc: Authority summary does not work as expected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10985: [UNIMARC] Fix authority summary
Bug-10985-UNIMARC-Fix-authority-summary.patch (text/plain), 3.73 KB, created by
Jonathan Druart
on 2013-10-02 12:22:16 UTC
(
hide
)
Description:
Bug 10985: [UNIMARC] Fix authority summary
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-10-02 12:22:16 UTC
Size:
3.73 KB
patch
obsolete
>From 57d57159d67820d50aeab32f186db5889e5cf951 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 2 Oct 2013 14:16:09 +0200 >Subject: [PATCH] Bug 10985: [UNIMARC] Fix authority summary > >Test plan: >- edit an authority summary with: >NP : [200a][, 200b][ 200d][-- 152b --][ ; 200c][ (200f)] [001*] [ppn: 009*] >- create a new authority with previous fields (it is possible some > fields don't exist). >- search this authority and verify the summary is someting like: > NP : Name, D.-- NP -- 23849 ppn my_ppn: >- Verify some summary for existing authority and check there are > correct. >/!\ For the ppn, it should be defined in the zebra indexes. >--- > C4/AuthoritiesMarc.pm | 52 +++++++++++++++++++++++++------------------------ > 1 file changed, 27 insertions(+), 25 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index 9ea3b2d..5fb0351 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -915,34 +915,36 @@ sub BuildSummary { > # feature will be enabled only for UNIMARC for backwards > # compatibility. > if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') { >- my @fields = $record->fields(); >-# $reported_tag = '$9'.$result[$counter]; >- my @stringssummary; >- foreach my $field (@fields) { >- my $tag = $field->tag(); >- my $tagvalue = $field->as_string(); >- my $localsummary= $summary{summary}; >- $localsummary =~ 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) { >- my $subfieldcode = $subf[$i][0]; >- my $subfieldvalue = $subf[$i][1]; >- my $tagsubf = $tag.$subfieldcode; >- $localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g; >+ my @matches = ($summary{summary} =~ m/\[(.*?)(\d{3})([\*a-z0-9])(.*?)\]/g); >+ my (@textbefore, @tag, @subtag, @textafter); >+ for(my $i = 0; $i < scalar @matches; $i++){ >+ push @textbefore, $matches[$i] if($i%4 == 0); >+ push @tag, $matches[$i] if($i%4 == 1); >+ push @subtag, $matches[$i] if($i%4 == 2); >+ push @textafter, $matches[$i] if($i%4 == 3); >+ } >+ for(my $i = scalar @tag; $i >= 0; $i--){ >+ my $textbefore = $textbefore[$i] || ''; >+ my $tag = $tag[$i] || ''; >+ my $subtag = $subtag[$i] || ''; >+ my $textafter = $textafter[$i] || ''; >+ my $value = ''; >+ my $field = $record->field($tag); >+ if ( $field ) { >+ if($subtag eq '*') { >+ if($tag < 10) { >+ $value = $textbefore . $field->data() . $textafter; >+ } >+ } else { >+ my @subfields = $field->subfield($subtag); >+ if(@subfields > 0) { >+ $value = $textbefore . join (" - ", @subfields) . $textafter; >+ } > } > } >- push @stringssummary, $localsummary if ($localsummary ne $summary{summary}); >+ $summary{summary} =~ s/\[\Q$textbefore$tag$subtag$textafter\E\]/$value/; > } >- my $resultstring; >- $resultstring = join(" -- ",@stringssummary); >- $resultstring =~ s/\[(.*?)\]//g; >- $resultstring =~ s/\n/<br>/g; >- $summary{summary} = $resultstring; >+ $summary{summary} =~ s/\\n/<br \/>/g; > } > my @authorized; > my @notes; >-- >1.7.10.4
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 10985
:
21714
|
36809
|
37599
|
38293