Bug 37115

Summary: Add the option to delete linked serials when deleting items
Product: Koha Reporter: Matt Blenkinsop <matt.blenkinsop>
Component: SerialsAssignee: Matt Blenkinsop <matt.blenkinsop>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, koha, martin.aubeut, nathalie.savarit
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 37116    
Attachments: Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Add unit tests
Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Add unit tests
Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Add unit tests
Bug 37115: Delete linked serial when deleting a single item
Bug 37115: Batch delete linked serials
Bug 37115: Add unit tests

Description Matt Blenkinsop 2024-06-18 13:44:34 UTC

    
Comment 1 Matt Blenkinsop 2024-06-18 13:57:48 UTC
Created attachment 167847 [details] [review]
Bug 37115: Delete linked serial when deleting a single item
Comment 2 Matt Blenkinsop 2024-06-18 13:57:50 UTC
Created attachment 167848 [details] [review]
Bug 37115: Batch delete linked serials
Comment 3 Nathalie SAVARIT 2024-06-19 12:28:29 UTC
OK for deleting a single item and linked serial.
KO for batch delete linked serials. Items are deleted but not linked serials.
Comment 4 Matt Blenkinsop 2024-06-26 10:51:10 UTC
Created attachment 168133 [details] [review]
Bug 37115: Delete linked serial when deleting a single item
Comment 5 Matt Blenkinsop 2024-06-26 10:51:12 UTC
Created attachment 168134 [details] [review]
Bug 37115: Batch delete linked serials
Comment 6 Martin AUBEUT 2024-06-26 16:37:14 UTC
Hello Matt. Thanks for your work and your interest in the serial matters ! Can you provide a test plan ? It will be better for a correct sign off. Thanks.
Comment 7 Matt Blenkinsop 2024-07-02 15:14:48 UTC
Created attachment 168373 [details] [review]
Bug 37115: Delete linked serial when deleting a single item
Comment 8 Matt Blenkinsop 2024-07-02 15:14:51 UTC
Created attachment 168374 [details] [review]
Bug 37115: Batch delete linked serials
Comment 9 Nathalie SAVARIT 2024-07-04 07:15:12 UTC
Here's a test plan for 'Delete linked serial when deleting a single item' : 

- Add a new subscription to a serial notice
(with option 'create an item record')
- Receive one issue and create the item linked
- Back to bibliographic record
- Edit item - Action - Delete
- Tick the box 'delete serial issues linked to item' and confirm
- Back to subscription : the issue linked to item doesn't exist any more
Comment 10 Nathalie SAVARIT 2024-07-04 07:20:53 UTC
Hello Matt. 
I confirm that the patch 'deleting a single item and linked serial' works.
But the second 'Batch deleted linked serials' does not meet expectations. Issues are still presents after the items have been deleted.
Comment 11 Nathalie SAVARIT 2024-07-04 07:26:04 UTC
Here's a test plan for 'Batch delete linked serials' : 

- Add a new subscription to a serial record
(with option 'create an item record')
- Receive several issues and create the items linked
- Back to bibliographic record
- Select several items
- Click to 'Delete selected items'
- Tick the box 'delete serial issues linked to items' and confirm
- Back to subscription : the issues linked to items should no longer exist
Comment 12 Matt Blenkinsop 2024-07-04 11:51:46 UTC
Created attachment 168495 [details] [review]
Bug 37115: Delete linked serial when deleting a single item

Test plan:
- Add a new subscription to a serial notice (with the option 'create an item record' selected)
- Receive one issue and create the linked item
- Return to the bibliographic record
- Edit item - Action - Delete
- Tick the box 'delete serial issues linked to item' and confirm
- The item should still be deleted correctly
- Back to subscription : the issue linked to the item doesn't exist any more
Comment 13 Matt Blenkinsop 2024-07-04 11:51:49 UTC
Created attachment 168496 [details] [review]
Bug 37115: Batch delete linked serials

Test plan:
- Add a new subscription to a serial record (with the option 'create an item record' selected)
- Receive several issues and create the linked items
- Return to the bibliographic record
- Select several items
- Click to 'Delete selected items'
- Tick the box 'delete serial issues linked to items' and confirm
- The items should be deleted correctly
- Back to subscription : the issues linked to items should no longer exist
Comment 14 Matt Blenkinsop 2024-07-04 11:51:52 UTC
Created attachment 168497 [details] [review]
Bug 37115: Add unit tests

prove t/db_dependent/Koha/Item.t
prove t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t
Comment 15 Matt Blenkinsop 2024-09-09 15:39:19 UTC
Created attachment 171208 [details] [review]
Bug 37115: Delete linked serial when deleting a single item

Test plan:
- Add a new subscription to a serial notice (with the option 'create an item record' selected)
- Receive one issue and create the linked item
- Return to the bibliographic record
- Edit item - Action - Delete
- Tick the box 'delete serial issues linked to item' and confirm
- The item should still be deleted correctly
- Back to subscription : the issue linked to the item doesn't exist any more
Comment 16 Matt Blenkinsop 2024-09-09 15:39:21 UTC
Created attachment 171209 [details] [review]
Bug 37115: Batch delete linked serials

