details:   https://code.openbravo.com/erp/devel/pi/rev/79f90507e9ae
changeset: 25594:79f90507e9ae
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Tue Dec 23 13:24:32 2014 +0100
summary:   Fixed bug 28440 Require at least one value flag for instance 
atributtes is not working

If Require at least one value flag is true Lot/Serial Number/Expiration Date
should be mandatory in Attribute Set selector

details:   https://code.openbravo.com/erp/devel/pi/rev/adafc2c0f504
changeset: 25595:adafc2c0f504
user:      Pandeeswari Ramakrishnan <pandeeswari.ramakrishnan <at> 
openbravo.com>
date:      Wed Dec 24 14:36:24 2014 +0530
summary:   Related to issue 28440: Code review changes

If the 'Cancel' button is clicked, the pop up should be closed irrespective
of mandatory fields are filled or not.

diffstat:

 src/org/openbravo/erpCommon/info/AttributeSetInstance.html      |  91 ++++++---
 src/org/openbravo/erpCommon/info/AttributeSetInstance.java      |  35 ++-
 src/org/openbravo/erpCommon/info/AttributeSetInstance_data.xsql |   4 +-
 3 files changed, 90 insertions(+), 40 deletions(-)

diffs (217 lines):

diff -r f5b23fe2295b -r adafc2c0f504 
src/org/openbravo/erpCommon/info/AttributeSetInstance.html
--- a/src/org/openbravo/erpCommon/info/AttributeSetInstance.html        Tue Oct 
28 21:23:23 2014 -0500
+++ b/src/org/openbravo/erpCommon/info/AttributeSetInstance.html        Wed Dec 
24 14:36:24 2014 +0530
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -45,11 +45,11 @@
 <script language="JavaScript" src="../utility/DynamicJS.js" 
type="text/javascript"></script>
 <script language="JavaScript" type="text/javascript">
 function printMessage(msg) {
-       if (msg!=null && msg != "") alert(msg);
-       var key = document.frmMain.inpInstance.value;
-       var text = document.frmMain.inpDescription.value;
-       top.opener.closeSearch("SAVE", key, text, null);
-       return true;
+    if (msg!=null && msg != "") alert(msg);
+    var key = document.frmMain.inpInstance.value;
+    var text = document.frmMain.inpDescription.value;
+    top.opener.closeSearch("SAVE", key, text, null);
+    return true;
 }
 </script>
 <script language="JavaScript" type="text/javascript" id="paramScript">
@@ -59,34 +59,64 @@
 </script>
 <script language="JavaScript" type="text/javascript">
 function validateSelector(action) {
-       if (action=="SAVE") {
-               submitCommandForm("SAVE");
-       } else top.opener.closeSearch(action, "", "", null);
-       return true;
+    if (action=="SAVE") {
+        if (validate()) {
+            submitCommandForm("SAVE");
+        }
+    } else top.opener.closeSearch(action, "", "", null);
+    return true;
+}
+function validate() {
+    var frm=document.frmMain;
+    if (document.getElementsByName("inplot").length!=0) {
+        if (frm.inplot.required) {
+            if (inputValue(frm.inplot)==null || inputValue(frm.inplot)=="") {
+                setWindowElementFocus(frm.inplot);
+                return false;
+            }
+        }
+    }
+    if (document.getElementsByName("inpDateFrom").length!=0) {
+        if (frm.inpDateFrom.required) {
+            if (inputValue(frm.inpDateFrom)==null || 
inputValue(frm.inpDateFrom)=="") {
+                setWindowElementFocus(frm.inpDateFrom);
+                return false;
+            } 
+        }
+    }
+    if (document.getElementsByName("inpserno").length!=0) {
+        if (frm.inpserno.required) {
+            if (inputValue(frm.inpserno)==null || 
inputValue(frm.inpserno)=="") {
+                setWindowElementFocus(frm.inpserno);
+                return false;
+            } 
+        }
+    }
+    return true;
 }
 </script>
