To recreate: 1 - Browse to Administration ->Circulation and fines 2 - Add a rule with a number for 'Total checkouts allowed' 3 - check the db: select * from circulation_rules 4 - The rule should be there 5 - Delete the rule from the staff interface 6 - Check the DB 7 - The rule is not deleted
Created attachment 88489 [details] [review] Bug 22679: Delete related CirculationRules when Removing IssuingRule Unfortunately, the tables here can't use a foreign key as one table uses null where the other uses '*' This patchset alters the delete method so delete related rules. It is somewhat of a workaround until all the columns in issuingrules are moved to circulation_rules To test: 1 - Add some issuing rules in koha, making sure to set maxissueqty 2 - Check the DB: SELECT * FROM circulation_rules; 3 - note some circulation rules were created 4 - Delete your rules via the staff interface 5 - Check the DB, the circulation rules remain 6 - Apply patch 7 - Repeat 8 - Huzzah! The rules delete! 9 - Prove the tests, read the code
I think this is a good workaround. As we are removing issuingrules (I think Jonathan submitted patches to complete that already) I think we can live with this for a little.
Created attachment 88529 [details] [review] Bug 22679: Delete related CirculationRules when Removing IssuingRule Unfortunately, the tables here can't use a foreign key as one table uses null where the other uses '*' This patchset alters the delete method so delete related rules. It is somewhat of a workaround until all the columns in issuingrules are moved to circulation_rules To test: 1 - Add some issuing rules in koha, making sure to set maxissueqty 2 - Check the DB: SELECT * FROM circulation_rules; 3 - note some circulation rules were created 4 - Delete your rules via the staff interface 5 - Check the DB, the circulation rules remain 6 - Apply patch 7 - Repeat 8 - Huzzah! The rules delete! 9 - Prove the tests, read the code Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Created attachment 88567 [details] [review] Bug 22679: Delete related CirculationRules when Removing IssuingRule Unfortunately, the tables here can't use a foreign key as one table uses null where the other uses '*' This patchset alters the delete method so delete related rules. It is somewhat of a workaround until all the columns in issuingrules are moved to circulation_rules To test: 1 - Add some issuing rules in koha, making sure to set maxissueqty 2 - Check the DB: SELECT * FROM circulation_rules; 3 - note some circulation rules were created 4 - Delete your rules via the staff interface 5 - Check the DB, the circulation rules remain 6 - Apply patch 7 - Repeat 8 - Huzzah! The rules delete! 9 - Prove the tests, read the code Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Awesome work all! Pushed to master for 19.05
Bug with enhancement not in 18.11.x series.
See bug 18928 comment 37 for a follow-up on this, we should not delete all rules.
We should delete in a transaction and handle the returned value.