Koha/C4
Fridolyn SOMERS d000a71635 Bug 11338: prevent deletion of items that are captured for holds
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 data with
"$var = $sth->fetchrow", and use "$var" as a boolean condition.

This is not correct, SQL query should be "SELECT COUNT(*) FROM table".

As a consequence, it was possible to delete an item without warning to
the operator even if it was waiting on the hold shelf or in transit to
fill a hold.

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.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes t, xt and QA script tests.
Also tried deleting via batch delete - correct warnings are displayed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-25 17:15:08 +00:00
..
AuthoritiesMarc
Barcodes Bug 6679 - [SIGNED-OFF] fix 6 perlcritic violations in C4/Barcodes/hbyymmincr.pm 2012-09-20 12:01:36 +02:00
ClassSortRoutine Bug 9770: fix sorting of Dewey call numbers that contain prefixes 2013-07-15 16:12:47 +00:00
Creators Bug 10763 - [SIGNED-OFF] Update POD of C4::Creators::Lib::html_table() to use TT syntax 2013-08-20 14:31:34 +00:00
External Bug 10320: (follow-up) correct license statement 2013-09-08 07:04:45 +00:00
Form
Heading
ILSDI bug_10781: Remove C4::ILSDI::Utility 2013-12-10 01:27:44 +00:00
Installer Bug 11124: QA Follow-up adding optional dependency HTTPD::Bench::ApacheBench 2013-12-13 19:49:18 +00:00
Labels bug 9370: improve splitting of LC call numbers for labels 2013-06-12 07:44:10 -07:00
Linker
Members Bug 7919: Fix unit test (Members_AttributeTypes.t) 2012-12-07 18:26:37 -05:00
OAI Bug 9295: Introduce operator equal/ notequal to OAI set mapping instead of hardcoded 'equal' value. 2013-10-10 23:03:30 +00:00
Output
Patroncards
Reports Bug 10761: (follow-up) use explicit return in C4::Reports::Guided::delete_report() 2013-08-21 14:45:41 +00:00
Search
Serials Bug 7688: (follow-up) update license statements 2013-10-30 02:56:32 +00:00
SIP Bug 10445: (follow-up) fix error 2013-10-31 18:05:56 +00:00
Utils
VirtualShelves Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
Accounts.pm Bug 2546: make description of standard fine types translatable 2013-12-05 18:44:33 +00:00
Acquisition.pm Bug 8230: (follow-up) update POD for C4::Acquisition::GetHistory 2013-12-13 23:51:18 +00:00
Auth.pm Bug 11077: Correct more warnings in C4/Auth.pm 2013-12-05 15:17:33 +00:00
Auth_cas_servers.yaml.orig
Auth_with_cas.pm Bug 10927: remove disused C4::Utils module 2013-10-03 14:53:02 +00:00
Auth_with_ldap.pm Bug 10908: restore docs on principal_name LDAP option 2013-10-21 15:28:11 +00:00
AuthoritiesMarc.pm Bug 10602: Set default value for authority fields via the framework 2013-10-10 23:25:47 +00:00
BackgroundJob.pm Bug 10601: (follow-up) improvements to ->set() and ->get() 2013-09-18 17:23:44 +00:00
Barcodes.pm Bug 6679 - [SIGNED-OFF] fix 8 perlcritic violations in C4/Barcodes.pm 2012-09-20 12:01:36 +02:00
Biblio.pm Bug 11032: Check a valid MARC::Record passed to Biblio 2013-12-10 05:01:54 +00:00
Bookseller.pm Bug 10641 - GetBooksellerWithLateOrders in C4::Bookseller.pm has some incoherences 2013-10-09 04:02:47 +00:00
Boolean.pm Bug 10080 - Change system pref IndependantBranches to IndependentBranches 2013-05-22 07:58:23 -07:00
Branch.pm Bug 10629: remove inappropriate uses of $sth->finish() in C4::Branch 2013-08-28 14:25:52 +00:00
Breeding.pm Bug 10096 - (follow-up) various QA improvements 2013-10-04 14:29:18 +00:00
Budgets.pm Bug 10983: Remove unused private subroutines from C4::Budgets 2013-12-13 15:14:18 +00:00
Calendar.pm Bug 7351 : feature that allows to delete a range of dates 2012-09-28 12:19:45 +02:00
Category.pm Bug 7919: FIX the "all" categories method 2013-01-02 16:50:52 -05:00
Charset.pm Bug 8015: (follow-up) trap exceptions thrown by SetUTF8Flag() 2013-10-31 22:48:59 +00:00
Circulation.pm Bug 11218: fix Item Due notices not being generated 2013-11-08 16:22:14 +00:00
ClassSortRoutine.pm
ClassSource.pm Bug 10643: fix inappropriate uses of $sth->finish() in C4::ClassSource.pm 2013-08-09 15:32:22 +00:00
Context.pm Bug 8798: moving code to Koha::Database and adding tests 2013-10-14 21:08:02 +00:00
Contract.pm
CourseReserves.pm bug 8215: (followup) rename GetItemReservesInfo 2013-05-21 15:51:03 -07:00
Creators.pm
Csv.pm Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
Dates.pm
Debug.pm
Heading.pm
HoldsQueue.pm Bug 10243: (follow-up) prevent TransportCostMatrix from overriding library holds policy 2013-10-30 03:13:41 +00:00
HTML5Media.pm Bug 8377: Followup move style in a css file and do not pass template to a pm 2012-12-27 09:28:00 -05:00
Images.pm Bug 8710 - Don't show the images tab in the OPAC if the record has no local images 2012-11-28 18:54:40 -05:00
ImportBatch.pm Bug 8015: (follow-up) trap exceptions thrown by SetUTF8Flag() 2013-10-31 22:48:59 +00:00
ImportExportFramework.pm bug 9611: (follow-up) remove md5_base64 from imports - not used 2013-10-03 23:00:32 +00:00
Input.pm Bug 7919 : Display of values depending on the connexion library 2012-12-05 10:10:57 -05:00
Installer.pm Bug 10523: Remove two obsolete routines from Installer.pm 2013-10-31 16:51:47 +00:00
ItemCirculationAlertPreference.pm Bug 6679 - [SIGNED-OFF] fix 2 perlcritic violations in C4/ItemCirculationAlertPreference.pm 2012-09-20 12:01:39 +02:00
Items.pm Bug 11338: prevent deletion of items that are captured for holds 2013-12-25 17:15:08 +00:00
ItemType.pm Bug 10513: display a warning/message when returning a chosen item type 2013-09-16 17:45:31 +00:00
Koha.pm Bug 11279: (follow-up) remove unnecessary check on number of quotes 2013-12-19 15:06:39 +00:00
Labels.pm
Languages.pm Bug 10309 - New OPAC theme based on Bootstrap 2013-10-14 23:13:05 +00:00
Letters.pm Bug 10843: fix crash that can occur when confirming hold if ReservesMaxPickUpDelay is undefined 2013-10-18 06:16:57 +00:00
Linker.pm
Log.pm Bug 7067 - OPAC Borrower Self Registration 2012-12-14 08:08:59 -05:00
Maintainance.pm
MarcModificationTemplates.pm Bug 8015: (follow-up) don't require userenv 2013-10-31 22:51:13 +00:00
Matcher.pm Bug 10230: no need to use SimpleSearch for matching auths 2013-05-19 08:40:13 -04:00
Members.pm Bug 2720 - Overdues which debar automatically should undebar automatically when returned 2013-10-31 01:53:22 +00:00
Message.pm Bug 6679 - [SIGNED-OFF] fix 3 perlcritic violations in C4/Message.pm 2012-09-20 12:01:39 +02:00
NewsChannels.pm
Output.pm Bug 10016: force zero browser-side caching of SCO pages 2013-10-21 18:05:12 +00:00
Overdues.pm Bug 2720 - Overdues which debar automatically should undebar automatically when returned 2013-10-31 01:53:22 +00:00
Patroncards.pm
Print.pm Bug 6679 - [SIGNED-OFF] fix 2 perlcritic violations in C4/Print.pm 2012-09-20 12:17:43 +02:00
Ratings.pm
Record.pm Bug 11058: fix compilation warning in C4::Record 2013-10-22 01:21:07 +00:00
Reports.pm
Reserves.pm Bug 8037: (follow-up) fix various issues 2013-10-31 14:53:16 +00:00
Review.pm
Ris.pm
RotatingCollections.pm Bug 11384: rename the collections_tracking.ctId column 2013-12-23 16:14:57 +00:00
Scheduler.pm
Scrubber.pm
Search.pm Bug 9940: Add a new index for the original language of a document 2013-12-25 15:37:14 +00:00
Serials.pm Bug 10852: (follow-up) update the POD for C4::Serials::SearchSubscriptions 2013-12-14 00:35:22 +00:00
Service.pm
ShelfBrowser.pm Bug 10856: (follow-up) if callnumbers are equal, order should be on itemnumber 2013-10-04 15:57:03 +00:00
SMS.pm
SocialData.pm
SQLHelper.pm Bug 11221: ensure that SQLHelper uses NULL rather than 0000-00-00 as default date value 2013-11-19 15:29:08 +00:00
Stats.pm
Suggestions.pm Bug 10080 - Change system pref IndependantBranches to IndependentBranches 2013-05-22 07:58:23 -07:00
Tags.pm Bug 9136: C4::Tags not Plack-compatible 2012-12-22 15:47:48 -05:00
Templates.pm Bug 7684: multiple fixes for inventory 2013-11-01 00:10:49 +00:00
TmplToken.pm
TmplTokenType.pm Revert "Bug 6679 - [SIGNED-OFF] fix 9 perlcritic violations in C4/TmplTokenType.pm" 2012-09-20 13:29:59 +02:00
TTParser.pm
UploadedFile.pm
VirtualShelves.pm Bug 10386: improvements to VirtualShelves.t 2013-06-28 05:19:49 -07:00
XISBN.pm Bug 9728: XISBN unit test update 2013-06-18 09:46:37 -07:00
XSLT.pm Bug 10550: Fix database typo wthdrawn 2013-09-08 01:58:41 +00:00