Bug 16872 - You should not be allowed to delete a record with open orders attached
Summary: You should not be allowed to delete a record with open orders attached
Status: RESOLVED DUPLICATE of bug 27893
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Kyle M Hall (khall)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-07 16:23 UTC by Nick Clemens (kidclamp)
Modified: 2021-11-15 19:51 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.