Bug 35073

Summary: Serials batch edit deletes unchanged additional fields data
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: SerialsAssignee: Pedro Amorim <pedro.amorim>
Status: Pushed to oldstable --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, julian.maurice, katrin.fischer, martin.renvoize, nick, oleonard, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.06,22.11.12
Bug Depends on: 18426    
Bug Blocks: 35044    
Attachments: Bug 35073: Rename additional_fields to available_additional_fields
Bug 35073: Default to existing value if there is one
Bug 35073: perltidy subscription-batchedit.pl
Bug 35073: Rename additional_fields to available_additional_fields
Bug 35073: Default to existing value if there is one
Bug 35073: perltidy subscription-batchedit.pl
Bug 35073: Rename additional_fields to available_additional_fields
Bug 35073: Default to existing value if there is one
Bug 35073: perltidy subscription-batchedit.pl

Description Pedro Amorim 2023-10-17 08:37:27 UTC
To reproduce, k-t-d:

Preparation - Additional fields:
1) Add a new 'additional field', visit:
/cgi-bin/koha/admin/additional-fields.pl
2) Click 'subscription' and '+ New field'. Enter a 'name' and hit 'save'.

Serials:
1) Add a new serial, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Put a biblionumber in the 'record' field, i.e. '112'. Press 'next' and click 'ok' on the alert box
3) Fill all the required fields and click 'test prediction'
4) Input something in the additional field created previously.
5) Click 'save subscription'. Notice the additional field is as expected.
6) Repeat steps 1-5 to create a second serial.

Batch edit:
1) Visit serials and hit the 'Search' button:
/cgi-bin/koha/serials/serials-home.pl
2) Click the 2 checkboxes for the 2 serials we created previously and click the new link that pops up 'edit selected serials'.
3) Click 'Save' without changing anything.
4) Go back to either of the serials, notice the value for the additional field is gone. Visit:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=1
Comment 1 Pedro Amorim 2023-10-17 09:30:45 UTC
Created attachment 157221 [details] [review]
Bug 35073: Rename additional_fields to available_additional_fields

'additional_fields' is ambiguous and in other places we name this available_additional_fields instead. Do the same here.
Comment 2 Pedro Amorim 2023-10-17 09:30:48 UTC
Created attachment 157222 [details] [review]
Bug 35073: Default to existing value if there is one

For values that dont exist in the batch edit submission, i.e. UI says 'No change', we default to existing value if there is one.

Test plan:
Preparation - Additional fields:
1) Add a new 'additional field', visit:
/cgi-bin/koha/admin/additional-fields.pl
2) Click 'subscription' and '+ New field'. Enter a 'name' and hit 'save'.

Serials:
1) Add a new serial, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Put a biblionumber in the 'record' field, i.e. '112'. Press 'next' and click 'ok' on the alert box
3) Fill all the required fields and click 'test prediction'
4) Input something in the additional field created previously.
5) Click 'save subscription'. Notice the additional field is as expected.
6) Repeat steps 1-5 to create a second serial.

Batch edit:
1) Visit serials and hit the 'Search' button:
/cgi-bin/koha/serials/serials-home.pl
2) Click the 2 checkboxes for the 2 serials we created previously and click the new link that pops up 'edit selected serials'.
3) Click 'Save' without changing anything.
4) Go back to either of the serials, notice the value for the additional field is unchanged. Visit:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=1
Comment 3 Pedro Amorim 2023-10-17 09:30:51 UTC
Created attachment 157223 [details] [review]
Bug 35073: perltidy subscription-batchedit.pl

git show -w <this_patch_hash>
Comment 4 Katrin Fischer 2023-10-29 13:39:47 UTC
This is a data loss bug, marking as major.
Comment 5 Katrin Fischer 2023-10-29 13:42:30 UTC
Created attachment 158038 [details] [review]
Bug 35073: Rename additional_fields to available_additional_fields

'additional_fields' is ambiguous and in other places we name this available_additional_fields instead. Do the same here.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2023-10-29 13:42:33 UTC
Created attachment 158039 [details] [review]
Bug 35073: Default to existing value if there is one

For values that dont exist in the batch edit submission, i.e. UI says 'No change', we default to existing value if there is one.

Test plan:
Preparation - Additional fields:
1) Add a new 'additional field', visit:
/cgi-bin/koha/admin/additional-fields.pl
2) Click 'subscription' and '+ New field'. Enter a 'name' and hit 'save'.

Serials:
1) Add a new serial, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Put a biblionumber in the 'record' field, i.e. '112'. Press 'next' and click 'ok' on the alert box
3) Fill all the required fields and click 'test prediction'
4) Input something in the additional field created previously.
5) Click 'save subscription'. Notice the additional field is as expected.
6) Repeat steps 1-5 to create a second serial.

Batch edit:
1) Visit serials and hit the 'Search' button:
/cgi-bin/koha/serials/serials-home.pl
2) Click the 2 checkboxes for the 2 serials we created previously and click the new link that pops up 'edit selected serials'.
3) Click 'Save' without changing anything.
4) Go back to either of the serials, notice the value for the additional field is unchanged. Visit:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=1

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2023-10-29 13:42:36 UTC
Created attachment 158040 [details] [review]
Bug 35073: perltidy subscription-batchedit.pl

git show -w <this_patch_hash>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Pedro Amorim 2023-10-30 09:12:37 UTC
Cool! Thanks Katrin!
Comment 9 Victor Grousset/tuxayo 2023-11-01 21:12:23 UTC
Created attachment 158213 [details] [review]
Bug 35073: Rename additional_fields to available_additional_fields

'additional_fields' is ambiguous and in other places we name this available_additional_fields instead. Do the same here.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 10 Victor Grousset/tuxayo 2023-11-01 21:12:25 UTC
Created attachment 158214 [details] [review]
Bug 35073: Default to existing value if there is one

For values that dont exist in the batch edit submission, i.e. UI says 'No change', we default to existing value if there is one.

Test plan:
Preparation - Additional fields:
1) Add a new 'additional field', visit:
/cgi-bin/koha/admin/additional-fields.pl
2) Click 'subscription' and '+ New field'. Enter a 'name' and hit 'save'.

Serials:
1) Add a new serial, visit:
/cgi-bin/koha/serials/subscription-add.pl
2) Put a biblionumber in the 'record' field, i.e. '112'. Press 'next' and click 'ok' on the alert box
3) Fill all the required fields and click 'test prediction'
4) Input something in the additional field created previously.
5) Click 'save subscription'. Notice the additional field is as expected.
6) Repeat steps 1-5 to create a second serial.

Batch edit:
1) Visit serials and hit the 'Search' button:
/cgi-bin/koha/serials/serials-home.pl
2) Click the 2 checkboxes for the 2 serials we created previously and click the new link that pops up 'edit selected serials'.
3) Click 'Save' without changing anything.
4) Go back to either of the serials, notice the value for the additional field is unchanged. Visit:
/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=1

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 11 Victor Grousset/tuxayo 2023-11-01 21:12:28 UTC
Created attachment 158215 [details] [review]
Bug 35073: perltidy subscription-batchedit.pl

git show -w <this_patch_hash>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 12 Victor Grousset/tuxayo 2023-11-01 21:12:42 UTC
Works, makes sense, QA script happy, code looks good, passing QA :)
Comment 13 Tomás Cohen Arazi 2023-11-03 15:06:15 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 14 Fridolin Somers 2023-11-10 02:07:39 UTC
Pushed to 23.05.x for 23.05.06
Comment 15 Pedro Amorim 2023-11-14 14:50:16 UTC
Nice work everyone!

Pushed to 22.11.x for next release