Bugzilla – Attachment 71340 Details for
Bug 14769
Authorities merge: Set correct indicators in biblio field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14769: Biblio indicators based on authority's thesaurus code
Bug-14769-Biblio-indicators-based-on-authoritys-th.patch (text/plain), 2.60 KB, created by
Marcel de Rooy
on 2018-02-08 13:43:48 UTC
(
hide
)
Description:
Bug 14769: Biblio indicators based on authority's thesaurus code
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-02-08 13:43:48 UTC
Size:
2.60 KB
patch
obsolete
>From 5f1775b56bf6271b339495bb42e4fb55c97195fa Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Fri, 24 Nov 2017 22:21:48 +0100 >Subject: [PATCH] Bug 14769: Biblio indicators based on authority's thesaurus > code >Content-Type: text/plain; charset=utf-8 > >Original patch from Janusz Kaczmarek on November 24, 2017. >Amended by Marcel de Rooy on February 6, 2018. >Code moved from AuthoritiesMarc.pm to ControlledIndicators.pm. > >Special attention has been paid to the proper application of 008/11 >while controlling 6XX in MARC 21, specially if 008/11 =~ /[rsz]/ >(and if it is 'z' and 040 $f is defined). > >Test plan: >See next patch. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >The construction $thes_mapping{ $code } // $code // '4' will still get >some attention on a follow-up. >--- > Koha/Authority/ControlledIndicators.pm | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > >diff --git a/Koha/Authority/ControlledIndicators.pm b/Koha/Authority/ControlledIndicators.pm >index bdadaad..87ae796 100644 >--- a/Koha/Authority/ControlledIndicators.pm >+++ b/Koha/Authority/ControlledIndicators.pm >@@ -83,6 +83,9 @@ sub get { > } elsif( $rule->{$ind} eq 'auth2' ) { > $result->{$ind} = $report_fld->indicator(2) if $report_fld; > } elsif( $rule->{$ind} eq 'thesaurus' ) { >+ my @info = _thesaurus_info( $record ); >+ $result->{$ind} = $info[0]; >+ $result->{sub2} = $info[1]; > } else { > $result->{$ind} = substr( $rule->{$ind}, 0, 1); > } >@@ -117,6 +120,32 @@ sub _load_pref { > return $res; > } > >+sub _thesaurus_info { >+ # This sub is triggered by the term 'thesaurus' in the controlling pref. >+ # The indicator of some MARC21 fields (like 600 ind2) is controlled by >+ # authority field 008/11 and 040$f. Additionally, it may also control $2. >+ my ( $record ) = @_; >+ my $code = $record->field('008') >+ ? substr($record->field('008')->data, 11, 1) >+ : q{}; >+ my %thes_mapping = ( a => 0, b => 1, c => 2, d => 3, k => 5, n => 4, r => 7, s => 7, v => 6, z => 7, '|' => 4 ); >+ my $ind = $thes_mapping{ $code } // $code // '4'; >+ >+ # Determine optional subfield $2 >+ my $sub2; >+ if( $ind eq '7' ) { >+ # Important now to return a defined value >+ $sub2 = $code eq 'r' >+ ? 'aat' >+ : $code eq 's' >+ ? 'sears' >+ : $code eq 'z' # pick from 040$f >+ ? $record->subfield( '040', 'f' ) // q{} >+ : q{}; >+ } >+ return ( $ind, $sub2 ); >+} >+ > =head3 clear > > Clear internal cache. >-- >2.1.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 14769
:
42197
|
69343
|
70948
|
70949
|
70950
|
70951
|
71338
|
71339
|
71340
|
71341
|
71342
|
71343
|
71351
|
71352
|
71353
|
71354
|
71355
|
71366
|
71374
|
71375
|
71376
|
71377
|
71378
|
71379
|
71380
|
71381
|
72398
|
72399
|
72400
|
72401
|
72402
|
72403
|
72404
|
73389
|
73773
|
73774
|
73775
|
73776
|
73777
|
73778
|
73779
|
74052