svn commit: r1857180 - in /ofbiz/ofbiz-framework/trunk/applications/order: minilang/shoppinglist/ minilang/test/ src/main/java/org/apache/ofbiz/order/shoppinglist/

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

svn commit: r1857180 - in /ofbiz/ofbiz-framework/trunk/applications/order: minilang/shoppinglist/ minilang/test/ src/main/java/org/apache/ofbiz/order/shoppinglist/

jleroux@apache.org
Author: jleroux
Date: Tue Apr  9 11:58:22 2019
New Revision: 1857180

URL: http://svn.apache.org/viewvc?rev=1857180&view=rev
Log:
Fixed: Quick Add button for shopping list on Orderentry screen is not working
(OFBIZ-9908)

Steps to generate
1. Navigate to https://demo-trunk.ofbiz.apache.org/ordermgr/control/orderentry
2. Press continue on sales order screen.
3. Add any finished good product to the sales order
4. In 'Add Order Items to Shopping List' section, select 'new shopping list'
   from the drop down and click on 'Add to shopping list' button
5. you navigate to 'addBulkToShoppingList' screen, click on 'Quick Add' button.
Issue: The quick add button is not working.

jleroux: as suggested by Ankush: "One of possible workaround is calling
createShoppingList with new transaction to resolve this deadlock issue."

This just does that for every calls.

Thanks: Garima jain for report, Rohit Hukkeri for discussion and Ankush Upadhyay
for fix suggestion

Modified:
    ofbiz/ofbiz-framework/trunk/applications/order/minilang/shoppinglist/ShoppingListServices.xml
    ofbiz/ofbiz-framework/trunk/applications/order/minilang/test/ShoppingListTests.xml
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java

Modified: ofbiz/ofbiz-framework/trunk/applications/order/minilang/shoppinglist/ShoppingListServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/minilang/shoppinglist/ShoppingListServices.xml?rev=1857180&r1=1857179&r2=1857180&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/minilang/shoppinglist/ShoppingListServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/minilang/shoppinglist/ShoppingListServices.xml Tue Apr  9 11:58:22 2019
@@ -307,7 +307,7 @@ under the License.
             <set field="createShoppingListInMap.listName" value="Auto Suggestions"/>
             <set field="createShoppingListInMap.shoppingListTypeId" value="SLT_WISH_LIST"/>
             <set field="createShoppingListInMap.productStoreId" from-field="parameters.productStoreId"/>
-            <call-service service-name="createShoppingList" in-map-name="createShoppingListInMap">
+            <call-service service-name="createShoppingList" in-map-name="createShoppingListInMap" require-new-transaction="true">
                 <result-to-field result-name="shoppingListId"/>
             </call-service>
         <else>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/minilang/test/ShoppingListTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/minilang/test/ShoppingListTests.xml?rev=1857180&r1=1857179&r2=1857180&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/minilang/test/ShoppingListTests.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/minilang/test/ShoppingListTests.xml Tue Apr  9 11:58:22 2019
@@ -33,7 +33,7 @@ under the License.
             <field-map field-name="userLoginId" value="DemoCustomer"/>
         </entity-one>
         <set field="serviceCtx.userLogin" from-field="userLogin"/>
-        <call-service service-name="createShoppingList" in-map-name="serviceCtx">
+        <call-service service-name="createShoppingList" in-map-name="serviceCtx" require-new-transaction="true">
             <result-to-field result-name="shoppingListId"/>
         </call-service>
         <entity-one entity-name="ShoppingList" value-field="shoppingList"/>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1857180&r1=1857179&r2=1857180&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java Tue Apr  9 11:58:22 2019
@@ -103,7 +103,10 @@ public class ShoppingListEvents {
             // create a new shopping list
             Map<String, Object> newListResult = null;
             try {
-                newListResult = dispatcher.runSync("createShoppingList", UtilMisc.<String, Object>toMap("userLogin", userLogin, "productStoreId", cart.getProductStoreId(), "partyId", cart.getOrderPartyId(), "shoppingListTypeId", shoppingListTypeId, "currencyUom", cart.getCurrency()));
+                newListResult = dispatcher.runSync("createShoppingList", UtilMisc.<String, Object>toMap("userLogin", userLogin,
+                        "productStoreId", cart.getProductStoreId(), "partyId", cart.getOrderPartyId(),
+                        "shoppingListTypeId", shoppingListTypeId, "currencyUom", cart.getCurrency()),
+                        90, true);
                 if (ServiceUtil.isError(newListResult)) {
                     String errorMessage = ServiceUtil.getErrorMessage(newListResult);
                     Debug.logError(errorMessage, module);
@@ -372,7 +375,7 @@ public class ShoppingListEvents {
         }
         if (list == null && dispatcher != null) {
             Map<String, Object> listFields = UtilMisc.<String, Object>toMap("userLogin", userLogin, "productStoreId", productStoreId, "shoppingListTypeId", "SLT_SPEC_PURP", "listName", PERSISTANT_LIST_NAME);
-            Map<String, Object> newListResult = dispatcher.runSync("createShoppingList", listFields);
+            Map<String, Object> newListResult = dispatcher.runSync("createShoppingList", listFields, 90, true););
             if (ServiceUtil.isError(newListResult)) {
                 String errorMessage = ServiceUtil.getErrorMessage(newListResult);
                 Debug.logError(errorMessage, module);
@@ -652,7 +655,7 @@ public class ShoppingListEvents {
             if (UtilValidate.isEmpty(autoSaveListId)) {
                 try {
                     Map<String, Object> listFields = UtilMisc.<String, Object>toMap("userLogin", userLogin, "productStoreId", productStoreId, "shoppingListTypeId", "SLT_SPEC_PURP", "listName", PERSISTANT_LIST_NAME);
-                    Map<String, Object> newListResult = dispatcher.runSync("createShoppingList", listFields);
+                    Map<String, Object> newListResult = dispatcher.runSync("createShoppingList", listFields, 90, true););
                     if (ServiceUtil.isError(newListResult)) {
                         String errorMessage = ServiceUtil.getErrorMessage(newListResult);
                         Debug.logError(errorMessage, module);

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1857180&r1=1857179&r2=1857180&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java Tue Apr  9 11:58:22 2019
@@ -291,7 +291,7 @@ public class ShoppingListServices {
                 Map<String, Object> newListResult = null;
                 try {
 
-                    newListResult = dispatcher.runSync("createShoppingList", serviceCtx);
+                    newListResult = dispatcher.runSync("createShoppingList", serviceCtx, 90, true););
                 } catch (GenericServiceException e) {
                     Debug.logError(e, "Problems creating new ShoppingList", module);
                     return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToCreateNewShoppingList",locale));