Author: mrisaliti
Date: Sat Jan 15 11:54:04 2011
New Revision: 1059306
URL: http://svn.apache.org/viewvc?rev=1059306&view=rev
Log:
Internationalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure,
ServiceUtil.returnError (OFBIZ-4091)
Modified:
ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
Modified: ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml?rev=1059306&r1=1059305&r2=1059306&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
(original)
+++ ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml Sat
Jan 15 11:54:04 2011
@@ -23,18 +23,114 @@
<value xml:lang="en">Could not find RateAmount record to be
deleted</value>
<value xml:lang="it">Non è possibile trovare un record di RateAmount
che deve essere cancellato</value>
</property>
+ <property key="AccountingFinAccountAuthorizationExpired">
+ <value xml:lang="en">Authorization transaction
${paymentGatewayResponseId} has expired as of ${authExpiration}</value>
+ <value xml:lang="it">Autorizzazione transazione
${paymentGatewayResponseId} ha una scadenza del ${authExpiration}</value>
+ </property>
+ <property key="AccountingFinAccountCancelled">
+ <value xml:lang="en">Account has been cancelled</value>
+ <value xml:lang="it">Il conto è stato cancellato</value>
+ </property>
+ <property key="AccountingFinAccountCannotBeAuthorized">
+ <value xml:lang="en">Cannot authorize financial account due to:
${errorString}</value>
+ <value xml:lang="it">Non è possibile autorizzare il conto finanziario
per: ${errorString}</value>
+ </property>
+ <property key="AccountingFinAccountCannotBeExpired">
+ <value xml:lang="en">Unable to expire financial account authorization:
</value>
+ <value xml:lang="it">Non è possibile cancellare l'autorizzazione per
il conto finanziario: </value>
+ </property>
+ <property key="AccountingFinAccountCannotBeRefunded">
+ <value xml:lang="en">Available balance does not match the actual
balance; pending authorizations; cannot refund FinAccount at this time.</value>
+ <value xml:lang="it">Bilancio disponibilie non corrisponde all'attuale
bilancio; autorizzazioni in attesa; non è possibile rimborsare il conto
finanziario in questo momento.</value>
+ </property>
+ <property key="AccountingFinAccountCannotBeReplenish">
+ <value xml:lang="en">Cannot locate product store from previous
deposits; product store cannot be empty</value>
+ <value xml:lang="it">Non è possibile localizzare il negozio dei
precedenti depositi; il negozio non può essere vuoto</value>
+ </property>
+ <property key="AccountingFinAccountCannotCapture">
+ <value xml:lang="en">No authorization transaction found for the
OrderPaymentPreference; cannot capture</value>
+ <value xml:lang="it">Nessuna transazione di autorizzazione trovata per
le preferenze pagamento ordine; non è possibile catturare</value>
+ </property>
+ <property key="AccountingFinAccountCannotCreate">
+ <value xml:lang="en">Unable to create financial accout; no
productStoreId on OrderHeader: ${orderId}</value>
+ <value xml:lang="it">Non è possibile creare conto finanziario; nessun
negozio impostato sulla testata ordine: ${orderId}</value>
+ </property>
+ <property key="AccountingFinAccountCannotCreditAccount">
+ <value xml:lang="en">Could not find or create a service credit
account</value>
+ <value xml:lang="it">Non è possibile trovare o creare un servizio di
accredito conto</value>
+ </property>
+ <property key="AccountingFinAccountCannotFindAuthorization">
+ <value xml:lang="en"> Could not find authorization transaction.</value>
+ <value xml:lang="it"> Non è possibile trovare la transazione di
autorizzazione.</value>
+ </property>
+ <property key="AccountingFinAccountCannotLocateItFromAccountCode">
+ <value xml:lang="en">Unable to locate financial account from account
code</value>
+ <value xml:lang="it">Non è possibile localizzare il conto finanziario
dal codice conto</value>
+ </property>
<property key="AccountingFinAccountCannotPost">
<value xml:lang="en">Cannot post FinAccountTrans with ID
${parameters.finAccountTransId} to GL, could not find ${creditDebit}
${requiredField}</value>
<value xml:lang="it">Non post FinAccountTrans con ID
${parameters.finAccountTransId} in GL, could not find ${creditDebit}
${requiredField}</value>
</property>
+ <property key="AccountingFinAccountExpired">
+ <value xml:lang="en">Account has expired as of ${thruDate}</value>
+ <value xml:lang="it">Conto scaduto dal ${thruDate}</value>
+ </property>
+ <property key="AccountingFinAccountFrozen">
+ <value xml:lang="en">Account is currently frozen</value>
+ <value xml:lang="it">Il conto è attualmente congelato</value>
+ </property>
+ <property key="AccountingFinAccountIdAndFinAccountCodeAreNull">
+ <value xml:lang="en">Both finAccountId and finAccountCode cannot be
null; at least one is required</value>
+ <value xml:lang="it">Entrambi finAccountId e finAccountCode non
possono essere nulli; al minimo uno è richiesto</value>
+ </property>
+ <property key="AccountingFinAccountIdInvalid">
+ <value xml:lang="en">Invalid financial account; cannot locate
account</value>
+ <value xml:lang="it">Conto finanziario invalido; non è possibile
localizzare il conto</value>
+ </property>
<property key="AccountingFinAccountInactiveStatusError">
<value xml:lang="en">FinAccount must be in active status</value>
<value xml:lang="fr">Le compte financier doit être dans un état
actif</value>
</property>
+ <property key="AccountingFinAccountIsNotRefundable">
+ <value xml:lang="en">Account is not refunable</value>
+ <value xml:lang="it">Il conto non è rimborsabile</value>
+ </property>
+ <property key="AccountingFinAccountNegative">
+ <value xml:lang="en">Account is currently negative and pending
replenishment</value>
+ <value xml:lang="it">Il conto è attualmente negativo e in attesa di
rifornimento</value>
+ </property>
+ <property
key="AccountingFinAccountNoPaymentMethodAssociatedWithReplenishAccount">
+ <value xml:lang="en">No payment method associated with replenish
account</value>
+ <value xml:lang="it">Nessun metodo pagamento associtao con il conto di
rifornimento</value>
+ </property>
+ <property key="AccountingFinAccountNotFound">
+ <value xml:lang="en">No finAccountId found ${finAccountId}</value>
+ <value xml:lang="it">Conto finanziario non trovato
${finAccountId}</value>
+ </property>
+ <property key="AccountingFinAccountPartiallyRefunded">
+ <value xml:lang="en">FinAccount partially refunded; not enough
replenish deposits to refund!</value>
+ <value xml:lang="it">Conto finanziario parzialmente rimborsato; non ci
sono abbastanza depositi per il rifornimento da rimborsare!</value>
+ </property>
+ <property key="AccountingFinAccountPinCodeCombinatorNotFound">
+ <value xml:lang="en">Financial account PIN/CODE combination not
found</value>
+ <value xml:lang="it">Conto finanziario combinazione PIN/CODE non
trovata</value>
+ </property>
+ <property key="AccountingFinAccountMustBePositive">
+ <value xml:lang="en">Amount should be a positive number.</value>
+ <value xml:lang="it">L'importo dovrebbe essere un numero
positivo.</value>
+ </property>
+ <property key="AccountingFinAccountSetting">
+ <value xml:lang="en">No settings found for store ${productStoreId} for
fin account type ${finAccountTypeId}</value>
+ <value xml:lang="it">Nessuna configurazione trovata per il negozio
${productStoreId} per il tipo conto finanziario ${finAccountTypeId}</value>
+ </property>
<property key="AccountingFinAccountStatusNotValidError">
<value xml:lang="en">FinAccount not in valid status</value>
<value xml:lang="fr">Le compte financier n'est pas dans un état
valide</value>
</property>
+ <property key="AccountingFinAccountUnknownReplenishMethod">
+ <value xml:lang="en">Unknown replenish method found</value>
+ <value xml:lang="it">Metodo rifornimento sconosciuto</value>
+ </property>
<property key="AccountingPartyAcctgPreferenceNotDefine">
<value xml:lang="en">Acctg preference not define</value>
<value xml:lang="fr">Aucune configuration sur les préférences de
gestion encore définie pour votre société</value>
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=1059306&r1=1059305&r2=1059306&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Sat Jan
15 11:54:04 2011
@@ -2133,6 +2133,10 @@
<value xml:lang="fr">Montant Commission</value>
<value xml:lang="hi_IN">दलालॠराशà¥</value>
</property>
+ <property key="AccountingCommissionInvoicesCreated">
+ <value xml:lang="en">Created Commission invoices for each commission
receiving parties ${invoicesCreated}</value>
+ <value xml:lang="it">Create fatture provvigioni per ogni provvigione
ricevuta dai soggetti ${invoicesCreated}</value>
+ </property>
<property key="AccountingCommissionRun">
<value xml:lang="de">Provisionslauf</value>
<value xml:lang="en">Commission Run</value>
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=1059306&r1=1059305&r2=1059306&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
Sat Jan 15 11:54:04 2011
@@ -22,6 +22,7 @@ package org.ofbiz.accounting.finaccount;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javolution.util.FastList;
@@ -56,13 +57,14 @@ import org.ofbiz.service.ServiceUtil;
public class FinAccountPaymentServices {
public static final String module =
FinAccountPaymentServices.class.getName();
+ public static final String resourceError = "AccountingErrorUiLabels";
// base payment integration services
public static Map<String, Object> finAccountPreAuth(DispatchContext dctx,
Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
-
+ Locale locale = (Locale) context.get("locale");
GenericValue paymentPref = (GenericValue)
context.get("orderPaymentPreference");
String finAccountCode = (String) context.get("finAccountCode");
String finAccountPin = (String) context.get("finAccountPin");
@@ -110,14 +112,17 @@ public class FinAccountPaymentServices {
finAccount =
FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
} catch (GenericEntityException e) {
Debug.logError(e, module);
- return ServiceUtil.returnError("Unable to locate financial
account from account code");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"AccountingFinAccountCannotLocateItFromAccountCode", locale));
}
} else {
- return ServiceUtil.returnError("Both finAccountId and
finAccountCode cannot be null; at least one is required");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountIdAndFinAccountCodeAreNull",
locale));
}
}
if (finAccount == null) {
- return ServiceUtil.returnError("Invalid financial account; cannot
locate account");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountIdInvalid", locale));
}
String finAccountTypeId = finAccount.getString("finAccountTypeId");
@@ -148,7 +153,8 @@ public class FinAccountPaymentServices {
if
("Y".equals(finAccountSettings.getString("requirePinCode"))) {
if (!FinAccountHelper.validatePin(delegator,
finAccountCode, finAccountPin)) {
Map<String, Object> result =
ServiceUtil.returnSuccess();
- result.put("authMessage", "Financial account PIN/CODE
combination not found");
+ result.put("authMessage",
UtilProperties.getMessage(resourceError,
+
"AccountingFinAccountPinCodeCombinatorNotFound", locale));
result.put("authResult", Boolean.FALSE);
result.put("processAmount", amount);
result.put("authFlag", "0");
@@ -163,7 +169,9 @@ public class FinAccountPaymentServices {
// check for expiration date
if ((finAccount.getTimestamp("thruDate") != null) &&
(finAccount.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) {
Map<String, Object> result = ServiceUtil.returnSuccess();
- result.put("authMessage", "Account has expired as of " +
finAccount.getTimestamp("thruDate"));
+ result.put("authMessage",
UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountExpired",
+ UtilMisc.toMap("thruDate",
finAccount.getTimestamp("thruDate")), locale));
result.put("authResult", Boolean.FALSE);
result.put("processAmount", amount);
result.put("authFlag", "0");
@@ -182,11 +190,14 @@ public class FinAccountPaymentServices {
if ("FNACT_NEGPENDREPL".equals(statusId) ||
"FNACT_MANFROZEN".equals(statusId) || "FNACT_CANCELLED".equals(statusId)) {
Map<String, Object> result = ServiceUtil.returnSuccess();
if ("FNACT_NEGPENDREPL".equals(statusId)) {
- result.put("authMessage", "Account is currently
negative and pending replenishment");
+ result.put("authMessage",
UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNegative", locale));
} else if ("FNACT_MANFROZEN".equals(statusId)) {
- result.put("authMessage", "Account is currently
frozen");
+ result.put("authMessage",
UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountFrozen", locale));
} else if ("FNACT_CANCELLED".equals(statusId)) {
- result.put("authMessage", "Account has been
cancelled");
+ result.put("authMessage",
UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCancelled", locale));
}
result.put("authResult", Boolean.FALSE);
result.put("processAmount", amount);
@@ -261,26 +272,31 @@ public class FinAccountPaymentServices {
return result;
} catch (GenericEntityException ex) {
Debug.logError(ex, "Cannot authorize financial account", module);
- return ServiceUtil.returnError("Cannot authorize financial account
due to " + ex.getMessage());
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotBeAuthorized",
+ UtilMisc.toMap("errorString", ex.getMessage()), locale));
} catch (GenericServiceException ex) {
- Debug.logError(ex, "Cannot authorize gift certificate", module);
- return ServiceUtil.returnError("Cannot authorize financial account
due to " + ex.getMessage());
+ Debug.logError(ex, "Cannot authorize financial account", module);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotBeAuthorized",
+ UtilMisc.toMap("errorString", ex.getMessage()), locale));
}
}
public static Map<String, Object> finAccountReleaseAuth(DispatchContext
dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
-
GenericValue paymentPref = (GenericValue)
context.get("orderPaymentPreference");
+ Locale locale = (Locale) context.get("locale");
- String err = "Unable to expire financial account authorization: ";
+ String err = UtilProperties.getMessage(resourceError,
"AccountingFinAccountCannotBeExpired", locale);
try {
// expire the related financial authorization transaction
GenericValue authTransaction =
PaymentGatewayServices.getAuthTransaction(paymentPref);
if (authTransaction == null) {
- return ServiceUtil.returnError(err + " Could not find
authorization transaction.");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotFindAuthorization",
locale));
}
Map<String, Object> input = UtilMisc.toMap("userLogin", userLogin,
"finAccountAuthId", authTransaction.get("referenceNum"));
@@ -306,6 +322,7 @@ public class FinAccountPaymentServices {
public static Map<String, Object> finAccountCapture(DispatchContext dctx,
Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -318,7 +335,8 @@ public class FinAccountPaymentServices {
authTrans =
PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
}
if (authTrans == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot capture");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotCapture", locale));
}
// get the auth record
@@ -345,12 +363,17 @@ public class FinAccountPaymentServices {
// make sure authorization has not expired
Timestamp authExpiration = finAccountAuth.getTimestamp("thruDate");
if ((authExpiration != null) &&
(authExpiration.before(UtilDateTime.nowTimestamp()))) {
- return ServiceUtil.returnError("Authorization transaction [" +
authTrans.getString("paymentGatewayResponseId") + "] has expired as of " +
authExpiration);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountAuthorizationExpired",
+ UtilMisc.toMap("paymentGatewayResponseId",
authTrans.getString("paymentGatewayResponseId"),
+ "authExpiration", authExpiration), locale));
}
// make sure the fin account itself has not expired
if ((finAccount.getTimestamp("thruDate") != null) &&
(finAccount.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) {
- return ServiceUtil.returnError("Financial account has expired as
of " + finAccount.getTimestamp("thruDate"));
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountExpired",
+ UtilMisc.toMap("thruDate",
finAccount.getTimestamp("thruDate")), locale));
}
String finAccountId = finAccount.getString("finAccountId");
@@ -424,6 +447,7 @@ public class FinAccountPaymentServices {
public static Map<String, Object> finAccountRefund(DispatchContext dctx,
Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -452,7 +476,8 @@ public class FinAccountPaymentServices {
}
if (finAccountId == null) {
- return ServiceUtil.returnError("No finAccountId found");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", ""), locale));
}
// call the deposit service
@@ -496,6 +521,7 @@ public class FinAccountPaymentServices {
public static Map<String, Object> finAccountWithdraw(DispatchContext dctx,
Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productStoreId = (String) context.get("productStoreId");
@@ -520,7 +546,8 @@ public class FinAccountPaymentServices {
// validate the amount
if (amount.compareTo(BigDecimal.ZERO) < 0) {
- return ServiceUtil.returnError("Amount should be a positive
number.");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountMustBePositive", locale));
}
GenericValue finAccount;
@@ -533,12 +560,15 @@ public class FinAccountPaymentServices {
// verify we have a financial account
if (finAccount == null) {
- return ServiceUtil.returnError("Unable to find Financial account
for this transaction");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", ""), locale));
}
// make sure the fin account itself has not expired
if ((finAccount.getTimestamp("thruDate") != null) &&
(finAccount.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) {
- return ServiceUtil.returnError("Financial account has expired as
of " + finAccount.getTimestamp("thruDate"));
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountExpired",
+ UtilMisc.toMap("thruDate",
finAccount.getTimestamp("thruDate")), locale));
}
// check the actual balance (excluding authorized amounts) and create
the transaction if it is sufficient
@@ -585,6 +615,7 @@ public class FinAccountPaymentServices {
public static Map<String, Object> finAccountDeposit(DispatchContext dctx,
Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productStoreId = (String) context.get("productStoreId");
@@ -611,17 +642,21 @@ public class FinAccountPaymentServices {
finAccount = delegator.findByPrimaryKey("FinAccount",
UtilMisc.toMap("finAccountId", finAccountId));
} catch (GenericEntityException e) {
Debug.logError(e, module);
- return ServiceUtil.returnError(e.getMessage());
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", finAccountId), locale));
}
// verify we have a financial account
if (finAccount == null) {
- return ServiceUtil.returnError("Unable to find Financial account
for this transaction");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", ""), locale));
}
// make sure the fin account itself has not expired
if ((finAccount.getTimestamp("thruDate") != null) &&
(finAccount.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) {
- return ServiceUtil.returnError("Financial account has expired as
of " + finAccount.getTimestamp("thruDate"));
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountExpired",
+ UtilMisc.toMap("thruDate",
finAccount.getTimestamp("thruDate")), locale));
}
Debug.log("Deposit into financial account #" + finAccountId + " [" +
amount + "]", module);
@@ -673,6 +708,7 @@ public class FinAccountPaymentServices {
public static Map<String, Object> finAccountReplenish(DispatchContext
dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productStoreId = (String) context.get("productStoreId");
@@ -687,7 +723,8 @@ public class FinAccountPaymentServices {
return ServiceUtil.returnError(e.getMessage());
}
if (finAccount == null) {
- return ServiceUtil.returnError("Invalid financial account [" +
finAccountId + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", finAccountId), locale));
}
String currency = finAccount.getString("currencyUomId");
String statusId = finAccount.getString("statusId");
@@ -710,7 +747,8 @@ public class FinAccountPaymentServices {
if (productStoreId == null) {
productStoreId = getLastProductStoreId(delegator, finAccountId);
if (productStoreId == null) {
- return ServiceUtil.returnError("Cannot locate product store
from previous deposits; product store cannot be empty");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotBeReplenish", locale));
}
}
@@ -772,7 +810,8 @@ public class FinAccountPaymentServices {
//the deposit is replenish-level itself
depositAmount = replenishLevel;
} else {
- return ServiceUtil.returnError("Unknown replenish method found");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountUnknownReplenishMethod", locale));
}
// get the owner party
@@ -787,7 +826,8 @@ public class FinAccountPaymentServices {
String paymentMethodId = finAccount.getString("replenishPaymentId");
if (paymentMethodId == null) {
Debug.logWarning("finAccountReplenish Warning: No payment method
(replenishPaymentId) attached to financial account [" + finAccountId + "]
cannot auto-replenish", module);
- return ServiceUtil.returnError("No payment method associated with
replenish account");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"AccountingFinAccountNoPaymentMethodAssociatedWithReplenishAccount", locale));
}
GenericValue paymentMethod;
@@ -800,7 +840,8 @@ public class FinAccountPaymentServices {
if (paymentMethod == null) {
// no payment methods on file; cannot replenish
Debug.logWarning("finAccountReplenish Warning: No payment method
found for ID [" + paymentMethodId + "] for party [" + ownerPartyId + "] cannot
auto-replenish", module);
- return ServiceUtil.returnError("Cannot locate payment method ID ["
+ paymentMethodId + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+
"AccountingFinAccountNoPaymentMethodAssociatedWithReplenishAccount", locale));
}
// hit the payment method for the amount to replenish
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java?rev=1059306&r1=1059305&r2=1059306&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountProductServices.java
Sat Jan 15 11:54:04 2011
@@ -43,12 +43,14 @@ import javolution.util.FastMap;
public class FinAccountProductServices {
public static final String module =
FinAccountProductServices.class.getName();
-
+ public static final String resourceOrderError = "OrderErrorUiLabels";
+ public static final String resourceError = "AccountingErrorUiLabels";
+
public static Map<String, Object>
createPartyFinAccountFromPurchase(DispatchContext dctx, Map<String, Object>
context) {
// this service should always be called via FULFILLMENT_EXTASYNC
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
-
+ Locale locale = (Locale) context.get("locale");
GenericValue orderItem = (GenericValue) context.get("orderItem");
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -62,7 +64,8 @@ public class FinAccountProductServices {
orderHeader = orderItem.getRelatedOne("OrderHeader");
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get OrderHeader from OrderItem",
module);
- return ServiceUtil.returnError("Unable to get OrderHeader from
OrderItem");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError,
+ "OrderCannotGetOrderHeader", UtilMisc.toMap("orderId",
orderId), locale));
}
String productId = orderItem.getString("productId");
@@ -116,9 +119,10 @@ public class FinAccountProductServices {
productStoreId = orh.getProductStoreId();
}
if (productStoreId == null) {
- String errMsg = "Unable to create financial accout; no
productStoreId on OrderHeader : " + orderId;
- Debug.logFatal(errMsg, module);
- return ServiceUtil.returnError(errMsg);
+ Debug.logFatal("Unable to create financial accout; no
productStoreId on OrderHeader : " + orderId, module);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotCreate",
+ UtilMisc.toMap("orderId", orderId), locale));
}
// party ID (owner)
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java?rev=1059306&r1=1059305&r2=1059306&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
Sat Jan 15 11:54:04 2011
@@ -22,6 +22,7 @@ package org.ofbiz.accounting.finaccount;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import javolution.util.FastMap;
@@ -30,6 +31,7 @@ import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
@@ -50,6 +52,7 @@ import org.ofbiz.service.ServiceUtil;
public class FinAccountServices {
public static final String module = FinAccountServices.class.getName();
+ public static final String resourceError = "AccountingErrorUiLabels";
public static Map<String, Object> createAccountAndCredit(DispatchContext
dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
@@ -57,6 +60,7 @@ public class FinAccountServices {
String finAccountTypeId = (String) context.get("finAccountTypeId");
String accountName = (String) context.get("accountName");
String finAccountId = (String) context.get("finAccountId");
+ Locale locale = (Locale) context.get("locale");
// check the type
if (finAccountTypeId == null) {
@@ -144,7 +148,8 @@ public class FinAccountServices {
}
}
if (creditAccount == null) {
- return ServiceUtil.returnError("Could not find or create a
service credit account");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotCreditAccount",
locale));
}
}
@@ -179,12 +184,15 @@ public class FinAccountServices {
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productStoreId = (String) context.get("productStoreId");
String finAccountTypeId = (String) context.get("finAccountTypeId");
+ Locale locale = (Locale) context.get("locale");
try {
// get the product store id and use it to generate a unique fin
account code
GenericValue productStoreFinAccountSetting =
delegator.findByPrimaryKeyCache("ProductStoreFinActSetting",
UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId",
finAccountTypeId));
if (productStoreFinAccountSetting == null) {
- return ServiceUtil.returnError("No settings found for store ["
+ productStoreId + "] for fin account type [" + finAccountTypeId + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountSetting",
+ UtilMisc.toMap("productStoreId", productStoreId,
"finAccountTypeId", finAccountTypeId), locale));
}
Long accountCodeLength =
productStoreFinAccountSetting.getLong("accountCodeLength");
@@ -238,6 +246,7 @@ public class FinAccountServices {
Delegator delegator = dctx.getDelegator();
String finAccountId = (String) context.get("finAccountId");
String finAccountCode = (String) context.get("finAccountCode");
+ Locale locale = (Locale) context.get("locale");
GenericValue finAccount;
if (finAccountId == null) {
@@ -256,7 +265,8 @@ public class FinAccountServices {
}
}
if (finAccount == null) {
- return ServiceUtil.returnError("Unable to locate financial
account");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", finAccountId), locale));
}
// get the balance
@@ -282,9 +292,11 @@ public class FinAccountServices {
public static Map<String, Object> checkFinAccountStatus(DispatchContext
dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
String finAccountId = (String) context.get("finAccountId");
+ Locale locale = (Locale) context.get("locale");
if (finAccountId == null) {
- return ServiceUtil.returnError("Financial account ID is required
for this service!");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountNotFound",
UtilMisc.toMap("finAccountId", ""), locale));
}
GenericValue finAccount;
@@ -325,7 +337,7 @@ public class FinAccountServices {
public static Map<String, Object> refundFinAccount(DispatchContext dctx,
Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
-
+ Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String finAccountId = (String) context.get("finAccountId");
Map<String, Object> result = null;
@@ -340,7 +352,8 @@ public class FinAccountServices {
if (finAccount != null) {
// check to make sure the account is refundable
if (!"Y".equals(finAccount.getString("isRefundable"))) {
- return ServiceUtil.returnError("Account is not refunable");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountIsNotRefundable", locale));
}
// get the actual and available balance
@@ -349,7 +362,8 @@ public class FinAccountServices {
// if they do not match, then there are outstanding authorizations
which need to be settled first
if (actualBalance.compareTo(availableBalance) != 0) {
- return ServiceUtil.returnError("Available balance does not
match the actual balance; pending authorizations; cannot refund FinAccount at
this time.");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountCannotBeRefunded", locale));
}
// now we make sure there is something to refund
@@ -473,7 +487,8 @@ public class FinAccountServices {
// check to make sure we balanced out
if (remainingBalance.compareTo(FinAccountHelper.ZERO) == 1) {
- result = ServiceUtil.returnSuccess("FinAccount partially
refunded; not enough replenish deposits to refund!");
+ result =
ServiceUtil.returnSuccess(UtilProperties.getMessage(resourceError,
+ "AccountingFinAccountPartiallyRefunded", locale));
}
}
}