Summary: | blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21 | ||
---|---|---|---|
Product: | Koha | Reporter: | Andreas Roussos <arouss1980> |
Component: | MARC Authority data support | Assignee: | Andreas Roussos <arouss1980> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P3 | CC: | m.de.rooy, mtompset |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8332 | ||
Change sponsored?: | --- | Patch complexity: | Medium patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | 21880 | ||
Bug Blocks: | |||
Attachments: |
Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21
Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21 |
Description
Andreas Roussos
2018-09-29 07:34:23 UTC
Created attachment 79609 [details] [review] 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. A colleague has found a case where the patch does not work as intended and may break some setups: when the authority finder is used from within the bibliographic editor (e.g. to link an authority to UNIMARC tag 700), it will populate field $3 ('Authority Record Number') with the auth id but not field $9 ('Koha Internal Code') as it did prior to the patch. I'll try to revise my patch and provide a more thorough test plan. I've amended my patch and reworded some parts of the commit message that were ambiguous. The patch now takes NORMARC into account as well, which is similar to MARC21 from what I gather by reading the following: https://wiki.koha-community.org/wiki/Add_support_for_NORMARC#Code_changes http://lists.koha-community.org/pipermail/koha-devel/2010-July/034257.html https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11611#c9 Created attachment 80140 [details] [review] Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21 When using the authority finder plugin from within the Authorities module, you can pick an entry from the 'Special relationship:' dropdown menu in order to set the relationship between authorities. On a UNIMARC setup, clicking on 'Choose' will not populate subfields $3 (Authority Record Number) and $5 (Tracing Control), which are required for authority linking and hierarchies to work properly. In MARC21 installs, however, all authority data is correctly copied over. This is due to hardcoded subfield values which are MARC21-specific in blinddetail-biblio-search{.pl,.tt}. This patch fixes that by checking the value of 'marcflavour' syspref, and then setting the correct subfields to copy the authority data to. Test plan: 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'. 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 (or edit an existing auth). 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/NORMARC setup: all subfields are populated correctly. UNIMARC setup: notice how subfields $3 and $5 are not populated. 6) Apply the patch. 7) Repeat steps 3) and 4) above. MARC21/NORMARC: all subfields are populated correctly, as before. UNIMARC: both the relator code and the authority id are copied over along with any other subfields that may exist. 8) To ensure that authority linking in the Cataloging module works as before, launch the biblio editor, find a MARC tag that allows you to search for an authority, and link it. MARC21/NORMARC: all authority data is copied over (auth id in $9). UNIMARC: all authority data is copied over (auth id in $9). With regards to steps 3 & 4 above: the 'Choose' buttons in results pages other than 1 will not work because the 'source' parameter is missing from the URL pointed to by the pagination hyperlinks. I've added the 'source' parameter to the pagination URLs in a separate bug report (Bug 21880) that fixes a different issue. Therefore, I am marking #21880 as a dependency, hoping that it will be easier to follow the test plan this way. Comment on attachment 80140 [details] [review] Bug 21453: blinddetail-biblio-search.pl/.tt use hardcoded subfield values for MARC21 Review of attachment 80140 [details] [review]: ----------------------------------------------------------------- ::: authorities/blinddetail-biblio-search.pl @@ +92,4 @@ > # Get all values for each distinct subfield and add to subfield loop > my %done_subfields; > for ( $field->subfields ) { > + next if $_->[0] eq '3'; # $3 will be set with authid value (in UNIMARC authorities) UNIMARC isn't checked. Bad expression? @@ +129,3 @@ > $template->param( > + source => $source, > + marcflavour => $marcflavour, There is no need to pass a systempreference. ::: koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt @@ +35,5 @@ > [%- FOREACH marc_value IN SUBFIELD_LOO.marc_values -%] > [%- marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html -%] > [%- END -%] > + [%- END -%][% IF ( marcflavour == 'UNIMARC' ) %]‡3[% authid %]"; > + [% ELSIF ( marcflavour == 'MARC21' ) || ( marcflavour == 'NORMARC' ) %]‡9[% authid %]"; The filter is removed. QA Fail. @@ +137,4 @@ > [% IF ( clear ) %] > if (subfield){subfield.value="" ;} > [% ELSE %] > + [% IF ( marcflavour == 'UNIMARC' ) %] Perhaps something like [% marcflavour = Koha.Preference('marcflavour') %] near the top? To avoid passing this as a parameter? |