Bug 5004

Summary: Do not block deletion of cities when instances exist in borrowers table
Product: Koha Reporter: Owen Leonard <oleonard>
Component: System AdministrationAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: normal    
Priority: PATCH-Sent (DO NOT USE) CC: chris, cnighswonger, gmcharlt
Version: Main   
Hardware: All   
OS: All   
URL: /cgi-bin/koha/admin/cities.pl?op=delete_confirm
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Proposed fix for HEAD
Proposed fix for roadtype.pl

Description Owen Leonard 2010-07-14 16:43:03 UTC
When you try to delete a city Koha does a check for entries in the borrowers table which match that city:

select count(*) as total from borrowers,cities where borrowers.city=cities.city_name and cityid=?

But why shouldn't it be possible to delete a city whether or not there are entries in borrowers? Nothing is preventing me from continuing to add patrons with that city manually, typing in the city details myself.
Comment 1 Owen Leonard 2010-08-16 19:30:32 UTC
Created attachment 2527 [details] [review]
Proposed fix for HEAD
Comment 2 Galen Charlton 2010-11-15 13:10:28 UTC
Signed off on patch.  I note that admin/roadtype.pl has the same issue.
Comment 3 Owen Leonard 2010-11-15 15:16:43 UTC
Created attachment 2757 [details] [review]
Proposed fix for roadtype.pl

Accompanying (but not dependent) patch for roadtype.pl

The road types interface didn't block deletion of road types in use, but the script included the same queries that cities.pl did, as if it intended to.
Comment 4 Chris Cormack 2010-11-18 20:53:57 UTC
Pushed, please test and close
Comment 5 Chris Nighswonger 2010-11-30 13:49:36 UTC
This bug has a fix which was committed to the 3.2.x branch and released in 3.2.1.

Please take time to update the status of this bug and mark it RESOLVED FIXED so that it may be closed.
Comment 6 MJ Ray (software.coop) 2010-12-09 15:10:20 UTC
This bug is mentioned in:
Fix for Bug 5004,	Don't block deletion of cities when instances exist in borrowers	table http://lists.koha-community.org/pipermail/koha-patches/2010-November/013013.html
Another bug 5004 fix,	this time for road types http://lists.koha-community.org/pipermail/koha-patches/2010-November/013016.html
Another bug 5004 fix,	this time for road types http://lists.koha-community.org/pipermail/koha-patches/2010-November/013028.html