[Koha-patches] [PATCH] Bug 5446 Fix a bug introduces by previous patch

Frédéric Demians f.demians at tamil.fr
Fri Dec 17 10:08:02 CET 2010


When AcqCreateItem was set to 'cataloguing' there was no items fields in the
acq web form to validate in JS... So JS fails and the form was un-submittable.
---
 .../prog/en/modules/acqui/neworderempty.tmpl       |   21 +++++++++++--------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
index 85ccb6f..0fda51d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
@@ -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) {
-- 
1.7.3.2



More information about the Koha-patches mailing list