From 1ad94323f73fda8b6998955b0779fdde752be2a8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 23 Apr 2018 16:19:50 -0300 Subject: [PATCH] Bug 20616: Prevent "edit serials" form submission if no serial is selected MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In order to prevent the form to submit and gives an ugly error if no issues are selected we will make sure at least one is checked otherwise an alert will be displayed. Test plan: - create a subscrpition - go to the serials collection page - don't check any checkboxes for serials - click 'Edit serials' Signed-off-by: Séverine QUEUNE Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit e14ee4ad0a033354052726ff401f8ee4f64dd2b9) Signed-off-by: Fridolin Somers --- .../prog/en/modules/serials/serials-collection.tt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index 628276e15f..6468f0949b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -73,6 +73,15 @@ $(document).ready(function() { "bInfo": false, "bFilter": false, } )); + + $("form[name='edition']").on('submit', function(e){ + if ( $(this).find("input[name='serialid']:checked").size() == 0 ) { + e.preventDefault(); + alert("You must select at least one serial to edit"); + return 0; + } + return 1; + }); }); //]]> -- 2.39.5