Bug 5446 Fix a bug introduces by previous patch
authorFrédéric Demians <f.demians@tamil.fr>
Fri, 17 Dec 2010 11:16:52 +0000 (11:16 +0000)
committerChris Cormack <chrisc@catalyst.net.nz>
Sun, 19 Dec 2010 08:25:09 +0000 (21:25 +1300)
When AcqCreateItem was set to 'cataloguing' there was no items fields in the
acq web form to validate in JS...

Alert commented.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl

index 85ccb6f..a76cb5c 100644 (file)
@@ -40,16 +40,19 @@ function Check(ff) {
             _(") exceeds budget available (") + actTotal+")";
     }
 
-    var empty_item_mandatory = 0;
-    for (i = 0; i < ff.field_value.length; i++) {
-        if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
-            empty_item_mandatory++;
+    if ( ff.field_value ) {
+        var empty_item_mandatory = 0;
+        for (i = 0; i < ff.field_value.length; i++) {
+            //alert("i = " + i + " => " + ff.kohafield[i] );
+            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
+                empty_item_mandatory++;
+            }
+        }
+        if (empty_item_mandatory > 0) {
+            ok = 1;
+            _alertString +=
+                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
         }
-    }
-    if (empty_item_mandatory > 0) {
-        ok = 1;
-        _alertString +=
-            "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
     }
 
 if (ok) {