Bug 12522 - Fatal database error when viewing Holds for Bib with no Items
authorDavid Cook <dcook@prosentient.com.au>
Thu, 3 Jul 2014 06:32:57 +0000 (16:32 +1000)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 14 Jul 2014 11:47:56 +0000 (08:47 -0300)
commit99e25ff30dd574ac2dc13e3e73cdccee6f44ce1f
tree3e2198446e43fe3481a0823aacf0f0b27c797370
parent5e5c0380700565ce1f75a389473ae71910fcb452
Bug 12522 - Fatal database error when viewing Holds for Bib with no Items

This patch fixes some potential SQL syntax errors, which can cause
fatal software errors in Koha when the environmental variable DEBUG
is on.

_TEST PLAN_

Before applying:

0) Ensure that you don't have "SetEnv DEBUG 1" in your Apache config
1) Create a new bib record
2) Click on the "Holds" tab before creating any items
3) Note the message "Cannot place hold: this record has no
items attached."

4) Add "SetEnv DEBUG 1" to your Apache config
5) Restart Apache
6) Refresh your page
7) Note the following Software Error: "DBD::mysql::st execute failed:
You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to
use near ')' at line 3 at /koha/lib/C4/Koha.pm line 835.

8) Apply the patch

9) Refresh your page
10) Note the message from Step 3

Thorough tester:

11) Remove "SetEnv DEBUG 1" from your Apache config, restart Apache,
and refresh your page. You should see the message from Step 3.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Error reproduced, patch fixes it.
Tested following test plan, no koha-qa errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Biblio.pm
C4/Items.pm