-       <script language="JavaScript" type="text/javascript">
-       function onLoadDo(){
-               this.windowTables = new Array(
-                 new windowTableId('client', 'buttonOK')
-               );
-               setWindowTableParentElement();
-               enableShortcuts('popup');
-               setBrowserAutoComplete(false);
-               
-               resizePopup();
-               try {
-                 onloadFunctions();
-               } catch (e) {}
-               xx();
+    <script language="JavaScript" type="text/javascript">
+    function onLoadDo(){
+        this.windowTables = new Array(
+          new windowTableId('client', 'buttonOK')
+        );
+        setWindowTableParentElement();
+        enableShortcuts('popup');
+        setBrowserAutoComplete(false);
+        
+        resizePopup();
+        try {
+          onloadFunctions();
+        } catch (e) {}
+        xx();
 
-               setWindowElementFocus('firstElement');
-       }
+        setWindowElementFocus('firstElement');
+    }
 
-       function onResizeDo(){
-               resizePopup();
-       }
-       </script>
+    function onResizeDo(){
+        resizePopup();
+    }
+    </script>
 </head>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
onload="onLoadDo();xx();" onresize="onResizeDo();" id="paramBody">
 <form name="frmMain" method="post" action="AttributeSetInstance.html">
@@ -134,6 +164,7 @@
   </tr>
 </table>
 
+
 <table cellspacing="0" cellpadding="0" width="100%">
   <tr>
     <td>
diff -r f5b23fe2295b -r adafc2c0f504 
src/org/openbravo/erpCommon/info/AttributeSetInstance.java
--- a/src/org/openbravo/erpCommon/info/AttributeSetInstance.java        Tue Oct 
28 21:23:23 2014 -0500
+++ b/src/org/openbravo/erpCommon/info/AttributeSetInstance.java        Wed Dec 
24 14:36:24 2014 +0530
@@ -323,10 +323,17 @@
       strHtml.append(strName.equals("") ? "Lot" : strName);
       strHtml.append("</span></td>\n");
       strHtml.append("<td ");
-      strHtml.append("class=\"TextBox_ContentCell\"><input type=\"text\" ");
+      strHtml.append("class=\"");
+      if (fields[0].isoneattrsetvalrequired.equals("Y")) {
+        strHtml.append("Key");
+      }
+      strHtml.append("TextBox_ContentCell\"><input type=\"text\" ");
       strHtml.append("name=\"inplot\" ");
       strHtml.append("maxlength=\"20\" ");
       strHtml.append("class=\"dojoValidateValid TextBox_OneCell_width");
+      if (fields[0].isoneattrsetvalrequired.equals("Y")) {
+        strHtml.append(" required");
+      }
       // strHtml.append("onkeydown=\"autoCompleteNumber(this, true, true, 
event);return true;\" ");
       if (!fields[0].mLotctlId.equals("") && (strIsSOTrx.equals("N") || 
strWindowId.equals("191"))) {
         strHtml.append(" readonly\" readonly=true ");
@@ -349,10 +356,17 @@
       String strName = Utility.messageBD(this, "SerNo", vars.getLanguage());
       strHtml.append(strName.equals("") ? "SerNo" : strName);
       strHtml.append("</span></td>\n");
-      strHtml.append("<td class=\"TextBox_ContentCell\"><input type=\"text\" 
");
+      strHtml.append("<td class=\"");
+      if (fields[0].isoneattrsetvalrequired.equals("Y")) {
+        strHtml.append("Key");
+      }
+      strHtml.append("TextBox_ContentCell\"><input type=\"text\" ");
       strHtml.append("name=\"inpserno\" ");
       strHtml.append("maxlength=\"20\" ");
       strHtml.append("class=\"dojoValidateValid TextBox_OneCell_width");
+      if (fields[0].isoneattrsetvalrequired.equals("Y")) {
+        strHtml.append(" required\"  required=\"true\"");
+      }
       // strHtml.append("onkeydown=\"autoCompleteNumber(this, true, true, 
event);return true;\" ");
       if (!fields[0].mSernoctlId.equals("")
           && (strIsSOTrx.equals("N") || strWindowId.equals("191"))) {
@@ -387,17 +401,22 @@
       String strName = Utility.messageBD(this, "GuaranteeDate", 
vars.getLanguage());
       strHtml.append(strName.equals("") ? "GuaranteeDate" : strName);
       strHtml.append("</span></td>\n");
-      strHtml.append("<td class=\"TextBox_btn_ContentCell\">");
+      strHtml.append("<td class=\"");
+
+      strHtml.append("TextBox_btn_ContentCell\">");
       strHtml
           .append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" 
summary=\"\" style=\"padding-top: 0px;\">");
       strHtml.append("<tr>");
       strHtml.append("<td class=\"TextBox_ContentCell\">");
