Fixes Issue 21966 : Quantity validation in Create Lines Process in Goods Receipt
authorPandeeswari Ramakrishnan <pandeeswari.ramakrishnan@openbravo.com>
Wed, 17 Oct 2012 11:54:56 +0200
changeset 18547 5fe92c72d948
parent 18546 425ad0065671
child 18548 0aacf87829e4
Fixes Issue 21966 : Quantity validation in Create Lines Process in Goods Receipt
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_ShipmentPO.html
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Nov 14 16:23:41 2012 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Oct 17 11:54:56 2012 +0200
@@ -20349,6 +20349,17 @@
 <!--D4C26BD5396244C4B3CD1731B02C4A0A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--D4C26BD5396244C4B3CD1731B02C4A0A--></AD_MESSAGE>
 
+<!--D4CC612B2C4649C29400F220FE577656--><AD_MESSAGE>
+<!--D4CC612B2C4649C29400F220FE577656-->  <AD_MESSAGE_ID><![CDATA[D4CC612B2C4649C29400F220FE577656]]></AD_MESSAGE_ID>
+<!--D4CC612B2C4649C29400F220FE577656-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D4CC612B2C4649C29400F220FE577656-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D4CC612B2C4649C29400F220FE577656-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D4CC612B2C4649C29400F220FE577656-->  <VALUE><![CDATA[InvalidMovementQty]]></VALUE>
+<!--D4CC612B2C4649C29400F220FE577656-->  <MSGTEXT><![CDATA[Movement Quantity is greater than the Ordered/Invoiced Quantity.]]></MSGTEXT>
+<!--D4CC612B2C4649C29400F220FE577656-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--D4CC612B2C4649C29400F220FE577656-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D4CC612B2C4649C29400F220FE577656--></AD_MESSAGE>
+
 <!--D58A82FD33BA4CE98D3059C140B24491--><AD_MESSAGE>
 <!--D58A82FD33BA4CE98D3059C140B24491-->  <AD_MESSAGE_ID><![CDATA[D58A82FD33BA4CE98D3059C140B24491]]></AD_MESSAGE_ID>
 <!--D58A82FD33BA4CE98D3059C140B24491-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_ShipmentPO.html	Wed Nov 14 16:23:41 2012 +0100
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_ShipmentPO.html	Wed Oct 17 11:54:56 2012 +0200
@@ -151,6 +151,38 @@
     function unHoverCell(cell) {
       cell.className = cell.className.replace(' DataGrid_Body_Cell_hover', '');
     }
+
+    function validateQuantity(chk) {
+        var invalid = false;
+        var i = 0;
+        var frm = document.frmMain;
+        var defaultValue = 0;
+        var currentValue = 0;
+        do {
+          if(chk.length > 0) {
+            if(chk[i].checked) {
+              defaultValue = frm.elements["inpmovementqty" + chk[i].value].defaultValue;
+              currentValue = frm.elements["inpmovementqty" + chk[i].value].value;   
+            }
+          }
+          else {
+            if(chk.checked) {
+              defaultValue = frm.elements["inpmovementqty" + chk.value].defaultValue;
+              currentValue = frm.elements["inpmovementqty" + chk.value].value;   
+            }
+          }
+          i = i + 1;     
+          if(parseInt(currentValue) > parseInt(defaultValue)) {
+            invalid = true;
+            showJSMessage('InvalidMovementQty');
+            break;
+          }
+          else
+            continue;
+        } while (i<chk.length);
+        if(!invalid)
+          submitThisPage('SAVE');
+      }
   </script>
   <script language="JavaScript" type="text/javascript">
     function onLoadDo(){
@@ -586,7 +618,7 @@
                   <button type="button" 
                     id="buttonOK" 
                     class="ButtonLink" 
-                    onclick="submitThisPage('SAVE');return false;" 
+                    onclick="validateQuantity(document.frmMain.inpId);return false;"
                     onfocus="buttonEvent('onfocus', this); window.status='Accept'; return true;" 
                     onblur="buttonEvent('onblur', this);" 
                     onkeyup="buttonEvent('onkeyup', this);"