Bug 13560 - MARC modification templates - Add an 'Add' option
Summary: MARC modification templates - Add an 'Add' option
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 21129
  Show dependency treegraph
 
Reported: 2015-01-12 16:39 UTC by Nicole C. Engard
Modified: 2020-11-12 15:03 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
add/update on marc mod is only updating (69.91 KB, image/png)
2015-01-12 16:39 UTC, Nicole C. Engard
Details
Bug 13560 - need an add option in marc modification templates (15.05 KB, patch)
2017-07-05 16:20 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 13560 - need an add option in marc modification templates (15.22 KB, patch)
2017-10-25 17:04 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 13560 - Database changes (1.82 KB, patch)
2018-01-16 16:27 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 13560 - Unit tests (8.01 KB, patch)
2018-01-16 16:27 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 13560: Add an 'Add' option for marc modification templates (7.25 KB, patch)
2018-01-16 16:27 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 13560: Add an 'Add' option for marc modification templates (7.31 KB, patch)
2018-01-17 13:26 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 13560 - Database changes (1.88 KB, patch)
2018-02-01 16:40 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 13560 - Unit tests (8.07 KB, patch)
2018-02-01 16:40 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 13560: Add an 'Add' option for marc modification templates (7.31 KB, patch)
2018-02-01 16:40 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 13560 - Database changes (1.94 KB, patch)
2018-05-28 10:10 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 13560 - Unit tests (8.13 KB, patch)
2018-05-28 10:10 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 13560: Add an 'Add' option for marc modification templates (7.39 KB, patch)
2018-05-28 10:11 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2015-01-12 16:39:23 UTC
Created attachment 35108 [details]
add/update on marc mod is only updating

Right now the marc modification templates have an add/update option but it's only updating. So let's say I want to add a new 650 (like attached) it's updating all existing 650s to have the value I want to add as a new 650.
Comment 1 Fridolin Somers 2017-06-28 16:28:49 UTC
This is an enhancement
Comment 2 Nick Clemens (kidclamp) 2017-07-05 16:20:33 UTC Comment hidden (obsolete)
Comment 3 delaye 2017-08-28 13:18:38 UTC
when i use the tool (step 12) i have this message

Software error:

Template process failed: undef error - The method itemnumbers is not covered by tests! at /home/koha/src/C4/Templates.pm line 121.


And when i want add the rule 'Add' in the template(step11)  , koha fix the rule delete
Comment 4 Katrin Fischer 2017-10-07 13:47:40 UTC
I think Update is not quite right as the option actually adds a field when it doesn't exist yet. I have used it to add items with different subfields a lot of times. Maybe it needs a better description - Add or update?
Comment 5 Nick Clemens (kidclamp) 2017-10-25 17:04:57 UTC
Created attachment 68540 [details] [review]
Bug 13560 - need an add option in marc modification templates

Add/Update would update a field or create new if it existed, but didn't
allow for creating new if the field existed.

This patchset splits the options to Add & Update so that add will always
add a field and Update will operate as it always has

To test:
1 - Have a record with a known existing field (make a copy)
2 - Define a marc modification template that 'Add/update' on that field
3 - Define an 'Add/Update' on a field that doesn't exist
4 - Batch modify the copy of record using the above template
5 - Verify the existing field was updated
6 - Verify the non-existing field was updated
7 - Apply patch
8 - Make another copy
9 - Modify the copy with the same template as above
10 - Should match initial modification
11 - Add a new rule to add a new field
12 - Modify using the updated template
13 - Ensure your new field is created
14 - Test various options in the modification tool
15 - prove t/db_dependent/MarcModificationTemplates.t
Comment 6 Jon Knight 2017-10-25 18:09:22 UTC
When I try to do step 11 in the test plan, the rule created comes out as "Delete" rather than "Add new".  Similarly, if I try to edit the rule to make it "Add new" it goes back to "Delete" once the "Update action" button is pressed in the "Edit action 3" dialog box.
Comment 7 Victor Grousset/tuxayo 2017-11-06 11:21:55 UTC Comment hidden (obsolete)
Comment 8 Victor Grousset/tuxayo 2018-01-15 13:56:24 UTC Comment hidden (obsolete)
Comment 9 Nick Clemens (kidclamp) 2018-01-16 16:27:40 UTC
Created attachment 70562 [details] [review]
Bug 13560 - Database changes
Comment 10 Nick Clemens (kidclamp) 2018-01-16 16:27:44 UTC
Created attachment 70563 [details] [review]
Bug 13560 - Unit tests

To test:
1 - apply all patches
2 - update database
3 - prove t/db_dependent/MarcModificationTemplates.t
Comment 11 Nick Clemens (kidclamp) 2018-01-16 16:27:48 UTC
Created attachment 70564 [details] [review]
Bug 13560: Add an 'Add' option for marc modification templates

Add/Update would update a field or create new if it existed, but didn't
allow for creating new if the field existed.

