Bugzilla – Attachment 79609 Details for
Bug 21453
blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21
Bug-21453-blinddetail-biblio-searchpltt-use-hardco.patch (text/plain), 6.18 KB, created by
Andreas Roussos
on 2018-09-29 09:17:03 UTC
(
hide
)
Description:
Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21
Filename:
MIME Type:
Creator:
Andreas Roussos
Created:
2018-09-29 09:17:03 UTC
Size:
6.18 KB
patch
obsolete
>From 5e2d16e302051769806e0a33892a5d3c2d5948fc Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <arouss1980@gmail.com> >Date: Sat, 29 Sep 2018 11:52:08 +0300 >Subject: [PATCH] Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded > subfield values for MARC21 > >When using the authority finder plugin, you can pick an entry from the >'Special relationship:' dropdown menu in order to set the relationship >between authorities. If you're on a UNIMARC setup and click one of the >'Choose' buttons for the search results, only subfield $a (i.e. 'Entry >Element') will be copied over to the authority tag you are editing. In >MARC21 installs, however, all the authority data plus the authority id >are correctly copied over. This is due to hardcoded subfield values in >blinddetail-biblio-search{.pl,.tt} which are MARC21-specific. > >This patch fixes that by checking the 'marcflavour' system preference >and selecting the correct subfields to copy the authority data to. > >Test plan (steps 0-4 are common to both UNIMARC and MARC21 setups): > >0) [PREREQUISITES in order for the authority finder plugin to come up] > a) You must have at least one authority type besides the 'default'. > b) View the MARC structure of the 'default' auth type, then click > on 'Actions->Subfields' for tag 500; click on 'Edit subfields'. > c) Select the subfield 'a' tab, then pick an auth type from the > 'Thesaurus:' dropdown menu; click 'Save changes' at the top. >1) In the Staff client, go to Authorities, then click 'New Authority' > and pick the 'default' authority type. >2) When the authority editor comes up, go to tag 500 and expand it. >3) Click on the ellipsis (...) next to subfield 'a'. >4) When the authority finder comes up, search for an authority, pick > a relator code from the 'Special relationship:' dropdown, and then > click on the 'Choose' button for one of the authorities you found. >5) MARC21: all subfields are populated correctly. > UNIMARC: notice how subfields $3 and $5 are not populated. >6) Apply the patch (you may have to restart Plack, too). >7) Repeat steps 3) and 4) above. > MARC21: all subfields are populated correctly, same as before. > UNIMARC: both the relator code and the authority id are copied > over along with any other subfields that may exist. >--- > authorities/blinddetail-biblio-search.pl | 18 ++++++++++++++++-- > .../modules/authorities/blinddetail-biblio-search.tt | 11 +++++++++-- > 2 files changed, 25 insertions(+), 4 deletions(-) > >diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl >index f8ae22b242..3b0f9feb78 100755 >--- a/authorities/blinddetail-biblio-search.pl >+++ b/authorities/blinddetail-biblio-search.pl >@@ -59,6 +59,8 @@ my $index = $query->param('index'); > my $tagid = $query->param('tagid'); > my $relationship = $query->param('relationship'); > >+my $marcflavour = C4::Context->preference("marcflavour"); >+ > # open template > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >@@ -89,7 +91,8 @@ if ($authid) { > # Get all values for each distinct subfield and add to subfield loop > my %done_subfields; > for ( $field->subfields ) { >- next if $_->[0] eq '9'; # $9 will be set with authid value >+ next if $_->[0] eq '3'; # $3 will be set with authid value (UNIMARC) >+ next if $_->[0] eq '9'; # $9 will be set with authid value (MARC21) > my $letter = $_->[0]; > $letter ||= '@'; > next if defined $done_subfields{$letter}; >@@ -98,7 +101,17 @@ if ($authid) { > $done_subfields{$letter} = 1; > } > >- push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship ); >+ # If a relationship code has been selected, add it to the appropriate >+ # subfield of @subfield_loop, depending on the MARC flavour being used. >+ if ( $relationship ) { >+ my $relationship_subfield; >+ if ( $marcflavour eq 'UNIMARC' ) { >+ $relationship_subfield = '5'; >+ } elsif ( $marcflavour eq 'MARC21' ) { >+ $relationship_subfield = 'w'; >+ } >+ push( @subfield_loop, { marc_subfield => $relationship_subfield, marc_values => $relationship } ) ; >+ } > > my $controlled_ind = $auth->controlled_indicators({ record => $record, biblio_tag => $tag_number }); > $indicator1 = $controlled_ind->{ind1}; >@@ -115,6 +128,7 @@ if ($authid) { > > > $template->param( >+ marcflavour => $marcflavour, > authid => $authid ? $authid : "", > index => $index, > tagid => $tagid, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >index 2b022d6ace..1d7b2b6462 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >@@ -35,7 +35,9 @@ > [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%] > [%- marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html -%] > [%- END -%] >- [%- END -%]â¡9[% authid | html %]"; >+ [%- END -%][% IF ( marcflavour == 'UNIMARC' ) %]â¡3[% authid %]"; >+ [% ELSIF ( marcflavour == 'MARC21' ) %]â¡9[% authid %]"; >+ [% END %] > [% END %] > RancorReplaceField( new_line, "[% indicator1 | html %]", "[% indicator2 | html %]" ); > [% ELSE %] >@@ -135,7 +137,12 @@ > [% IF ( clear ) %] > if (subfield){subfield.value="" ;} > [% ELSE %] >- if(code.value=='9'){ >+ [% IF ( marcflavour == 'UNIMARC' ) %] >+ var authid_subfield = "3"; >+ [% ELSIF ( marcflavour == 'MARC21' ) %] >+ var authid_subfield = "9"; >+ [% END %] >+ if(code.value==authid_subfield){ > subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]"; > break; > } >-- >2.11.0
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 21453
:
79609
|
80140
|
180268