Author: jleroux
Date: Wed Nov 29 15:35:13 2017
New Revision: 1816635
URL: http://svn.apache.org/viewvc?rev=1816635&view=rev
Log:
Fixed: Improvements in gift certificate process
(OFBIZ-10027)
Sending mail should be async as it should not affect the regular workflow.
createGiftCertificate service doesn't create FinAccount with proper data.
Like currency, name, ownerPartyId etc is not handled properly.
Thanks: Suraj Khurana
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java?rev=1816635&r1=1816634&r2=1816635&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java
Wed Nov 29 15:35:13 2017
@@ -64,7 +64,7 @@ public class GiftCertificateServices {
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productStoreId = (String) context.get("productStoreId");
BigDecimal initialAmount = (BigDecimal) context.get("initialAmount");
-
+ String currency = (String) context.get("currency");
String partyId = (String) context.get("partyId");
if (UtilValidate.isEmpty(partyId)) {
partyId = "_NA_";
@@ -111,7 +111,14 @@ public class GiftCertificateServices {
acctCtx.put("userLogin", userLogin);
acctResult = dispatcher.runSync("createFinAccount", acctCtx);
} else {
- acctResult = dispatcher.runSync("createFinAccountForStore",
UtilMisc.<String, Object>toMap("productStoreId", productStoreId,
"finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId, "userLogin",
userLogin));
+ Map<String, Object> createAccountCtx = new HashMap<String,
Object>();
+ createAccountCtx.put("ownerPartyId", partyId);
+ createAccountCtx.put("finAccountTypeId",
FinAccountHelper.giftCertFinAccountTypeId);
+ createAccountCtx.put("productStoreId", productStoreId);
+ createAccountCtx.put("currencyUomId", currency);
+ createAccountCtx.put("finAccountName", accountName + "for
party ["+partyId+"]");
+ createAccountCtx.put("userLogin", userLogin);
+ acctResult = dispatcher.runSync("createFinAccountForStore",
createAccountCtx);
if (acctResult.get("finAccountId") != null) {
finAccountId = cardNumber = (String)
acctResult.get("finAccountId");
}
@@ -921,7 +928,7 @@ public class GiftCertificateServices {
// SC 20060405: Changed to runSync because runAsync kept
getting an error:
// Problem serializing service attributes (Cannot serialize
object of class java.util.PropertyResourceBundle)
try {
- dispatcher.runSync("sendMailFromScreen", emailCtx);
+ dispatcher.runAsync("sendMailFromScreen", emailCtx);
} catch (GenericServiceException e) {
Debug.logError(e, "Problem sending mail", module);
// this is fatal; we will rollback and try again later