From 98bb3530a9b6bbbbbd4c0f85a16a74f1bd9186ce Mon Sep 17 00:00:00 2001
From: Paul Poulain <paul.poulain@biblibre.com>
Date: Tue, 18 Oct 2011 18:10:36 +0200
Subject: [PATCH] BZ5725 follow-up for comment 48

This small follow up:
  * removes "whole field" in subfield list except when dealing with a field <010 (that has no subfield)
  * add a missing string resulting in an "undefined" when user choosed 'Create field and subfield' and hit Add button
  * synch the description after adding with the description in the list box of the 4 options available
  * fixes indentation a little
---
 .../prog/en/modules/tools/batchedit.tt             |   24 +++++++++++--------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt
index 31c84d1..0d5e0df 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt
@@ -19,15 +19,18 @@
 		$("#subfieldchoice option").remove();
 
 		    var subfield = $('#subfieldchoice');
-			$("<option>").attr("value", "@")
-                                 .text( _('Whole field'))
-                                 .appendTo('#subfieldchoice');
+            if (data.length >0)  {
                 for( var i=0; i < data.length ; i++){
-			$("<option>").attr("value", data[i].subfield)
-                                 .text(data[i].subfield)
-                                 .appendTo('#subfieldchoice');
+                    $("<option>").attr("value", data[i].subfield)
+                         .text(data[i].subfield)
+                         .appendTo('#subfieldchoice');
                 }
-                subfieldChanged();
+            } else {
+                $("<option>").attr("value", "@")
+                     .text( _('Whole field'))
+                     .appendTo('#subfieldchoice');
+            }
+            subfieldChanged();
             }
         });
      }
@@ -70,9 +73,10 @@
 
      function addRule(){
         var actionlabel = {
-                mod: _('Modify'),
-                del: _('Delete'),
-                add: _('Create')
+                mod: _('Modify subfield'),
+                del: _('Delete subfield'),
+                add: _('Create subfield'),
+                addfield: _('Create field and subfield')
                 };
         var repvallabel  = $('#repvalchoice :selected').text()  || $("#repvalchoice").val();
 
-- 
1.7.5.4