From f4f4734047b3306d11b2de5aaeccc2c44d63cd7f Mon Sep 17 00:00:00 2001 From: Indranil Das Gupta Date: Mon, 3 Aug 2015 09:57:53 +0530 Subject: [PATCH] Bug 14632 - Fix alert message for single item batch Fixes the incorrect msg "Please select at least label to delete." for attempts to delete from single patron batches. Notifies the user that doing so will delete the batch. It disallows direct deletion, instead suggests the users to use the 'Delete batch' option assuming the users know what they are doing. Test plan ========= 1/ Load a single patron batch in edit mode and attempt to delete the single record. The JS alert message will inform that "Please select at least label to delete." 2/ Apply patch and refresh page and try to delete the single record again. 3/ This time the alert will inform the user that doing so will delete the batch and should that be desired action to choose the 'Delete batch' option from the toolbar. Signed-off-by: Frederic Demians It works as before but with an understantable warning message. --- .../intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt index 32e6924..79494cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -20,6 +20,7 @@ function Remove() { items = new Array; item_num = new Array; + if(document.items.action.length > 0) { for (var i=0; i < document.items.action.length; i++) { if (document.items.action[i].checked) { @@ -27,16 +28,15 @@ item_num.push(i+1); } } - if (items.length < 1) { - alert(_("Please select at least one item to delete.")); - return; // no item selected - } getstr = items.join("&"); item_msg = item_num.join(", "); var msg = _("Are you sure you want to remove card number(s): %s from this batch?").format(item_msg); + } else if (document.items.action.checked) { + alert(_("Deletion of item from a batch with only one item will delete the batch.\n\nIf this is what you want, select 'Delete batch' option from toolbar")); + return; // no deletion for single item batch } else { - alert(_("Please select at least label to delete.")); + alert(_("Please select at least one patron to delete.")); return; // no item selected } var answer = confirm(msg); -- 2.6.2