Bug 26781

Summary: Marc Modification Templates treat subfield 0 and no subfield set
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: ToolsAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: aleisha, jonathan.druart, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.06
Circulation function:
Bug Depends on:    
Bug Blocks: 26894    
Attachments: Bug 26781: Check for subfield defined rather than truth
Bug 26781: Check for subfield defined rather than truth
k
Bug 26781: Check for subfield defined rather than truth
Bug 26781: Check for subfield defined rather than truth
Bug 26781: (follow-up) Adjust tests as fields are no longer completely removed

Description Nick Clemens (kidclamp) 2020-10-22 10:47:38 UTC
To recreate:
1 - Have a record with 100$0 defined
2 - Define a Marc Modification template:
    Delete field 100$0
3 - Perform Batch record modification, enter the record above in the list of records
4 - Preview the MARC
5 - Note the entire 100 field has been deleted
Comment 1 Nick Clemens (kidclamp) 2020-10-22 11:01:44 UTC
Created attachment 112164 [details] [review]
Bug 26781: Check for subfield defined rather than truth

To recreate:
 1 - Have a record with 100$0 defined
 2 - Define a Marc Modification template:
    Delete field 100$0
 3 - Perform Batch record modification, enter the record above in the list of records
 4 - Preview the MARC
 5 - Note the entire 100 field has been deleted, don't modify the record
 6 - Apply patch
 7 - Restart all the things
 8 - Test the modification again
 9 - This time the preview confirms only the subfield 0 deleted
10 - Modify the record
11 - Confirm the record is correctly updated
Comment 2 Chris Cormack 2020-10-24 22:02:53 UTC
Created attachment 112409 [details] [review]
Bug 26781: Check for subfield defined rather than truth

To recreate:
 1 - Have a record with 100$0 defined
 2 - Define a Marc Modification template:
    Delete field 100$0
 3 - Perform Batch record modification, enter the record above in the list of records
 4 - Preview the MARC
 5 - Note the entire 100 field has been deleted, don't modify the record
 6 - Apply patch
 7 - Restart all the things
 8 - Test the modification again
 9 - This time the preview confirms only the subfield 0 deleted
10 - Modify the record
11 - Confirm the record is correctly updated

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 3 Katrin Fischer 2020-10-25 00:28:25 UTC
Created attachment 112433 [details] [review]
k
Comment 4 Katrin Fischer 2020-10-25 00:29:01 UTC
Created attachment 112434 [details] [review]
Bug 26781: Check for subfield defined rather than truth

To recreate:
 1 - Have a record with 100$0 defined
 2 - Define a Marc Modification template:
    Delete field 100$0
 3 - Perform Batch record modification, enter the record above in the list of records
 4 - Preview the MARC
 5 - Note the entire 100 field has been deleted, don't modify the record
 6 - Apply patch
 7 - Restart all the things
 8 - Test the modification again
 9 - This time the preview confirms only the subfield 0 deleted
10 - Modify the record
11 - Confirm the record is correctly updated

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2020-10-25 21:57:53 UTC
Created attachment 112488 [details] [review]
Bug 26781: Check for subfield defined rather than truth

To recreate:
 1 - Have a record with 100$0 defined
 2 - Define a Marc Modification template:
    Delete field 100$0
 3 - Perform Batch record modification, enter the record above in the list of records
 4 - Preview the MARC
 5 - Note the entire 100 field has been deleted, don't modify the record
 6 - Apply patch
 7 - Restart all the things
 8 - Test the modification again
 9 - This time the preview confirms only the subfield 0 deleted
10 - Modify the record
11 - Confirm the record is correctly updated

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: Fix typo ony vs only
Comment 6 Jonathan Druart 2020-10-25 23:10:05 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 7 Jonathan Druart 2020-11-02 09:05:13 UTC
There is a failing test:

t/db_dependent/MarcModificationTemplates.t .. 1/126 
#   Failed test '100$0 has been deleted, added back, updated, moved to 600$0, and copied back to 100$0; finally, 245$0 has been copied and replaced to 700$0'
#   at t/db_dependent/MarcModificationTemplates.t line 799.
#     Structures begin differing at:
#          $got->{_fields}[2]{_ind1} = '1'
#     $expected->{_fields}[2]{_ind1} = ' '
# Looks like you failed 1 test of 126.

Please fix ASAP.
Comment 8 Nick Clemens (kidclamp) 2020-11-02 11:24:24 UTC
Created attachment 112826 [details] [review]
Bug 26781: (follow-up) Adjust tests as fields are no longer completely removed
Comment 9 Jonathan Druart 2020-11-02 12:51:44 UTC
(In reply to Nick Clemens from comment #8)
> Created attachment 112826 [details] [review] [review]
> Bug 26781: (follow-up) Adjust tests as fields are no longer completely
> removed

Pushed to master.
Comment 10 Lucas Gass (lukeg) 2020-11-13 20:52:29 UTC
backported to 20.05.x for 20.05.06
Comment 11 Aleisha Amohia 2020-11-17 04:43:17 UTC
doesn't apply cleanly on 19.11.x, not backported