Bug 16872

Summary: You should not be allowed to delete a record with open orders attached
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: AcquisitionsAssignee: Kyle M Hall (khall) <kyle>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, cunha, jonathan.druart, jzairo, severine.queune, veron
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10869
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10758
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Nick Clemens (kidclamp) 2016-07-07 16:23:05 UTC
Bug 10869 and Bug 10758 try to deal with the fallout from deleting a record with an order attached. I think, rather than fixing the order end we should prevent the deletion of the record in the first place to avoid causing an issue.

This case also affects EDI ordering as item cannot be received when a title has been deleted
Comment 1 Jonathan Druart 2016-08-19 10:18:59 UTC
Nick,
There is already a big warning when you try to delete a record used in orders.
I do not understand why we should block the user to do it.
Comment 2 Nick Clemens (kidclamp) 2016-08-22 17:09:27 UTC
(In reply to Jonathan Druart from comment #1)
> Nick,
> There is already a big warning when you try to delete a record used in
> orders.
> I do not understand why we should block the user to do it.

Hmm...yes you do get a big warning, I guess I still find it bothersome that the user can't fix it once they have made this decision, maybe instead of preventing delete we should add a method for reattaching the order to a record?

Also, if you 'Delete items in a batch' and choose 'Delete record if no items remain' you do not receive the warning
Comment 3 Katrin Fischer 2016-08-29 05:59:41 UTC
Does it warn on the cataloguing side too? I have had libraries deleting records who are 'on order' by accident a few times - you will need SQL then to clean it up.
Comment 4 Kyle M Hall (khall) 2017-11-13 12:00:09 UTC
I don't think a warning is enough. We should block users from deleting records with open orders attached because it creates a situation where manual changes to the database must be done to repair orders where the record has been deleted.

Consider that a library may have multiple divisions, where one librarian is "cleaning up" records by deleting them, and the other is ordering items and keeps finding his or her on order records are suddenly deleted. Depending on the size of the library system, it could take the librarian quite a while to find out why those records are suddenly gone.

(In reply to Jonathan Druart from comment #1)
> Nick,
> There is already a big warning when you try to delete a record used in
> orders.
> I do not understand why we should block the user to do it.
Comment 5 Kyle M Hall (khall) 2017-11-13 12:01:23 UTC
Perhaps we need a new user permission or system preference to prevent deletion of records with open orders on them.
Comment 6 Katrin Fischer 2017-12-05 06:53:38 UTC
I think it's ok to block users from deleting and ask them to cancel the orders first. Maybe with a link to the order in acq if they have the right permission? 

Separate problem, but related to deleting the records: Once you deleted the record the cancelled order remains visible, but has no title anymore. That's not helpful and we can't delete cancelled orders either. The whole topic of how to handle deletes is something we should tackle.
Comment 7 Andrew Fuerste-Henry 2021-11-15 19:51:11 UTC

*** This bug has been marked as a duplicate of bug 27893 ***
Comment 8 Andrew Fuerste-Henry 2021-11-15 19:51:38 UTC
Marking this as a duplicate of a newer bug as the newer bug has a little work on it already.