From 4af9a86c7adc0c64febc3647ff09244f3edde3d3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Oct 2013 11:41:11 +0200 Subject: [PATCH] Bug 11127: OPAC suggestion: the delete link is active when no suggestion selected To reproduce: 1/ go on opac-suggestions.pl 2/ create a suggestion 3/ click on the delete link without checking any checkbox The form is submitted with a message "The selected suggestions have been deleted.". Test plan: 1/ after applying the patch, click on delete without any checkbox checked, a js alert should occur. 2/ check at least a cb and click on the delete link. The deletion should work. --- koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt index d8b19b5..cb699dd 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt @@ -14,9 +14,11 @@ if ($(checkedBoxes).size()) { $("#selections").html(_("With selected suggestions: ")); $("#selections-toolbar .links a").removeClass("disabled"); + $("#removeitems").removeAttr("disabled"); } else { $("#selections").html(_("Select suggestions to: ")); $("#selections-toolbar .links a").addClass("disabled"); + $("#removeitems").attr("disabled", "disabled"); } }[% END %] @@ -51,7 +53,12 @@ enableCheckboxActions(); }); $("#removeitems").html(""+_("Delete")+"") - .click(function(){ + .click(function(e){ + e.preventDefault(); + if ( $(this).attr('disabled') == 'disabled') { + alert(_("Please select a suggestion")); + return false; + } $("#myform").submit(); return false; }); -- 1.7.10.4