Steps to Reproduce: 1. Login to Staff Site. 2. Go to Course Reserves 3. Create Course 4. Add Reserve 5. Go to item added (delete item/record) 6. Refresh Course (see no items attached) 7. Delete Course 8. See course still listed in the courses (Not deleted) I tested on 3.18.5 and 3.19.00.016 When deleting an item/record it does not remove the link from the course reserves, making it so you cannot remove the course even though it shows no items attached.
I believe it is deleting the item from course_items per the CASCADE DELETE in the Model, however the http://schema.koha-community.org/tables/course_reserves.html course_reserves table is not being cleaned up via a cascade delete (No contraint defined) course_reserves.ci_id -> course_items.ci_id
Kyle, I think it makes sense to add this constraint, do you agree?
(In reply to Jonathan Druart from comment #2) > Kyle, I think it makes sense to add this constraint, do you agree? Absolutely!
Created attachment 41335 [details] [review] Bug 14205: Deleting an Item/Record does not remove link to course reserve A constraint is missing on the course_reserves.ci_id field. This patch adds it and removes orphan rows. Test plan: 0/ Don't apply the patch 1/ Login to Staff Site. 2/ Go to Course Reserves 3/ Create Course 4/ Add Reserve 5/ Go to item added (delete item/record) 6/ Refresh Course (see no items attached) 7/ Delete Course 8/ See course still listed in the courses (Not deleted) 9/ Apply the patch and execute the updatedatabase entry. 10/ Delete the Course Note that the course has correctly been removed.
Created attachment 41390 [details] [review] Bug 14205: Deleting an Item/Record does not remove link to course reserve A constraint is missing on the course_reserves.ci_id field. This patch adds it and removes orphan rows. Test plan: 0/ Don't apply the patch 1/ Login to Staff Site. 2/ Go to Course Reserves 3/ Create Course 4/ Add Reserve 5/ Go to item added (delete item/record) 6/ Refresh Course (see no items attached) 7/ Delete Course 8/ See course still listed in the courses (Not deleted) 9/ Apply the patch and execute the updatedatabase entry. 10/ Delete the Course Note that the course has correctly been removed. NOTE: Make sure to set the UseCourseReserves system preference to test. Tested before (problem existed) and after (problem solved) update. Dropped DB, web installed, and put in dummy data and retested. Problem solved. Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Created attachment 42190 [details] [review] [PASSED QA] Bug 14205: Deleting an Item/Record does not remove link to course reserve A constraint is missing on the course_reserves.ci_id field. This patch adds it and removes orphan rows. Test plan: 0/ Don't apply the patch 1/ Login to Staff Site. 2/ Go to Course Reserves 3/ Create Course 4/ Add Reserve 5/ Go to item added (delete item/record) 6/ Refresh Course (see no items attached) 7/ Delete Course 8/ See course still listed in the courses (Not deleted) 9/ Apply the patch and execute the updatedatabase entry. 10/ Delete the Course Note that the course has correctly been removed. NOTE: Make sure to set the UseCourseReserves system preference to test. Tested before (problem existed) and after (problem solved) update. Dropped DB, web installed, and put in dummy data and retested. Problem solved. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 42221 [details] [review] Bug 14205: (RM followup) DBIx updates Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Patch pushed to master. Thanks Jonathan!
Could this be back ported to 3.18?
(In reply to Tom Misilo from comment #9) > Could this be back ported to 3.18? CCing RM 3.20 and 3.18
I'll give it a try on 3.18.
Pushed to 3.18.x will be in 3.18.11. If someone wouldn't mind checking over the 3.18 branch with these, it was my first go at updating the schema files and I'd appreciate someone confirming that I've done it correctly.
(Also leaving this 'pushed to master' to flag it for 3.20) Liz
Pushed to 3.20.x will be in 3.20.4
Thank you. It is much appreciated!
Note that there is a failure when updating from 3.18 to 3.20: DBD::mysql::db do failed: Duplicate entry '1-self_checkout' for key 'PRIMARY' at /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl line 10614. Upgrade to 3.20.03.003 done (Bug 14298: AutoSelfCheckID user should only be able to access SCO ) see https://lists.katipo.co.nz/pipermail/koha/2016-January/044539.html
Sorry, c/p the wrong error: DBD::mysql::db do failed: Can't create table 'koha_library.#sql-4b9_42' (errno: 121) at /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl line 10584. Upgrade to 3.20.03.001 done (Bug 14205: Deleting an Item/Record does not remove link to course reserve)