svn commit: r834042 - in /ofbiz/trunk: applications/order/config/ applications/order/webapp/ordermgr/WEB-INF/actions/entry/ applications/order/webapp/ordermgr/order/ applications/order/widget/ordermgr/ applications/product/data/ specialpurpose/ecommerc...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r834042 - in /ofbiz/trunk: applications/order/config/ applications/order/webapp/ordermgr/WEB-INF/actions/entry/ applications/order/webapp/ordermgr/order/ applications/order/widget/ordermgr/ applications/product/data/ specialpurpose/ecommerc...

ashish-18
Author: ashish
Date: Mon Nov  9 12:53:03 2009
New Revision: 834042

URL: http://svn.apache.org/viewvc?rev=834042&view=rev
Log:
Applied improved patch from jira issue OFBIZ-3165 - Add additional screen for gift card certificate buying functionality by CSR in Order manager application in add item page.
Following points are covered in this patch:

1) Removed hard-coded product ids for Gift certificates products from GiftCertificates.ftl and added new category type called "GIFT_CARD_CATEGORY" and related demo data, also added groovy script for fetching logic to address this issue.

2) Also handled hard-coded surveyId in AddGiftCertificates.groovy

3) Added user friendly messages if required data is not available .

4) Added missing license header in GiftCertificates.ftl

Thanks Divesh for the contribution.

Added:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy   (with props)
Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/order/GiftCertificates.ftl
    ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml
    ofbiz/trunk/applications/product/data/ProductTypeData.xml
    ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml

Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.xml?rev=834042&r1=834041&r2=834042&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.xml (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.xml Mon Nov  9 12:53:03 2009
@@ -4272,6 +4272,9 @@
         <value xml:lang="zh">无渠道</value>
         <value xml:lang="zh_CN">无渠道</value>
     </property>
+    <property key="OrderNoGiftCertificatesFound">
+        <value xml:lang="en">No Gift Certificates Found</value>
+    </property>
     <property key="OrderNoGiftWrap">
         <value xml:lang="de">Keine Geschenkverpackung</value>
         <value xml:lang="en">No Gift Wrap</value>
@@ -4375,6 +4378,9 @@
         <value xml:lang="th">ไม่มีสิทธิพิเศษที่เกี่ยวข้องกับการชำระเงินด้วยรายการสั่งซื้อสินค้านี้</value>
         <value xml:lang="zh">没有与这个订单关联的支付优先方式。</value>
     </property>
+    <property key="OrderNoProductStoreFinAccountSettingsFound">
+        <value xml:lang="en">No Product Store FinAcccount Settings found</value>
+    </property>
     <property key="OrderNoPurchaseOrderSpecified">
         <value xml:lang="de">Kein Beschaffungsauftrag angegeben.</value>
         <value xml:lang="en">No Purchase Order Specified</value>

Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy?rev=834042&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy Mon Nov  9 12:53:03 2009
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import javolution.util.FastList;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.product.store.ProductStoreWorker;
+
+cart = session.getAttribute("shoppingCart");
+productStoreId = ProductStoreWorker.getProductStoreId(request);
+if (productStoreId == null) {
+    productStoreId = cart.getProductStoreId();
+}
+
+// Get Gift cards availbale in data
+
+giftCardCategories = delegator.findList("ProductCategory", EntityCondition.makeCondition("productCategoryTypeId", EntityOperator.EQUALS, "GIFT_CARD_CATEGORY"), null, null, null, false);
+giftCardProductList = FastList.newInstance();
+if (UtilValidate.isNotEmpty(giftCardCategories)) {
+    giftCardCategories.each { giftCardCategory ->
+        giftCardCategoryMembers = delegator.findList("ProductCategoryMember", EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, giftCardCategory.productCategoryId), null, null, null, false);
+        if (UtilValidate.isNotEmpty(giftCardCategoryMembers)) {
+            giftCardCategoryMembers.each { giftCardCategoryMember ->
+                giftCardProducts = delegator.findList("ProductAndPriceView", EntityCondition.makeCondition("productId", EntityOperator.EQUALS, giftCardCategoryMember.productId), null, null, null, false);
+                if (UtilValidate.isNotEmpty(giftCardProducts)) {
+                    giftCardProducts.each { giftCardProduct ->
+                        giftCardProductList.add(giftCardProduct);
+                    }
+                }
+            }
+        }
+    }
+}
+context.giftCardProductList = giftCardProductList;
+
+// Get Survey Id for Gift Certificates
+
+ProductStoreFinActSetting = delegator.findOne("ProductStoreFinActSetting", [productStoreId : productStoreId, finAccountTypeId : "GIFTCERT_ACCOUNT"], false);
+context.surveyId = ProductStoreFinActSetting.purchaseSurveyId;
+

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/GiftCertificates.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/GiftCertificates.ftl?rev=834042&r1=834041&r2=834042&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/GiftCertificates.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/GiftCertificates.ftl Mon Nov  9 12:53:03 2009
@@ -1,41 +1,59 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
 <form id="addGiftCertificate" action="<@ofbizUrl>addGiftCertificateSurvey</@ofbizUrl>" method="post">
   <fieldset>
