Bug 9565 - Deleting a record should alert or fail if there are current subscriptions
Summary: Deleting a record should alert or fail if there are current subscriptions
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: marion.durand
QA Contact: Jonathan Druart
URL:
Keywords: Manual
Depends on: 5790
Blocks:
  Show dependency treegraph
 
Reported: 2013-02-07 12:33 UTC by Jared Camins-Esakov
Modified: 2021-12-23 00:41 UTC (History)
15 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
This change prevents the deletion of records with current serial subscriptions. Selecting "Delete record" when there are existing subscriptions no longer deletes the record and subscription, and adds an alert box "[Count] subscription(s) are attached to this record. You must delete all subscriptions before deleting this record.". It also: - adds a "Subscriptions" column in the batch deletion records tool with the number of subscriptions and a link to the search page with all the subscriptions for the record, and - adds a button in the toolbar to enable selecting only records without subscriptions.
Version(s) released in:
22.05.00,21.11.01,21.05.08


Attachments
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions (2.11 KB, patch)
2020-11-13 09:55 UTC, Timothy Alexis Vass
Details | Diff | Splinter Review
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions (2.25 KB, patch)
2020-11-13 10:21 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions (2.45 KB, patch)
2021-10-25 11:37 UTC, marion.durand
Details | Diff | Splinter Review
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions (2.49 KB, patch)
2021-10-26 11:52 UTC, marion.durand
Details | Diff | Splinter Review
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions (2.55 KB, patch)
2021-11-27 00:33 UTC, Samu Heiskanen
Details | Diff | Splinter Review
Bug 9565: (follow-up) Adapt batch record deletion tool (5.81 KB, patch)
2021-12-02 13:02 UTC, marion.durand
Details | Diff | Splinter Review
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions (2.26 KB, patch)
2021-12-02 13:52 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions (2.61 KB, patch)
2021-12-02 13:52 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 9565: (follow-up) Adapt batch record deletion tool (5.86 KB, patch)
2021-12-02 13:52 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions (2.34 KB, patch)
2021-12-06 13:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions (2.68 KB, patch)
2021-12-06 13:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9565: (follow-up) Adapt batch record deletion tool (5.93 KB, patch)
2021-12-06 13:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9565: Use Koha::Biblio (2.27 KB, patch)
2021-12-06 13:45 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9565: Use Koha::Biblio (rebase for 21.05.x) (2.23 KB, patch)
2021-12-20 16:03 UTC, marion.durand
Details | Diff | Splinter Review
Bug 9565: (follow-up) Adapt batch record deletion tool (rebase for 21.05.x) (6.03 KB, patch)
2021-12-21 13:19 UTC, marion.durand
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2013-02-07 12:33:00 UTC
Currently Koha will delete a biblio record if there are existent serial subscription. It would be better if it either reported them out and asked for confirmation (It's ok that we delete these, right?) or failed outright with an error (Hey, there's still stuff here! Delete X subscriptions and try again).

This was previously described on bug 5790, but the patch there does not fix this problem, just the problem with holds.
Comment 1 Katrin Fischer 2019-04-27 22:54:21 UTC
Still valid.
Comment 2 Timothy Alexis Vass 2020-11-13 09:55:11 UTC
Created attachment 113589 [details] [review]
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions

Currently Koha will delete a biblio record if there are existent serial subscriptions.
This patch will prevent deleting the biblio until attached subscriptions are removed.

To test:
1) Add a subscription to a biblio, or check a biblio which has one attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Sign off.

Sponsored by: Lunds Universitetsbibliotek
Comment 3 Séverine Queune 2020-11-13 10:21:57 UTC
Created attachment 113591 [details] [review]
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions

Currently Koha will delete a biblio record if there are existent serial subscriptions.
This patch will prevent deleting the biblio until attached subscriptions are removed.

To test:
1) Add a subscription to a biblio, or check a biblio which has one attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 4 Victor Grousset/tuxayo 2020-11-29 12:29:31 UTC
Hi :)

> 4) Confirm that the 'Delete record' item is disabled in the list.

It's still possible to click "Delete record" despite it looking disabled. And the record & subscription will be deleted.
Comment 5 marion.durand 2021-10-25 11:37:47 UTC Comment hidden (obsolete)
Comment 6 marion.durand 2021-10-26 11:52:54 UTC
Created attachment 126905 [details] [review]
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions

Clicking on "Delete record" while there are existent subscriptions no
longer delete the record and the subscription. Instead an alert box
inform the user that he must delete all subscription before deleting the
record.

To test:
1) Add a subscription to a biblio, or check a biblio which has one
   attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Attempt to 'Delete record', you should recieve
   an error message stating to delete all subscriptions before
   deleting record.
6) Sign off.

