In the list of basket groups for a vendor there is a "delete" option for each basket group whether or not the basket group contains baskets. If you choose "delete" for a basket group containing a basket it will fail silently and an error will be logged: DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`aqbasket`, CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE) [for Statement "DELETE FROM aqbasketgroups WHERE id=?" with ParamValues: 0="3"] Since the template knows the number of baskets in a basket group it should be easy to hide or disable the delete button in those cases. It also would be nice to add a JavaScript confirmation before deleting a basket. Right now deletions are completed without any warning. Keep in mind the work being done in Bug 16038 and Bug 11708 when considering this one.
Created attachment 49897 [details] [review] Bug 16055: Do not allow basketgroup deletion unless empty If a basketgroup has basket attached, it should not be deletable. This patch just removes the Delete button from the interface if it cannot be deleted. When editing a basketgroup, the "Delete basket group" button is no longer displayed. Test plan: 1/ Create a basketgroup 2/ Attach 1+ baskets to this basketgroup 3/ Confirm you are not able to delete it 4/ Remove the baskets from this basketgroup 5/ Confirm you are able to delete it
(In reply to Owen Leonard from comment #0) > Keep in mind the work being done in Bug 16038 and Bug 11708 when considering > this one. One is blocked and the other one does not apply. Moreover this is a bug fix and it could be great to backport it. I think this patch should be pushed before the 2 others.
Created attachment 49925 [details] [review] [SIGNED-OFF] Bug 16055: Do not allow basketgroup deletion unless empty If a basketgroup has basket attached, it should not be deletable. This patch just removes the Delete button from the interface if it cannot be deleted. When editing a basketgroup, the "Delete basket group" button is no longer displayed. Test plan: 1/ Create a basketgroup 2/ Attach 1+ baskets to this basketgroup 3/ Confirm you are not able to delete it 4/ Remove the baskets from this basketgroup 5/ Confirm you are able to delete it Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Should we have icons on those buttons? If yes... please add on another bug :)
Created attachment 49932 [details] [review] [PASSED QA] Bug 16055: Do not allow basketgroup deletion unless empty If a basketgroup has basket attached, it should not be deletable. This patch just removes the Delete button from the interface if it cannot be deleted. When editing a basketgroup, the "Delete basket group" button is no longer displayed. Test plan: 1/ Create a basketgroup 2/ Attach 1+ baskets to this basketgroup 3/ Confirm you are not able to delete it 4/ Remove the baskets from this basketgroup 5/ Confirm you are able to delete it Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to Master - Should be in the May 2016 Release. Thanks!
Patch pushed to 3.22.x, will be in 3.22.6