Bug 22722

Summary: Deleting a library leaves the letters and shows them belonging to "All libraries"
Product: Koha Reporter: paxed <pasi.kallinen>
Component: NoticesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: katrin.fischer, rogan.hamby
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description paxed 2019-04-17 07:16:31 UTC
When you delete a library, any notices or slips belonging to it are not deleted.

If there are any letters for a library which does not exist, the Notices tool shows the letter as belonging to "All libraries". This could lead to problems, when an admin sees two identical lines in the tool, and then deletes the one actually belonging to all libraries.
Comment 1 Katrin Fischer 2019-04-17 07:27:57 UTC
Probably a missing FK?
Comment 2 Rogan Hamby 2019-07-05 19:40:17 UTC
There is definitely a missing foreign key.  Right now with the sample data that is loaded if you have a test system letter entries have an empty space to get around the NOT NULL constraint.  

It's fairly straight forward to add the FK but (and I ask this as someone new to looking to contribute more to Koha) how does the community view adding this?  It would break the sample data and obviously need to be taken into account for upgrade scripts.
Comment 3 Katrin Fischer 2023-09-23 22:36:16 UTC
I think it doesn't necessarily break things, we can have an FK that allows NULL - but I guess cleaning up the old left over data might require some warning?