Currently Koha will delete a biblio record if there are existent serial subscriptions and patron holds. 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 holds or subscriptions and try again).
Here is a report that will show you bibs that have no items, but have orphan holds. To delete the holds (or notify patrons that the hold is being deleted due to no items in the collection), you will need to create a dummy item to see the holds. SELECT DISTINCT biblio.biblionumber, biblio.title FROM biblio LEFT JOIN items ON biblio.biblionumber = items.biblionumber LEFT JOIN reserves ON biblio.biblionumber = reserves.biblionumber WHERE items.itemnumber IS NULL and reserves.borrowernumber IS NOT NULL
btw that report was written by Jared Camins of ByWater Solutions.
Any ideas on how to fix this issue? Seems like it would be a big deal to most libraries. Nicole
as extra gravy, it would be cool if when you deleted a bib that has holds on it, an email was sent to the patrons with holds saying "You had placed a hold on <title>. This item has been removed from the catalog, and so we are canceling your hold. Please contact your local library for help getting this item either from our system or other methods of ILL."
I am working on a fix for this, implementation will be Koha will refuse to delete a biblio with holds or a serial subscription attached, and report that you need to deal with those first. Then the library can decide what they want to do.
Currently, we just delete the subscriptions silently # We delete attached subscriptions my $subscriptions = &C4::Serials::GetFullSubscriptionsFromBiblionumber($biblionumber); foreach my $subscription (@$subscriptions) { &C4::Serials::DelSubscription( $subscription->{subscriptionid} ); } It doesnt check for holds at all.
This is still an issue on current master.
*** Bug 1959 has been marked as a duplicate of this bug. ***
This is still an issue it seems. Also i think if what we do now is to delete the subscription silently, it's not so bad : what should happen in my opinion is that the user whould be warned that his action will also affect X subscirptions. But if that is what they want to do then it's a lot more simple to just delete the biblio than to go through all the subsriptions first, and then back to the biblio. So i would say, on the subscription side, just add a warning. On the holds side, well that's a bit more complicated ;)
Created attachment 14959 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion.
Created attachment 14965 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion. Signed-off-by: Liz Rea <liz@catalyst.net.nz> Tested all scenarios - works in all instances. Thanks, this is a longstanding bug.
QA comments: The patch works great but I have 3 small remarks: 1/ the cat-toolbar include file is included in 2 others tt files (catalogue/labeledMARCdetail.tt and catalogue/imageviewer.tt) 2/ instead of adding a new id "disabled2", it would be better to create a class ? 3/ qa tools complains: * koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc FAIL forbidden patterns FAIL The patch introduces a forbidden pattern: simple-quote string (62) The patch introduces a forbidden pattern: tabulation character (36) The patch introduces a forbidden pattern: simple-quote string (37) The patch introduces a forbidden pattern: simple-quote string (60) The patch introduces a forbidden pattern: simple-quote string (35) The patch introduces a forbidden pattern: simple-quote string (39) Not blocker, it is not introduced with this patch. Marked as Failed QA for 1.
(In reply to comment #12) > QA comments: > 2/ instead of adding a new id "disabled2", it would be better to create a > class ? Hum... forget that. It does not work
(In reply to comment #13) > (In reply to comment #12) > > QA comments: > > 2/ instead of adding a new id "disabled2", it would be better to create a > > class ? > > Hum... forget that. It does not work Yeah, I spent a good amount of time trying to just use a class, but no luck. That was the only way to accomplish the correct behavior.
Created attachment 14974 [details] [review] Bug 5790 - Prevent deletion of records with holds - QA Followup
Created attachment 14975 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion. Signed-off-by: Liz Rea <liz@catalyst.net.nz> Tested all scenarios - works in all instances. Thanks, this is a longstanding bug.
Created attachment 14976 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion.
Removed Liz's SO, as the patch has been modified. Liz, could you retest this new patch?
Hi Kyle, I think we will also want to check for existing orders (checkouts, holds, subscriptions, orders). In acquisitions you can delete records when none of those conditions is met - maybe the code could be reused? Haven't looked at the code, just wanted to leave a short note.
(In reply to comment #19) > Hi Kyle, > > I think we will also want to check for existing orders (checkouts, holds, > subscriptions, orders). In acquisitions you can delete records when none of > those conditions is met - maybe the code could be reused? > > Haven't looked at the code, just wanted to leave a short note. This code probably wouldn't help too much for those cases, but they would not be difficult to implement anyway.
Yeah, this looks like a nice fix! As Katrin said the problem exists in a few other places. This bug describes the problem with orders in acquisitions : http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5781 Ideally checkouts and subscriptions should also be dealt with.
Gah!
Created attachment 15029 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion.
Created attachment 15042 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion.
Created attachment 15043 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion.
Created attachment 15044 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion. Signed-off-by: Liz Rea <liz@catalyst.net.nz> Passes tests - do note that it was a design decision to leave the delete links clickable even though they are grey. The reasoning is that librarians will want to be able to know *why* they cannot delete a given item or bib - I like this.
I got an error : Undefined subroutine &main::GetReservesFromBiblionumber called at /home/koha/src/catalogue/moredetail.pl line 218. + Please fix the simple-quote string: * koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc FAIL forbidden patterns FAIL The patch introduces a forbidden pattern: simple-quote string (43) Marked as Failed QA.
Created attachment 15054 [details] [review] Bug 5790 - Prevent deletion of records with holds - QA Followup
Created attachment 15119 [details] [review] Bug 5790 - Prevent deletion of records with holds - QA Followup Signed-off-by: Liz Rea <liz@catalyst.net.nz> fixes qa concerns, feature still works
Now the feature is integrated on all pages where the catalogue toolbar is displayed. Marked as Passed QA.
Created attachment 15128 [details] [review] Bug 5790 - Prevent deletion of records with holds Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion. Signed-off-by: Liz Rea <liz@catalyst.net.nz> Passes tests - do note that it was a design decision to leave the delete links clickable even though they are grey. The reasoning is that librarians will want to be able to know *why* they cannot delete a given item or bib - I like this. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 15129 [details] [review] Bug 5790 - Prevent deletion of records with holds - QA Followup Signed-off-by: Liz Rea <liz@catalyst.net.nz> fixes qa concerns, feature still works Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This patch has been pushed to master. The patch does not address the problem with subscriptions, so I created bug 9565. A fix for that bug would be welcomed.
Does not apply to 3.10.x please submit a new patch for 3.10.x if it is needed
Created attachment 15242 [details] [review] Bug 5790 - Prevent deletion of records with holds [ 3.10.x ] Test Plan: 1) Apply patch 2) Create a record 3) Create an item for the record 3) Place a hold on the bib 4) Attempt to 'Delete all items', you should recieve an error message stating to delete all holds before deleting all items. Also, it is possible to get into a situation where a record has holds but no items. In this situation, it is not possible to view/delete the holds without adding an item back to the record. In this case, attempting to delete the bib causes a warning, but does not prevent deletion. Signed-off-by: Liz Rea <liz@catalyst.net.nz> Passes tests - do note that it was a design decision to leave the delete links clickable even though they are grey. The reasoning is that librarians will want to be able to know *why* they cannot delete a given item or bib - I like this. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 15243 [details] [review] Bug 5790 - Prevent deletion of records with holds - QA Followup [ 3.10.x ] Signed-off-by: Liz Rea <liz@catalyst.net.nz> fixes qa concerns, feature still works Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Just updating for myself, so I push it to stable.
Pushed to 3.10.x will be in 3.10.6