We have realized that Koha MArc modification templates ignore subfield 0, it is not very common used subfield, it is working with subfields greater than 0 We have create a template for adding 773$0 (host biblionumber in analytics) but the template doesn't get the subfield and only stores main tag 773. Checked in: Koha 3.22 & 16.05.05 Debian 8 and plack enabled TEST Go to Tools --> MARC modification templates Create one rule. Add/Update field 773 0 with value 'demo' save it you can check that subfield is not appearing in the descrption, if you edit it appears, but when you try to execute thah template, and try to previwe the marc you get internal error and get the following log. This action is not implemented yet at /usr/share/koha/lib/Koha/SimpleMARC.pm line 169.
Still valid in 16.11. Marjorie
This is still an issue in 17.11. Library is trying to remove subject headings using marc modification templates, specifically in the 650$0.
Haven't confirmed in newer version yet.
Confirmed still an issue in 19.05.
(In reply to Sarah Cornell from comment #4) > Confirmed still an issue in 19.05. Thx, Sarah!
As Hugo pointed out, this bug has two aspects. 1) Firstly, there's the issue of the subfield not appearing in the MARC Modification Template (MMT) action description when its value is 0 (even though it will appear when editing the action). These are the relevant lines of code from marc_modification_templates.tt: 136 [% ActionsLoo.from_field | html %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield | html %][% END %] 143 to [% ActionsLoo.to_field | html %][% IF ( ActionsLoo.to_subfield ) %]$[% ActionsLoo.to_subfield | html %][% END %] 154 [% ActionsLoo.conditional_field | html %][% IF ( ActionsLoo.conditional_subfield ) %]$[% ActionsLoo.conditional_subfield | html %][% END %] The problem lies with the "[% IF ( ... ) %]" statements: when the from/to/conditional subfield value is set to 0 the IF clause will evaluate to false and therefore the value will not be printed. 2) Secondly, we have an error message coming up in the Plack log file ("This action is not implemented yet"), and this relates to commit c7d862b (from Bug 11319). In that commit, among other things, the update_field() subroutine was added to SimpleMARC.pm, the most relevant lines of which are: 167 if ( not $subfieldName or $subfieldName eq '' ) { 168 # FIXME I'm not sure the actual implementation is correct. 169 die "This action is not implemented yet"; 170 #_update_field({ record => $record, field => $fieldName, values => \@values }); 171 } else { 172 _update_subfield({ record => $record, field => $fieldName, subfield => $subfieldName, values => \@values, field_numbers => $field_numbers }); 173 } The first condition in the 'if' clause above results in the expression evaluating to true when a subfield value of 0 (integer zero) or '0' (string zero) is entered -- hence the error message.
Created attachment 99028 [details] [review] Bug 17510: enable use of subfield 0 in MMT actions When adding MARC modification template (MMT) actions, if a subfield value of 0 (zero) is entered it will not show up in the action's description upon saving. Also, if you try to modify an authority or biblio record using actions that refer to subfield 0 the procedure will fail. This patch fixes that. Test plan: 0) Create a MARC modification template and add some actions to it, ideally testing all action types (Delete/Add new/Update existing or add new/Move/Copy/Copy and replace); make sure you input a 0 (integer zero) in the text box for the subfield value(s). 1) As you save each action, observe that subfield 0 ($0) is missing from the action description. 2) Home > Tools > Batch record modification: try to modify a biblio- graphic record using the modification template you just created. Observe that you get an error in the system logs if you click on 'Show MARC' or 'Modify selected records'. 3) Apply the patch. 4) Repeat steps 0-2. The subfield value ($0) should be displayed in the action description and the Batch record modification should work without problems.
Created attachment 99029 [details] [review] Bug 17510: update MMT-related unit tests The unit tests related to MARC modification templates need to be updated with extra tests specific to actions involving subfield 0. Test plan: 0) Apply the patch. 1) Run the updated unit tests, they should pass without any errors: $ prove t/SimpleMARC.t $ prove t/db_dependent/MarcModificationTemplates.t https://bugs.koha-community.org/show_bug.cgi?id=6473
Created attachment 99031 [details] [review] Bug 17510: update MMT-related unit tests The unit tests related to MARC modification templates need to be updated with extra tests specific to actions involving subfield 0. Test plan: 0) Apply the patch. 1) Run the updated unit tests, they should pass without any errors: $ prove t/SimpleMARC.t $ prove t/db_dependent/MarcModificationTemplates.t
I've just realised that the URL for the git-bz test bug here on Bugzilla (Bug 6473) got included at the end of my previous commits. I tried to attach my patches to the test bug before attaching them here (just to be on the safe side), but must have messed up somewhere. I will re-attach them now... Sorry for any confusion.
Created attachment 99034 [details] [review] Bug 17510: enable use of subfield 0 in MMT actions When adding MARC modification template (MMT) actions, if a subfield value of 0 (zero) is entered it will not show up in the action's description upon saving. Also, if you try to modify an authority or biblio record using actions that refer to subfield 0 the procedure will fail. This patch fixes that. Test plan: 0) Create a MARC modification template and add some actions to it, ideally testing all action types (Delete/Add new/Update existing or add new/Move/Copy/Copy and replace); make sure you input a 0 (integer zero) in the text box for the subfield value(s). 1) As you save each action, observe that subfield 0 ($0) is missing from the action description. 2) Home > Tools > Batch record modification: try to modify a biblio- graphic record using the modification template you just created. Observe that you get an error in the system logs if you click on 'Show MARC' or 'Modify selected records'. 3) Apply the patch. 4) Repeat steps 0-2. The subfield value ($0) should be displayed in the action description and the Batch record modification should work without problems.
Created attachment 99035 [details] [review] Bug 17510: update MMT-related unit tests The unit tests related to MARC modification templates need to be updated with extra tests specific to actions involving subfield 0. Test plan: 0) Apply the patch. 1) Run the updated unit tests, they should pass without any errors: $ prove t/SimpleMARC.t $ prove t/db_dependent/MarcModificationTemplates.t
Created attachment 99050 [details] [review] Bug 17510: update MMT-related unit tests The unit tests related to MARC modification templates need to be updated with extra tests specific to actions involving subfield 0. Test plan: 0) Apply the patch. 1) Run the updated unit tests, they should pass without any errors: $ prove t/SimpleMARC.t $ prove t/db_dependent/MarcModificationTemplates.t Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Created attachment 99051 [details] [review] Bug 17510: update MMT-related unit tests The unit tests related to MARC modification templates need to be updated with extra tests specific to actions involving subfield 0. Test plan: 0) Apply the patch. 1) Run the updated unit tests, they should pass without any errors: $ prove t/SimpleMARC.t $ prove t/db_dependent/MarcModificationTemplates.t Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Created attachment 99052 [details] [review] Bug 17510: enable use of subfield 0 in MMT actions When adding MARC modification template (MMT) actions, if a subfield value of 0 (zero) is entered it will not show up in the action's description upon saving. Also, if you try to modify an authority or biblio record using actions that refer to subfield 0 the procedure will fail. This patch fixes that. Test plan: 0) Create a MARC modification template and add some actions to it, ideally testing all action types (Delete/Add new/Update existing or add new/Move/Copy/Copy and replace); make sure you input a 0 (integer zero) in the text box for the subfield value(s). 1) As you save each action, observe that subfield 0 ($0) is missing from the action description. 2) Home > Tools > Batch record modification: try to modify a biblio- graphic record using the modification template you just created. Observe that you get an error in the system logs if you click on 'Show MARC' or 'Modify selected records'. 3) Apply the patch. 4) Repeat steps 0-2. The subfield value ($0) should be displayed in the action description and the Batch record modification should work without problems. Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Created attachment 99356 [details] [review] Bug 17510: update MMT-related unit tests The unit tests related to MARC modification templates need to be updated with extra tests specific to actions involving subfield 0. Test plan: 0) Apply the patch. 1) Run the updated unit tests, they should pass without any errors: $ prove t/SimpleMARC.t $ prove t/db_dependent/MarcModificationTemplates.t Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 99357 [details] [review] Bug 17510: enable use of subfield 0 in MMT actions When adding MARC modification template (MMT) actions, if a subfield value of 0 (zero) is entered it will not show up in the action's description upon saving. Also, if you try to modify an authority or biblio record using actions that refer to subfield 0 the procedure will fail. This patch fixes that. Test plan: 0) Create a MARC modification template and add some actions to it, ideally testing all action types (Delete/Add new/Update existing or add new/Move/Copy/Copy and replace); make sure you input a 0 (integer zero) in the text box for the subfield value(s). 1) As you save each action, observe that subfield 0 ($0) is missing from the action description. 2) Home > Tools > Batch record modification: try to modify a biblio- graphic record using the modification template you just created. Observe that you get an error in the system logs if you click on 'Show MARC' or 'Modify selected records'. 3) Apply the patch. 4) Repeat steps 0-2. The subfield value ($0) should be displayed in the action description and the Batch record modification should work without problems. Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Obvious fix, now well covered by tests.. Thanks Passing QA
Nice work everyone! Pushed to master for 20.05
enhancement not backported to 19.11.x