Test plan:
- Add a new subscription to a serial record (with the option 'create an item record' selected)
- Receive several issues and create the linked items
- Return to the bibliographic record
- Select several items
- Click to 'Delete selected items'
- Tick the box 'delete serial issues linked to items' and confirm
- The items should be deleted correctly
- Back to subscription : the issues linked to items should no longer exist
Comment 17 Matt Blenkinsop 2024-09-09 15:39:24 UTC
Created attachment 171210 [details] [review]
Bug 37115: Add unit tests

prove t/db_dependent/Koha/Item.t
prove t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t
Comment 18 Jonathan Druart 2024-09-10 07:16:22 UTC
Early QA: this is going to conflict with bug 37637.

Saying that because you are using a bad pattern: using a TT plugin to retrieve additional info from items (it will cause 1 additional fetch + a JOIN per item).

With bug 37637 you will be able to retrieve this information from the REST API and get rid of this TT plugin.
  `api/v1/swagger/definitions/item.yaml:  serial_item`

The downside is that it is a non-trivial change and you don't know when it will be pushed...
Comment 19 Nathalie SAVARIT 2024-09-12 08:53:38 UTC
Hi Matthew. the link "Delete >>>>>>> Bug 37115: Delete linked serial when deleting a single item" is inactive. 
And for batch delete, items are deleted but not linked serials.
Comment 20 Matt Blenkinsop 2024-09-24 14:08:06 UTC
Created attachment 171938 [details] [review]
Bug 37115: Delete linked serial when deleting a single item

Test plan:
- Add a new subscription to a serial notice (with the option 'create an item record' selected)
- Receive one issue and create the linked item
- Return to the bibliographic record
- Edit item - Action - Delete
- Tick the box 'delete serial issues linked to item' and confirm
- The item should still be deleted correctly
- Back to subscription : the issue linked to the item doesn't exist any more
Comment 21 Matt Blenkinsop 2024-09-24 14:08:09 UTC
Created attachment 171939 [details] [review]
Bug 37115: Batch delete linked serials

Test plan:
- Add a new subscription to a serial record (with the option 'create an item record' selected)
- Receive several issues and create the linked items
- Return to the bibliographic record
- Select several items
- Click to 'Delete selected items'
- Tick the box 'delete serial issues linked to items' and confirm
- The items should be deleted correctly
- Back to subscription : the issues linked to items should no longer exist
Comment 22 Matt Blenkinsop 2024-09-24 14:08:12 UTC
Created attachment 171940 [details] [review]
Bug 37115: Add unit tests

prove t/db_dependent/Koha/Item.t
prove t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t
Comment 23 Matt Blenkinsop 2024-09-24 14:34:33 UTC
(In reply to Jonathan Druart from comment #18)
> Early QA: this is going to conflict with bug 37637.
> 
> Saying that because you are using a bad pattern: using a TT plugin to
> retrieve additional info from items (it will cause 1 additional fetch + a
> JOIN per item).
> 
> With bug 37637 you will be able to retrieve this information from the REST
> API and get rid of this TT plugin.
>   `api/v1/swagger/definitions/item.yaml:  serial_item`
> 
> The downside is that it is a non-trivial change and you don't know when it
> will be pushed...

I've fixed the patches and reattached them using the TT plugin so that Nathalie can test them to check that the functionality is what she is expecting. Once we are happy with the concept I will look to rebase on 37637 and see what assistance is needed on that bug to help get this one through
Comment 24 Boubacar OUATTARA 2024-10-24 09:23:40 UTC
Created attachment 173256 [details] [review]
Bug 37115: Delete linked serial when deleting a single item

Test plan:
- Add a new subscription to a serial notice (with the option 'create an item record' selected)
- Receive one issue and create the linked item
- Return to the bibliographic record
- Edit item - Action - Delete
- Tick the box 'delete serial issues linked to item' and confirm
- The item should still be deleted correctly
- Back to subscription : the issue linked to the item doesn't exist any more

Signed-off-by: Boubacar OUATTARA <boubacar.ouattara@biblibre.com>
Comment 25 Boubacar OUATTARA 2024-10-24 09:23:43 UTC
Created attachment 173257 [details] [review]
Bug 37115: Batch delete linked serials

Test plan:
- Add a new subscription to a serial record (with the option 'create an item record' selected)
- Receive several issues and create the linked items
- Return to the bibliographic record
- Select several items
- Click to 'Delete selected items'
- Tick the box 'delete serial issues linked to items' and confirm
- The items should be deleted correctly
- Back to subscription : the issues linked to items should no longer exist

Signed-off-by: Boubacar OUATTARA <boubacar.ouattara@biblibre.com>
Comment 26 Boubacar OUATTARA 2024-10-24 09:23:46 UTC
Created attachment 173258 [details] [review]
Bug 37115: Add unit tests

prove t/db_dependent/Koha/Item.t
prove t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t

Signed-off-by: Boubacar OUATTARA <boubacar.ouattara@biblibre.com>