http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11338
Katrin Fischer <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #23761|0 |1 is obsolete| | --- Comment #4 from Katrin Fischer <[email protected]> --- Created attachment 23792 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=23792&action=edit [PASSED QA] Bug 11338 - wrong SQL in DelItemCheck In C4::Items::DelItemCheck, there are two SQL queries : one to check if item is on loan, the other if item is reserved. Those two queries use "SELECT * FROM table", fetch the datas with "$var = $sth->fetchrow", and use "$var" as a boolean condition. This is not correct, SQL query should be "SELECT COUNT(*) FROM table". Code actually works, but is dangerous. This patch corrects the SQL queries and sets my ($var) to show that fetchrow returns an array. Test plan : - Set an item A onloan - Set an item B reserved and the reserve waiting - Go to items cataloguing : cgi-bin/koha/cataloguing/additem.pl?biblionumber=XXX - Try to delete item A => You get an alert and item is not deleted - Try to delete item B => You get an alert and item is not deleted Signed-off-by: Chris Cormack <[email protected]> Works, and has the added bonus of being a tiny bit faster. Signed-off-by: Katrin Fischer <[email protected]> Passes t, xt and QA script tests. Also tried deleting via batch delete - correct warnings are displayed. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
