You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2022/05/21 08:42:14 UTC

[ofbiz-framework] branch release22.01 updated (970857b420 -> e8750ec581)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a change to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


    from 970857b420 Improved: Helveticus, improve keyboard navigation on login page (OFBIZ-12622)
     new 4f71f851db Improved: Secure the uploads (OFBIZ-12080)
     new 9f55205b65 Fixed: Required field not working on upload type form (OFBIZ-12619)
     new e8750ec581 Improved: Required field not working on upload type form (OFBIZ-12619)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 applications/content/config/ContentUiLabels.xml        |  4 ++--
 .../order/template/order/AddOrderAttachments.ftl       |  2 +-
 .../ofbiz/widget/renderer/macro/MacroFormRenderer.java | 18 ++++++++++++------
 3 files changed, 15 insertions(+), 9 deletions(-)


[ofbiz-framework] 02/03: Fixed: Required field not working on upload type form (OFBIZ-12619)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 9f55205b6514f16c9abd7888ed10e12acebee3f0
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sat May 21 10:35:11 2022 +0200

    Fixed: Required field not working on upload type form (OFBIZ-12619)
    
    When trying to submit an upload form with empty required fields, the validation
    is not blocked and the submit is made.
    
    Thanks: Leila Mekika
---
 .../ofbiz/widget/renderer/macro/MacroFormRenderer.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
index b64d2ab767..6b20669e7e 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
@@ -250,7 +250,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
             }
         }
         //check for required field style on single forms
-        if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
+        if (shouldApplyRequiredField(modelFormField)) {
             String requiredStyle = modelFormField.getRequiredFieldStyle();
             if (UtilValidate.isEmpty(requiredStyle)) {
                 requiredStyle = "required";
@@ -322,6 +322,12 @@ public final class MacroFormRenderer implements FormStringRenderer {
         this.appendTooltip(writer, context, modelFormField);
     }
 
+    private boolean shouldApplyRequiredField(ModelFormField modelFormField) {
+        return ("single".equals(modelFormField.getModelForm().getType()) ||
+             "upload".equals(modelFormField.getModelForm().getType()))
+             && modelFormField.getRequiredField();
+    }
+
     @Override
     public void renderDateTimeField(Appendable writer, Map<String, Object> context, DateTimeField dateTimeField) throws IOException {
         ModelFormField modelFormField = dateTimeField.getModelFormField();
@@ -486,7 +492,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
             }
         }
         //check for required field style on single forms
-        if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
+        if (shouldApplyRequiredField(modelFormField)) {
             String requiredStyle = modelFormField.getRequiredFieldStyle();
             if (UtilValidate.isEmpty(requiredStyle)) {
                 requiredStyle = "required";
@@ -633,7 +639,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
             }
         }
         //check for required field style on single forms
-        if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
+        if (shouldApplyRequiredField(modelFormField)) {
             String requiredStyle = modelFormField.getRequiredFieldStyle();
             if (UtilValidate.isEmpty(requiredStyle)) {
                 requiredStyle = "required";
@@ -1196,7 +1202,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
         }
         if (!sb.toString().isEmpty()) {
             //check for required field style on single forms
-            if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
+            if (shouldApplyRequiredField(modelFormField)) {
                 String requiredStyle = modelFormField.getRequiredFieldStyle();
                 if (UtilValidate.isNotEmpty(requiredStyle)) {
                     style = requiredStyle;
@@ -2058,7 +2064,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
             }
         }
         //check for required field style on single forms
-        if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
+        if (shouldApplyRequiredField(modelFormField)) {
             String requiredStyle = modelFormField.getRequiredFieldStyle();
             if (UtilValidate.isEmpty(requiredStyle)) {
                 requiredStyle = "required";
@@ -2559,7 +2565,7 @@ public final class MacroFormRenderer implements FormStringRenderer {
         }
 
         //check for required field style on single forms
-        if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) {
+        if (shouldApplyRequiredField(modelFormField)) {
             String requiredStyle = modelFormField.getRequiredFieldStyle();
             if (UtilValidate.isEmpty(requiredStyle)) {
                 requiredStyle = "required";


[ofbiz-framework] 01/03: Improved: Secure the uploads (OFBIZ-12080)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 4f71f851db2d95113b712b385734401a2a5f0149
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sat May 21 10:05:02 2022 +0200

    Improved: Secure the uploads (OFBIZ-12080)
    
    Attachments to order can be also documents. Accepting only images did not prevent
    it, you can always bypass that, but it clarifies things.
    
    Also improves the ContentUploadFileTypeNotMatch English label
---
 applications/content/config/ContentUiLabels.xml           | 4 ++--
 applications/order/template/order/AddOrderAttachments.ftl | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/applications/content/config/ContentUiLabels.xml b/applications/content/config/ContentUiLabels.xml
index 38537546ea..3ebd05f03a 100644
--- a/applications/content/config/ContentUiLabels.xml
+++ b/applications/content/config/ContentUiLabels.xml
@@ -3141,7 +3141,7 @@
         <value xml:lang="zh-TW">你沒有檢視本頁面的權限.(需要具備"CONTENTMGR_UPDATE"或"CONTENTMGR_ADMIN")</value>
     </property>
     <property key="ContentUploadFileTypeNotMatch">
-        <value xml:lang="en">Upload file type not match your selected.</value>
+        <value xml:lang="en">Upload file type not match your selection.</value>
         <value xml:lang="fr">Le type de fichier chargé ne correspond pas avec votre selection.</value>
         <value xml:lang="it">Tipo file da caricare non corrisponde alla tua selezione.</value>
         <value xml:lang="ja">選択したアップロードファイルの種類が一致しません。</value>
@@ -7147,4 +7147,4 @@
         <value xml:lang="zh">生成缺失的搜索引擎优化的网址</value>
         <value xml:lang="zh-TW">產生缺失的搜尋引擎優化的網址</value>
     </property>
-</resource>
\ No newline at end of file
+</resource>
diff --git a/applications/order/template/order/AddOrderAttachments.ftl b/applications/order/template/order/AddOrderAttachments.ftl
index 17033d8664..3955a5d40a 100644
--- a/applications/order/template/order/AddOrderAttachments.ftl
+++ b/applications/order/template/order/AddOrderAttachments.ftl
@@ -49,7 +49,7 @@ under the License.
         </select>
       </div>
       <div>
-        <input type="file" name="uploadedFile" class="required" size="25" accept=".png,.gif,.jpg,.jpeg,.tiff,.tif"/>
+        <input type="file" name="uploadedFile" class="required" size="25"/>
       </div>
       <div>
         <button type="submit">


[ofbiz-framework] 03/03: Improved: Required field not working on upload type form (OFBIZ-12619)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit e8750ec581a2cb373a8240d0aeebd2fb5c290a02
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sat May 21 10:39:58 2022 +0200

    Improved: Required field not working on upload type form (OFBIZ-12619)
    
    Fixes a checkstyle issue
---
 .../org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
index 6b20669e7e..d7501ae6a9 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
@@ -323,9 +323,9 @@ public final class MacroFormRenderer implements FormStringRenderer {
     }
 
     private boolean shouldApplyRequiredField(ModelFormField modelFormField) {
-        return ("single".equals(modelFormField.getModelForm().getType()) ||
-             "upload".equals(modelFormField.getModelForm().getType()))
-             && modelFormField.getRequiredField();
+        return ("single".equals(modelFormField.getModelForm().getType())
+                || "upload".equals(modelFormField.getModelForm().getType()))
+                && modelFormField.getRequiredField();
     }
 
     @Override