+
+      strHtml.append("<input dojoType=\"openbravo:DateTextbox\" 
displayFormat=\""
+          + vars.getSessionValue("#AD_SqlDateFormat") + "\" saveFormat=\""
+          + vars.getSessionValue("#AD_SqlDateFormat") + "\" 
class=\"TextBox_btn_OneCell_width");
+      if (fields[0].isoneattrsetvalrequired.equals("Y")) {
+        strHtml.append(" required\"  required=\"true\"");
+      }
       strHtml
-          .append("<input dojoType=\"openbravo:DateTextbox\" displayFormat=\""
-              + vars.getSessionValue("#AD_SqlDateFormat")
-              + "\" saveFormat=\""
-              + vars.getSessionValue("#AD_SqlDateFormat")
-              + "\" class=\"TextBox_btn_OneCell_width\"  type=\"text\" 
name=\"inpDateFrom\" id=\"paramDateFrom\" size=\"10\" maxlength=\"10\" value=\""
+          .append(" type=\"text\" name=\"inpDateFrom\" id=\"paramDateFrom\" 
size=\"10\" maxlength=\"10\" value=\""
               + strGuaranteeDate
               + "\" onkeyup=\"autoCompleteDate(this.textbox, 
this.displayFormat);return 
true;\"></input><script>djConfig.searchIds.push(\"paramDateFrom\");</script>");
       strHtml.append("</td>");
diff -r f5b23fe2295b -r adafc2c0f504 
src/org/openbravo/erpCommon/info/AttributeSetInstance_data.xsql
--- a/src/org/openbravo/erpCommon/info/AttributeSetInstance_data.xsql   Tue Oct 
28 21:23:23 2014 -0500
+++ b/src/org/openbravo/erpCommon/info/AttributeSetInstance_data.xsql   Wed Dec 
24 14:36:24 2014 +0530
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -30,7 +30,7 @@
         SELECT A_S.M_ATTRIBUTESET_ID, A_S.NAME, A_S.DESCRIPTION, 
A_S.GUARANTEEDAYS, A_S.ISGUARANTEEDATE, A_S.ISLOT, A_S.ISSERNO, 
         A_S.M_LOTCTL_ID, A_S.M_SERNOCTL_ID, A.ISLIST, A.NAME AS ELEMENTNAME, 
A.M_ATTRIBUTE_ID, 
         A_S.ISLOCKABLE, A.ISINSTANCEATTRIBUTE, '' AS 
M_ATTRIBUTESETINSTANCE_ID, '' as GUARANTEEDATE, '' as LOT, '' as SERNO, 
-        '' as M_ATTRIBUTEVALUE_ID, '' as VALUE, A.ISMANDATORY, '' AS ISLOCKED, 
'' AS LOCK_DESCRIPTION 
+        '' as M_ATTRIBUTEVALUE_ID, '' as VALUE, A.ISMANDATORY, '' AS ISLOCKED, 
'' AS LOCK_DESCRIPTION ,  A_S.Isoneattrsetvalrequired
         FROM M_ATTRIBUTESET A_S left join (M_ATTRIBUTEUSE A_U 
                                            join M_ATTRIBUTE A on 
A_U.M_ATTRIBUTE_ID = A.M_ATTRIBUTE_ID
                                                                  and 
A_U.ISACTIVE= 'Y'

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to