ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jler...@apache.org
Subject svn commit: r1667776 - in /ofbiz/branches/release13.07/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/MacroFormRenderer.java src/org/ofbiz/widget/form/ModelFormField.java
Date Thu, 19 Mar 2015 14:39:33 GMT
Author: jleroux
Date: Thu Mar 19 14:39:33 2015
New Revision: 1667776

URL: http://svn.apache.org/r1667776
Log:
Fixes <<You can't rely on Lookup field description-field-name attribute in a form having
skip-start="true">> https://issues.apache.org/jira/browse/OFBIZ-6170

Instead of adding a form-name attribute only in lookup sub-element, I added it a the field
level and removed the one at the lookup level.So the form-name field attribute can be used
in the field of both the lookup and if needed the field set in the lookup description-field-name
attribute. I only tested it in a version more near 13.07 but I believe it's ok here

Modified:
    ofbiz/branches/release13.07/framework/widget/dtd/widget-form.xsd
    ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Modified: ofbiz/branches/release13.07/framework/widget/dtd/widget-form.xsd
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/widget/dtd/widget-form.xsd?rev=1667776&r1=1667775&r2=1667776&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/branches/release13.07/framework/widget/dtd/widget-form.xsd Thu Mar 19 14:39:33 2015
@@ -648,6 +648,14 @@ under the License.
                 </xs:documentation>
                 </xs:annotation>
             </xs:attribute>
+            <xs:attribute type="xs:string" name="form-name">
+                <xs:annotation>
+                    <xs:documentation>
+                        The name of the parent form, needed at least for lookups when using
skip-start="true"
+                        Must be set also on the related field if description-field-name is
used 
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
         </xs:complexType>
     </xs:element>
 
@@ -1076,13 +1084,6 @@ under the License.
                 <xs:element minOccurs="0" ref="sub-hyperlink" />
             </xs:sequence>
             <xs:attribute type="xs:string" name="target-form-name" use="required" />
-            <xs:attribute type="xs:string" name="form-name">
-                <xs:annotation>
-                    <xs:documentation>
-                        The name of the parent form, needed when using skip-start="true"
along with correct id-name value on field
-                    </xs:documentation>
-                </xs:annotation>
-            </xs:attribute>
             <xs:attribute type="xs:nonNegativeInteger" name="size" default="25" />
             <xs:attribute type="xs:positiveInteger" name="maxlength" />
             <xs:attribute type="xs:string" name="default-value" />

Modified: ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1667776&r1=1667775&r2=1667776&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
(original)
+++ ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
Thu Mar 19 14:39:33 2015
@@ -2019,7 +2019,7 @@ public class MacroFormRenderer implement
         boolean readonly = lookupField.readonly;
         // add lookup pop-up button
         String descriptionFieldName = lookupField.getDescriptionFieldName();
-        String formName = lookupField.getParentFormName();
+        String formName = modelFormField.getParentFormName();
         if (UtilValidate.isEmpty(formName)) {
             formName = modelFormField.getModelForm().getCurrentFormName(context);
         }

Modified: ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1667776&r1=1667775&r2=1667776&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
(original)
+++ ofbiz/branches/release13.07/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
Thu Mar 19 14:39:33 2015
@@ -117,6 +117,7 @@ public class ModelFormField {
     protected String sortFieldHelpText = "";
     protected String headerLink;
     protected String headerLinkStyle;
+    protected String parentFormName;
 
     /** On Change Event areas to be updated. */
     protected List<UpdateArea> onChangeUpdateAreas;
@@ -163,6 +164,7 @@ public class ModelFormField {
         this.sortFieldHelpText = fieldElement.getAttribute("sort-field-help-text");
         this.headerLink = fieldElement.getAttribute("header-link");
         this.headerLinkStyle = fieldElement.getAttribute("header-link-style");
+        this.parentFormName = fieldElement.getAttribute("form-name");
 
 
         String positionStr = fieldElement.getAttribute("position");
@@ -976,7 +978,12 @@ public class ModelFormField {
 
     public String getIdName() {
         if (UtilValidate.isNotEmpty(idName)) return idName;
-        return this.modelForm.getName() + "_" + this.getFieldName();
+        String parentFormName = this.getParentFormName();
+        if (UtilValidate.isNotEmpty(parentFormName)) {
+            return parentFormName + "_" + this.getFieldName();
+        } else {
+           return this.modelForm.getName() + "_" + this.getFieldName();
+        }
     }
 
     public String getCurrentContainerId(Map<String, Object> context) {
@@ -1269,6 +1276,11 @@ public class ModelFormField {
     }
 
 
+    public String getParentFormName() {
+        return this.parentFormName;
+    }
+
+
     public static abstract class FieldInfo {
 
         public static final int DISPLAY = 1;



Mime
View raw message