This patchset splits the options to 'Add & Update' so that 'Add' will always
add a field and 'Update' will operate as it always has

To test:
1 - Have a record with a known existing field (make a copy)
2 - Define a marc modification template that 'Add/update' on that field
3 - Define an 'Add/Update' on a field that doesn't exist
4 - Batch modify the copy of record using the above template
5 - Verify the existing field was updated
6 - Verify the non-existing field was updated
7 - Apply patch and update database
8 - Make another copy
9 - Modify the copy with the same template as above
10 - Should match initial modification
11 - Add a new rule to add a new field
12 - Modify using the updated template
13 - Ensure your new field is created
14 - Test various options in the modification tool
15 - prove t/db_dependent/MarcModificationTemplates.t
Comment 12 Nick Clemens (kidclamp) 2018-01-16 16:28:22 UTC
fixed the conflict, split the patches, added DB update to instructions
Comment 13 Victor Grousset/tuxayo 2018-01-17 13:26:01 UTC Comment hidden (obsolete)
Comment 14 Victor Grousset/tuxayo 2018-01-17 13:29:01 UTC Comment hidden (obsolete)
Comment 15 Victor Grousset/tuxayo 2018-02-01 16:40:08 UTC
Created attachment 71115 [details] [review]
Bug 13560 - Database changes

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Comment 16 Victor Grousset/tuxayo 2018-02-01 16:40:13 UTC
Created attachment 71116 [details] [review]
Bug 13560 - Unit tests

To test:
1 - apply all patches
2 - update database
3 - prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Comment 17 Victor Grousset/tuxayo 2018-02-01 16:40:18 UTC
Created attachment 71117 [details] [review]
Bug 13560: Add an 'Add' option for marc modification templates

Add/Update would update a field or create new if it existed, but didn't
allow for creating new if the field existed.

This patchset splits the options to 'Add & Update' so that 'Add' will always
add a field and 'Update' will operate as it always has

To test:
1 - Have a record with a known existing field (make a copy)
2 - Define a marc modification template that 'Add/update' on that field
3 - Define an 'Add/Update' on a field that doesn't exist
4 - Batch modify the copy of record using the above template
5 - Verify the existing field was updated
6 - Verify the non-existing field was updated
7 - Apply patch and update database
8 - Make another copy
9 - Modify the copy with the same template as above
10 - Should match initial modification
11 - Add a new rule to add a new field
12 - Modify using the updated template
13 - Ensure your new field is created
14 - Test various options in the modification tool
15 - prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Comment 18 Victor Grousset/tuxayo 2018-02-01 16:41:12 UTC
I forgot to sign off the first two patches. So here they are.

To no loose my previous comment:

As for step «14 - Test various options in the modification tool»

I only moved one field to another to ensure that the target is overwritten without error. Is that enough?
Comment 19 Victor Grousset/tuxayo 2018-02-22 14:58:23 UTC
(In reply to Nick Clemens on IRC)
> ideally you would test all the options just to ensure I didn't break anything unintentionally, but if any other option worked it would seem features are intact

I tried to play with the copy function, but that failed (even on the 17.11) so due to lack of functional knowledge I can't improvise more than that.

But that doesn't seem a big issue. So this would be reading for being QAed if I understand correctly.
Comment 20 Chris Cormack 2018-05-28 10:10:31 UTC
Created attachment 75584 [details] [review]
Bug 13560 - Database changes

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 21 Chris Cormack 2018-05-28 10:10:51 UTC
Created attachment 75585 [details] [review]
Bug 13560 - Unit tests

To test:
1 - apply all patches
2 - update database
3 - prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 22 Chris Cormack 2018-05-28 10:11:18 UTC
Created attachment 75586 [details] [review]
Bug 13560: Add an 'Add' option for marc modification templates

Add/Update would update a field or create new if it existed, but didn't
allow for creating new if the field existed.

This patchset splits the options to 'Add & Update' so that 'Add' will always
add a field and 'Update' will operate as it always has

To test:
1 - Have a record with a known existing field (make a copy)
2 - Define a marc modification template that 'Add/update' on that field
3 - Define an 'Add/Update' on a field that doesn't exist
4 - Batch modify the copy of record using the above template
5 - Verify the existing field was updated
6 - Verify the non-existing field was updated
7 - Apply patch and update database
8 - Make another copy
9 - Modify the copy with the same template as above
10 - Should match initial modification
11 - Add a new rule to add a new field
12 - Modify using the updated template
13 - Ensure your new field is created
14 - Test various options in the modification tool
15 - prove t/db_dependent/MarcModificationTemplates.t

Signed-off-by: Victor Grousset <victor.grousset@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 23 Nick Clemens (kidclamp) 2018-07-19 17:36:49 UTC
Awesome work all!

Pushed to master for 18.11
Comment 24 Martin Renvoize (ashimema) 2018-08-02 13:50:10 UTC
Enhancement, will not be backported to 18.05.x series.