Sponsored by: Lunds Universitetsbibliotek
Comment 7 Samu Heiskanen 2021-11-25 11:49:55 UTC
When you click "Delete record" it still asks: "Are you sure you want to delete this record?", though it won't really delete it even if you click ok.
Comment 8 marion.durand 2021-11-25 13:48:50 UTC
(In reply to Samu Heiskanen from comment #7)
> When you click "Delete record" it still asks: "Are you sure you want to
> delete this record?", though it won't really delete it even if you click ok.

Thank for testing the patch. I think you need to empty your browser cash for the second patch to take into effect.

I don't have this problem on my first setup but on my second I have seen it and emptying the cash of my browser (or restarting koha) solved the problem. 
Have you tried that ?
Comment 9 Samu Heiskanen 2021-11-25 14:16:59 UTC
I tried and now it works fine. Thanks for your advice.
Comment 10 Samu Heiskanen 2021-11-26 20:33:08 UTC Comment hidden (obsolete)
Comment 11 Samu Heiskanen 2021-11-27 00:33:50 UTC
Created attachment 128051 [details] [review]
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions

Clicking on "Delete record" while there are existent subscriptions no
longer delete the record and the subscription. Instead an alert box
inform the user that he must delete all subscription before deleting the
record.

To test:
1) Add a subscription to a biblio, or check a biblio which has one
   attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Attempt to 'Delete record', you should recieve
   an error message stating to delete all subscriptions before
   deleting record.
6) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Samu Heiskanen <samu.heiskanen@hypernova.fi>
Comment 12 Jonathan Druart 2021-12-01 14:38:24 UTC
Then you need to adjust the batch record deletion tool as well.
Comment 13 marion.durand 2021-12-02 09:55:20 UTC
I'm not sure what to do in batch record deletion as it is the same behavior as when there are attached items.

From a record page, it's impossible to delete the record if there is any item attached to it but it is still possible to delete it from batch record deletion.
Plus there is a reminder to warn the user that deleting the biblio will also delete attached subscription, holds and items (even if I can't find yet where in the code we delete the subscription)

Maybe we could add a column to show the user how many subscriptions are attached to the biblio (just as items holds and checkouts) and add the possibility to select without subscription (as for items and holds).

Should we block the deletion of biblio records with attached subscriptions ?
Comment 14 Jonathan Druart 2021-12-02 10:16:34 UTC
(In reply to marion.durand from comment #13)
> Maybe we could add a column to show the user how many subscriptions are
> attached to the biblio (just as items holds and checkouts) and add the
> possibility to select without subscription (as for items and holds).

Yes, that. It's what I was suggesting.
Comment 15 marion.durand 2021-12-02 10:24:39 UTC
Ok I'll do that. Thank you for answering so quickly
Comment 16 marion.durand 2021-12-02 13:02:04 UTC
Created attachment 128160 [details] [review]
Bug 9565: (follow-up) Adapt batch record deletion tool

Add a column "Subscriptions" to the batch deletion tools
Add a link on the number of subscription to the search page with all the subscriptions of the record
Add a button in the toolbar to select only biblio record without subscriptions

The changes are only on display
It is still possible to delete records that are attached to subscriptions from this tool (as it is possible for records with attached items)

To test:
1) Go to the batch record deletion (in tools)
2) Select a list of record numbers (select some with one or more subscription)
3) Click on Continue
4) Check that there is no column named "Subscription" and that there is no button "Select without subscription" in the toolbar
5) Apply patch
6) Repeat steps 1 to 3
7a) Check that there is a column named "Subscription" fill with the number of subscriptions attached to the record
7b) Check that the link in the subscriptions column send you to the search page with the subscriptions linked to this record
7c) Check that there is a button "Select without subscription" in the toolbar that selects record with no subscription attached
8) Sign off
Comment 17 PTFS Europe Sandboxes 2021-12-02 13:52:40 UTC
Created attachment 128163 [details] [review]
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions

Currently Koha will delete a biblio record if there are existent serial subscriptions.
This patch will prevent deleting the biblio until attached subscriptions are removed.

To test:
1) Add a subscription to a biblio, or check a biblio which has one attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Comment 18 PTFS Europe Sandboxes 2021-12-02 13:52:44 UTC
Created attachment 128164 [details] [review]
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions

Clicking on "Delete record" while there are existent subscriptions no
longer delete the record and the subscription. Instead an alert box
inform the user that he must delete all subscription before deleting the
record.

To test:
1) Add a subscription to a biblio, or check a biblio which has one
   attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Attempt to 'Delete record', you should recieve
   an error message stating to delete all subscriptions before
   deleting record.
6) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Samu Heiskanen <samu.heiskanen@hypernova.fi>

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Comment 19 PTFS Europe Sandboxes 2021-12-02 13:52:49 UTC
Created attachment 128165 [details] [review]
Bug 9565: (follow-up) Adapt batch record deletion tool

Add a column "Subscriptions" to the batch deletion tools
Add a link on the number of subscription to the search page with all the subscriptions of the record
Add a button in the toolbar to select only biblio record without subscriptions

The changes are only on display
It is still possible to delete records that are attached to subscriptions from this tool (as it is possible for records with attached items)

