Just add a check in Jscript when the form is submited, the same as in additem.tt
---
 .../prog/en/modules/acqui/orderreceive.tt          |   22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt 
b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
index 821dcd3..50b7fcb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
@@ -7,6 +7,28 @@
 //<![CDATA[
     function Check(form) {
         [% IF (AcqCreateItemReceiving) %]
+            var total_errors=0;
+            
$("input[name='mandatory'],select[name='mandatory']").each(function(i){
+                if($(this).val() == 1){
+                    var mandatory_field = 
$("input[name='field_value'],select[name='field_value']").eq(i);
+                    if(mandatory_field.val() == ''){
+                        mandatory_field.css("background-color","#FFFFCC");
+                        total_errors++;
+                    }
+                }
+            });
+
+            var alertString2;
+            if (total_errors==0) {
+                return true;
+            } else {
+                alertString2  = _("Form not submitted because of the following 
problem(s)");
+                alertString2 += 
"\n------------------------------------------------------------------------------------\n";
+                alertString2 += "\n- "+ total_errors+_(" mandatory fields 
empty (highlighted)");
+                alert(alertString2);
+                return false;
+            }
+
             // Remove last itemblock if it is not in items_list
             var lastitemblock = $("#outeritemblock > div:last");
             var tobedeleted = true;
-- 
1.7.9.5

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to