-    <input type="hidden" name="quantity" value="1" />
-    <input type="hidden" name="surveyId" value="1000" />
-    <label>${uiLabelMap.OrderSelectGiftAmount}</label>
-    <div>
-      <input type="radio" name="add_product_id" id="productId_10" value="GC-001-C10" checked="checked" />
-      <label for="productId_10">$10</label>
-    </div>
-    <div>
-      <input type="radio" name="add_product_id" id="productId_25" value="GC-001-C25" />
-      <label for="productId_25">$25</label>
-    </div>
-    <div>
-      <input type="radio" name="add_product_id" id="productId_50" value="GC-001-C50" />
-      <label for="productId_50">$50</label>
-    </div>
-    <div>
-      <input type="radio" name="add_product_id" id="productId_100" value="GC-001-C100" />
-      <label for="productId_100">$100</label>
-    </div>
-    <div>
-      <label for="emailAddress">${uiLabelMap.OrderRecipientEmailAdd}</label>
-      <input type="text" id="emailAddress" name="answers_1002" value="" />
-    </div>
-    <div>
-      <label for="recipientName">${uiLabelMap.OrderRecipientName}</label>
-      <input type="text" id="recipientName" name="answers_1001" value="" />
-    </div>
-    <div>
-      <label for="senderName">${uiLabelMap.OrderSenderName}</label>
-      <input type="text" id="senderName" name="answers_1000" value="" />
-    <div>
-      <label for="message">${uiLabelMap.OrderGiftMessage}:</label>
-      <textarea id="message" name="answers_1003"></textarea>
-    </div>
-    <div>
-      <input type="submit" value="${uiLabelMap.CommonSubmit}" />
-    </div>
+    <#if surveyId?exists && surveyId?has_content>
+      <input type="hidden" name="quantity" value="1" />
+      <input type="hidden" name="surveyId" value="${surveyId?if_exists}" />
+      <#if giftCardProductList?has_content>
+        <label>${uiLabelMap.OrderSelectGiftAmount}</label>
+        <#list giftCardProductList?sort_by("price") as giftCardProduct>
+          <div>
+            <input type="radio" name="add_product_id" id="productId_${giftCardProduct.price?if_exists}" value="${giftCardProduct.productId?if_exists}" checked="checked" />
+            <label for="productId_${giftCardProduct.price?if_exists}"> ${giftCardProduct.productId?if_exists}&nbsp;:&nbsp;${giftCardProduct.productName?if_exists}&nbsp;:&nbsp;<@ofbizCurrency amount=giftCardProduct.price?if_exists isoCode=currencyUomId/></label>
+          </div>
+        </#list>
+        <div>
+          <label for="emailAddress">${uiLabelMap.OrderRecipientEmailAdd}</label>
+          <input type="text" id="emailAddress" name="answers_1002" value="" />
+        </div>
+        <div>
+          <label for="recipientName">${uiLabelMap.OrderRecipientName}</label>
+          <input type="text" id="recipientName" name="answers_1001" value="" />
+        </div>
+        <div>
+          <label for="senderName">${uiLabelMap.OrderSenderName}</label>
+          <input type="text" id="senderName" name="answers_1000" value="" />
+        <div>
+          <label for="message">${uiLabelMap.OrderGiftMessage}:</label>
+          <textarea id="message" name="answers_1003"></textarea>
+        </div>
+        <div>
+          <input type="submit" value="${uiLabelMap.CommonSubmit}" />
+        </div>
+      <#else>
+        <label>${uiLabelMap.OrderNoGiftCertificatesFound}</label>
+      </#if>
+    <#else>
+      <label>${uiLabelMap.OrderNoProductStoreFinAccountSettingsFound}</label>
+    </#if>
   </fieldset>
 </form>