To test:
1) Go to the batch record deletion (in tools)
2) Select a list of record numbers (select some with one or more subscription)
3) Click on Continue
4) Check that there is no column named "Subscription" and that there is no button "Select without subscription" in the toolbar
5) Apply patch
6) Repeat steps 1 to 3
7a) Check that there is a column named "Subscription" fill with the number of subscriptions attached to the record
7b) Check that the link in the subscriptions column send you to the search page with the subscriptions linked to this record
7c) Check that there is a button "Select without subscription" in the toolbar that selects record with no subscription attached
8) Sign off

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Comment 20 Frank Hansen 2021-12-02 14:31:27 UTC
Signed off using sandbox
Comment 21 Jonathan Druart 2021-12-06 13:45:34 UTC
Created attachment 128278 [details] [review]
Bug 9565: Deleting a biblio should alert/fail if there are existent subscriptions

Currently Koha will delete a biblio record if there are existent serial subscriptions.
This patch will prevent deleting the biblio until attached subscriptions are removed.

To test:
1) Add a subscription to a biblio, or check a biblio which has one attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 22 Jonathan Druart 2021-12-06 13:45:39 UTC
Created attachment 128279 [details] [review]
Bug 9565: (follow-up) Deleting a biblio should alert/fail if there are existent subscriptions

Clicking on "Delete record" while there are existent subscriptions no
longer delete the record and the subscription. Instead an alert box
inform the user that he must delete all subscription before deleting the
record.

To test:
1) Add a subscription to a biblio, or check a biblio which has one
   attached already.
2) Remove all items if there are any.
3) Apply patch.
4) Confirm that the 'Delete record' item is disabled in the list.
5) Attempt to 'Delete record', you should recieve
   an error message stating to delete all subscriptions before
   deleting record.
6) Sign off.

Sponsored by: Lunds Universitetsbibliotek

Signed-off-by: Samu Heiskanen <samu.heiskanen@hypernova.fi>

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 23 Jonathan Druart 2021-12-06 13:45:43 UTC
Created attachment 128280 [details] [review]
Bug 9565: (follow-up) Adapt batch record deletion tool

Add a column "Subscriptions" to the batch deletion tools
Add a link on the number of subscription to the search page with all the subscriptions of the record
Add a button in the toolbar to select only biblio record without subscriptions

The changes are only on display
It is still possible to delete records that are attached to subscriptions from this tool (as it is possible for records with attached items)

To test:
1) Go to the batch record deletion (in tools)
2) Select a list of record numbers (select some with one or more subscription)
3) Click on Continue
4) Check that there is no column named "Subscription" and that there is no button "Select without subscription" in the toolbar
5) Apply patch
6) Repeat steps 1 to 3
7a) Check that there is a column named "Subscription" fill with the number of subscriptions attached to the record
7b) Check that the link in the subscriptions column send you to the search page with the subscriptions linked to this record
7c) Check that there is a button "Select without subscription" in the toolbar that selects record with no subscription attached
8) Sign off

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 24 Jonathan Druart 2021-12-06 13:45:49 UTC
Created attachment 128281 [details] [review]
Bug 9565: Use Koha::Biblio

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 25 Jonathan Druart 2021-12-06 13:48:16 UTC
Nice one Marion. I have attached a follow-up to use Koha::Biblio instead of subroutines from C4.

Also I am not sure the "without" links on top of the table are actually useful as it, I think they should work together: like you want to uncheck biblios that have items then those without subscriptions. Not considering blocker as it's the current behaviour.
Comment 26 Fridolin Somers 2021-12-11 07:15:54 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 27 Kyle M Hall 2021-12-17 13:40:14 UTC
Pushed to 21.11.x for 21.11.01
Comment 28 Andrew Fuerste-Henry 2021-12-17 20:07:29 UTC
Doesn't apply cleanly to 21.05. Please rebase if needed. Thanks!
Comment 29 marion.durand 2021-12-20 16:03:23 UTC
Created attachment 128764 [details] [review]
Bug 9565: Use Koha::Biblio (rebase for 21.05.x)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 30 marion.durand 2021-12-20 16:06:17 UTC Comment hidden (obsolete)
Comment 31 marion.durand 2021-12-21 13:19:45 UTC
Created attachment 128832 [details] [review]
Bug 9565: (follow-up) Adapt batch record deletion tool (rebase for 21.05.x)

Add a column "Subscriptions" to the batch deletion tools
Add a link on the number of subscription to the search page with all the subscriptions of the record
Add a button in the toolbar to select only biblio record without subscriptions

The changes are only on display
It is still possible to delete records that are attached to subscriptions from this tool (as it is possible for records with attached items)

To test:
1) Go to the batch record deletion (in tools)
2) Select a list of record numbers (select some with one or more subscription)
3) Click on Continue
4) Check that there is no column named "Subscription" and that there is no button "Select without subscription" in the toolbar
5) Apply patch
6) Repeat steps 1 to 3
7a) Check that there is a column named "Subscription" fill with the number of subscriptions attached to the record
7b) Check that the link in the subscriptions column send you to the search page with the subscriptions linked to this record
7c) Check that there is a button "Select without subscription" in the toolbar that selects record with no subscription attached
8) Sign off

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 32 Andrew Fuerste-Henry 2021-12-21 13:42:01 UTC
Pushed to 21.05.x for 21.05.08. Thanks!
Comment 33 Victor Grousset/tuxayo 2021-12-23 00:41:40 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.