From 162c200e38c2d82ca1cf56c868278f09d7c1273e Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 13 Jun 2013 16:46:46 +1000 Subject: [PATCH] Bug 10457 - Export selected items data doesn't work when using checkall checkbox Currently, if you use the "check all" checkbox next to the "Vendor" table header, and try to "Export selected items data", you'll experience the following SQL error: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on ORDER BY title' at line 12 at /.../lib/C4/Serials.pm line 1828. This is because the Javascript that produces the re-direct URL is including the value of the checkall checkbox, which is "on", as a "serialid". We need to only take checkboxes with a name of "serialid" when crafting the re-direct link. -- This patch adds the [name=serialid] attribute selector to the Jquery that creates the URL to lateissues-excel.pl from claims.pl. -- Test Plan: Before applying the patch: 1) Go to Serials > Claims (found on the left navigation bar of Serials) 2) Choose a vendor that has serials to claim (or create some late serials for a vendor so that they will show up) 3) Click on the checkbox to the left of the "Vendor" table heading. 4) Click "Export selected items data" at the bottom of the page 5) Notice that you'll get a SQL error like the one in the message above. Apply the patch. Repeat Steps 1-4. Note that you should now have a CSV file downloading rather than getting a SQL error. Signed-off-by: Kyle M Hall --- .../prog/en/modules/serials/claims.tt | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt index e309ab1..7528e9a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt @@ -33,9 +33,8 @@ // Generates a dynamic link for exporting the selection's data as CSV $("#ExportSelected").click(function() { - // We use input:checked because it's faster, but if there must new checkboxes - // used for other purpose on this page, please use [name=serialid]:checked instead - var selected = $("input:checked"); + // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error. + var selected = $("input[name=serialid]:checked"); if (selected.length == 0) { alert(_("Please select at least one item to export.")); -- 1.7.2.5