Bug 9272

Summary: Plack goes into paroxysms of horror when faced with deleting an authorized value
Product: Koha Reporter: Jared Camins-Esakov <jcamins>
Component: Staff interfaceAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P5 - low CC: chris, elliott, gmcharlt, jonathan.druart, mirko
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 3309    
Attachments: Bug 9272: Eliminate error when deleting authorized value
Bug 9272: Eliminate error when deleting authorized value
Bug 9272: Eliminate error when deleting authorized value
Bug 9272: Eliminate error when deleting authorized value

Description Jared Camins-Esakov 2012-12-12 13:36:44 UTC
When DEBUG is turned on under Plack, any attempt to delete an authorized value from the staff client interface results in a DBD error:
DBD::mysql::st execute failed: Unknown column 'id' in 'where clause' at /home/jcamins/kohaclone/admin/authorised_values.pl line 228.
 at /home/jcamins/kohaclone/admin/authorised_values.pl line 300
Comment 1 Jared Camins-Esakov 2012-12-12 13:43:28 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2012-12-12 15:19:00 UTC
Even without Plack the issue exists. Your patch works great but I am under the impression that the query is useless: There is the "on delete cascade" option on the constraint (authorised_values_branches_ibfk_1). So normally the deletion should be automatic and then this query never deletes something.

I can provide a patch if you confirm that the query is useless.
Comment 3 Jared Camins-Esakov 2012-12-12 15:39:27 UTC
(In reply to comment #2)
> Even without Plack the issue exists. Your patch works great but I am under
> the impression that the query is useless: There is the "on delete cascade"
> option on the constraint (authorised_values_branches_ibfk_1). So normally
> the deletion should be automatic and then this query never deletes something.
> 
> I can provide a patch if you confirm that the query is useless.

I can confirm that when I tested my patch there were never any rows for that query to delete. Now that you point out the constraint, I realize that this was not a coincidence. A counter-patch would be welcomed.
Comment 4 Jonathan Druart 2012-12-12 15:49:20 UTC Comment hidden (obsolete)
Comment 5 Mirko Tietgen 2012-12-13 21:40:03 UTC Comment hidden (obsolete)
Comment 6 Elliott Davis 2012-12-28 15:38:06 UTC
Created attachment 14313 [details] [review]
Bug 9272: Eliminate error when deleting authorized value

Try to delete an authorized value. if you don't get any error, this
patch works.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Enabled debug, tried with and without Plack, works fine for both.

Signed-off-by: Elliott Davis <elliott@bywatersolions.com>
Works as advertised. Follows coding guidelines.
Comment 7 Jared Camins-Esakov 2012-12-29 01:14:02 UTC
This patch has been pushed to master.
Comment 8 Chris Cormack 2013-04-24 07:36:57 UTC
Was pushed to 3.10.x a while back, missed updating the status