+

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml?rev=834042&r1=834041&r2=834042&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Mon Nov  9 12:53:03 2009
@@ -201,6 +201,7 @@
         <section>
             <actions>
                 <set field="titleProperty" value="OrderAddGiftCertificate"/>
+                <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/AddGiftCertificates.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonOrderCatalogDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">

Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=834042&r1=834041&r2=834042&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Mon Nov  9 12:53:03 2009
@@ -204,6 +204,7 @@
     <ProductCategoryType description="Cross Sell" hasTable="N" parentTypeId="" productCategoryTypeId="CROSS_SELL_CATEGORY"/>
     <ProductCategoryType description="Tax" hasTable="N" parentTypeId="" productCategoryTypeId="TAX_CATEGORY"/>
     <ProductCategoryType description="Google Base" hasTable="N" parentTypeId="" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/>
+    <ProductCategoryType description="Gift Cards" hasTable="N" parentTypeId="" productCategoryTypeId="GIFT_CARD_CATEGORY"/>
 
     <!-- product geo data -->
     <EnumerationType description="Product Geo Data" enumTypeId="PROD_GEO" hasTable="N" parentTypeId=""/>

Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml?rev=834042&r1=834041&r2=834042&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml Mon Nov  9 12:53:03 2009
@@ -803,6 +803,7 @@
     <ProductCategory productCategoryId="GC-100" productCategoryTypeId="CATALOG_CATEGORY"/>
     <ProductCategory productCategoryId="GC-101" productCategoryTypeId="CATALOG_CATEGORY"/>
     <ProductCategory productCategoryId="GC-102" productCategoryTypeId="CATALOG_CATEGORY"/>
+    <ProductCategory productCategoryId="GC-103" productCategoryTypeId="GIFT_CARD_CATEGORY"/>
 
     <Product productId="GC-002" productTypeId="DIGITAL_GOOD" primaryProductCategoryId="GC-102" internalName="Gift Card Reload" productName="Gift Card Reload" description="Add more money to your card!" requireAmount="Y" returnable="N" includeInPromotions="N" taxable="N" chargeShipping="N" isVirtual="N" isVariant="N" createdDate="2003-11-20 13:48:19.105" createdByUserLogin="admin" lastModifiedDate="2003-11-20 13:48:19.105" lastModifiedByUserLogin="admin"/>
     <Product productId="GC-001" productTypeId="DIGITAL_GOOD" primaryProductCategoryId="GC-101" internalName="Gift Card Activation" productName="Gift Card Activation" description="Give the perfect gift!" returnable="N" includeInPromotions="N" taxable="N" chargeShipping="N" isVirtual="Y" isVariant="N" createdDate="2003-11-20 13:48:19.105" createdByUserLogin="admin" lastModifiedDate="2003-11-20 13:48:19.105" lastModifiedByUserLogin="admin"/>
@@ -851,6 +852,10 @@
     <ProductCategoryMember productCategoryId="GC-101" productId="GC-001-H25" fromDate="2001-05-13 12:00:00.0"/>
     <ProductCategoryMember productCategoryId="GC-101" productId="GC-001-H50" fromDate="2001-05-13 12:00:00.0"/>
     <ProductCategoryMember productCategoryId="GC-101" productId="GC-001-HO" fromDate="2001-05-13 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="GC-103" productId="GC-001-C10" fromDate="2001-05-13 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="GC-103" productId="GC-001-C25" fromDate="2001-05-13 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="GC-103" productId="GC-001-C50" fromDate="2001-05-13 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="GC-103" productId="GC-001-C100" fromDate="2001-05-13 12:00:00.0"/>
     <ProductCategoryMember productCategoryId="PROMOTIONS" productId="GC-001" fromDate="2001-05-13 12:00:00.0"/>
     <ProductCategoryMember productCategoryId="PROMOTIONS" productId="GC-002" fromDate="2001-05-13 12:00:00.0"/>
     <ProductCategoryMember productCategoryId="CATALOG1_SEARCH" productId="GC-001" fromDate="2001-05-13 12:00:00.0"/>