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 2023/03/10 08:00:56 UTC

[ofbiz-framework] branch trunk updated: Implemented: Show used promotion codes (OFBIZ-12756) (#590)

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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 08368d624e Implemented: Show used promotion codes (OFBIZ-12756) (#590)
08368d624e is described below

commit 08368d624ed2bcf2f5ca09e522dbd393681d6f20
Author: cshan-ecomify <11...@users.noreply.github.com>
AuthorDate: Fri Mar 10 09:00:50 2023 +0100

    Implemented: Show used promotion codes (OFBIZ-12756) (#590)
    
    Added a feature to display how many times a certain promotion code has
    been used.
---
 applications/product/config/ProductUiLabels.xml    | 30 ++++++++++++++++++++++
 applications/product/widget/catalog/PromoForms.xml |  9 +++++++
 .../product/widget/catalog/PromoScreens.xml        | 10 +++++++-
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/applications/product/config/ProductUiLabels.xml b/applications/product/config/ProductUiLabels.xml
index d63875a64b..0203b55f71 100644
--- a/applications/product/config/ProductUiLabels.xml
+++ b/applications/product/config/ProductUiLabels.xml
@@ -7415,6 +7415,21 @@
         <value xml:lang="zh">重复使用信息标识</value>
         <value xml:lang="zh-TW">重複使用資訊識別</value>
     </property>
+    <property key="FormFieldTitle_redeemedCodesCount">
+        <value xml:lang="de">Eingelöst</value>
+        <value xml:lang="en">Redeemed</value>
+        <value xml:lang="es">Redimido</value>
+        <value xml:lang="fr">Encaissé</value>
+        <value xml:lang="it">Riscattato</value>
+        <value xml:lang="ja">止揚された</value>
+        <value xml:lang="nl">Afgelost</value>
+        <value xml:lang="ro">Răscumpărat</value>
+        <value xml:lang="ru">выкуплено</value>
+        <value xml:lang="th">แลกแล้ว</value>
+        <value xml:lang="vi">Chuộc lại</value>
+        <value xml:lang="zh">赎回了</value>
+        <value xml:lang="zh-TW">贖回了</value>
+    </property>
     <property key="FormFieldTitle_rejectionId">
         <value xml:lang="de">Ablehnung ID</value>
         <value xml:lang="en">Rejection ID</value>
@@ -11399,6 +11414,21 @@
         <value xml:lang="zh">查找产品促销代码</value>
         <value xml:lang="zh-TW">尋找產品促銷代碼</value>
     </property>
+    <property key="PageTitleFindProductPromotionCodeRedeemed">
+        <value xml:lang="de">eingelöst</value>
+        <value xml:lang="en">redeemed</value>
+        <value xml:lang="es">redimido</value>
+        <value xml:lang="fr">encaissé</value>
+        <value xml:lang="it">riscattato</value>
+        <value xml:lang="ja">止揚された</value>
+        <value xml:lang="nl">afgelost</value>
+        <value xml:lang="ro">răscumpărat</value>
+        <value xml:lang="ru">выкуплено</value>
+        <value xml:lang="th">แลกแล้ว</value>
+        <value xml:lang="vi">chuộc lại</value>
+        <value xml:lang="zh">赎回了</value>
+        <value xml:lang="zh-TW">贖回了</value>
+    </property>
     <property key="PageTitleFindProductStocktake">
         <value xml:lang="en">Find Product Stocktake</value>
         <value xml:lang="es">Buscar inventario de Producto</value>
diff --git a/applications/product/widget/catalog/PromoForms.xml b/applications/product/widget/catalog/PromoForms.xml
index 8fdf20afb1..fbb2538c64 100644
--- a/applications/product/widget/catalog/PromoForms.xml
+++ b/applications/product/widget/catalog/PromoForms.xml
@@ -100,6 +100,12 @@ under the License.
     </form>
     <grid name="ListProductPromoCodes" list-name="productPromoCodes"
         odd-row-style="alternate-row" default-table-style="basic-table">
+        <row-actions>
+            <entity-and entity-name="ProductPromoUse" list="usages">
+                <field-map field-name="productPromoId" from-field="productPromoId"/>
+                <field-map field-name="productPromoCodeId" from-field="productPromoCodeId"/>
+            </entity-and>
+        </row-actions>
         <auto-fields-entity entity-name="ProductPromoCode" default-field-type="display"/>
         <field name="productPromoId"><hidden/></field>
         <field name="productPromoCodeId" widget-style="buttontext">
@@ -107,6 +113,9 @@ under the License.
                 <parameter param-name="productPromoCodeId"/>
             </hyperlink>
         </field>
+        <field name="usages" title="${uiLabelMap.FormFieldTitle_redeemedCodesCount}">
+            <display description="${groovy: usages.size()} / ${useLimitPerCode}"></display>
+        </field>
         <field name="deleteLink" title=" " widget-style="buttontext">
             <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteProductPromoCode" also-hidden="false">
                 <parameter param-name="productPromoCodeId"/>
diff --git a/applications/product/widget/catalog/PromoScreens.xml b/applications/product/widget/catalog/PromoScreens.xml
index 6817543593..b7100225ea 100644
--- a/applications/product/widget/catalog/PromoScreens.xml
+++ b/applications/product/widget/catalog/PromoScreens.xml
@@ -239,6 +239,12 @@ under the License.
                     </condition-list>
                     <order-by field-name="-createdDate"/>
                 </entity-condition>
+                <entity-and entity-name="ProductPromoUse" list="productPromoUses">
+                    <field-map field-name="productPromoId" from-field="productPromoId"/>
+                </entity-and>
+                <entity-and entity-name="ProductPromoCode" list="productPromoCodes">
+                    <field-map field-name="productPromoId" from-field="productPromoId"/>
+                </entity-and>
             </actions>
             <widgets>
                 <decorator-screen name="CommonPromoDecorator">
@@ -269,7 +275,9 @@ under the License.
                                 </container>
                             </fail-widgets>
                         </section>
-                        <screenlet title="${uiLabelMap.PageTitleFindProductPromotionCode}">
+                        <screenlet title="${uiLabelMap.PageTitleFindProductPromotionCode}: ${groovy: productPromoUses.size()} / ${groovy: 
+                        [org.apache.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(productPromoCodes, 'useLimitPerCode', false).sum(), 
+                        productPromo.useLimitPerPromotion].min()} ${uiLabelMap.PageTitleFindProductPromotionCodeRedeemed}">
                             <include-grid name="ListProductPromoCodes" location="component://product/widget/catalog/PromoForms.xml"/>
                         </screenlet>
                         <platform-specific>