Bug 14805: (follow-up) fix a bug in previous code and change msg string
authorJoonas Kylmälä <j.kylmala@gmail.com>
Thu, 17 Sep 2015 11:35:32 +0000 (11:35 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 4 Nov 2015 14:13:32 +0000 (11:13 -0300)
Previously the code didn't work if there was only one batch available for selection.
This fixes that now. Also there was a bug with wrong string showing now it's
changed to a general one, "items". I choosed the string "items" because there was
difficulties adding the plural part of the word. One cannot add just s to the end
of the word batch like you can in the case of profile.

Sponsored-by: Vaara-kirjastot

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt

index 50b5200..8b438d3 100644 (file)
@@ -24,7 +24,7 @@
 
                 var msg;
                 if (element_ids.length > 1) {
-                    msg = _("Are you sure you want to delete %s batches?").format(element_ids.length);
+                    msg = _("Are you sure you want to delete %s items?").format(element_ids.length, element_ids.length);
                 } else if (element_ids.length == 1) {
                     msg = _("Are you sure you want to delete %s %s?").format("[% PROCESS translate_card_element element=card_element %]", element_ids[0]);
                 }
@@ -81,8 +81,8 @@
                 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
             };
             function selected_layouts(op) {
-                var selected = new Array;
                 if (document.layouts.action.length) {
+                    var selected = new Array();
                     for (i=0;i<document.layouts.action.length;i++){
                         if (document.layouts.action[i].checked){
                             selected.push(i);
                 }
                 else {
                     if (document.layouts.action.checked){
-                        return(document.layouts.action.value);
+                        return([document.layouts.action.value]);
                     }
                 };
                 alert(_("Please select a %s.").format("[% PROCESS translate_card_element element=card_element %]"));