http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11338 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #23303|0 |1 is obsolete| | --- Comment #3 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 23761 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=23761&action=edit 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 <chrisc@catalyst.net.nz> Works, and has the added bonus of being a tiny bit faster. -- You are receiving this mail because: You are watching all bug changes.