Author: jaz
Date: Wed Mar 28 14:47:42 2007
New Revision: 523475
URL:
http://svn.apache.org/viewvc?view=rev&rev=523475Log:
more finaccount balance checks
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java
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?view=diff&rev=523475&r1=523474&r2=523475==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountServices.java Wed Mar 28 14:47:42 2007
@@ -109,7 +109,6 @@
if (finAccountId == null) {
try {
finAccount = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
- finAccountId = finAccount.getString("finAccountId");
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -128,9 +127,15 @@
// get the balance
BigDecimal availableBalance = finAccount.getBigDecimal("availableBalance");
- BigDecimal balance= finAccount.getBigDecimal("actualBalance");
+ BigDecimal balance = finAccount.getBigDecimal("actualBalance");
+ if (availableBalance == null) {
+ availableBalance = FinAccountHelper.ZERO;
+ }
+ if (balance == null) {
+ balance = FinAccountHelper.ZERO;
+ }
- Debug.log("FinAccount Balance [" + balance + "] Available [" + availableBalance + "]", module);
+ Debug.log("FinAccount Balance [" + balance + "] Available [" + availableBalance + "]", module);
Boolean isFrozen = Boolean.valueOf("Y".equals(finAccount.getString("isFrozen")));
Map result = ServiceUtil.returnSuccess();
@@ -173,7 +178,10 @@
if (frozen == null) frozen = "N";
BigDecimal availableBalance = finAccount.getBigDecimal("availableBalance");
-
+ if (availableBalance == null) {
+ availableBalance = FinAccountHelper.ZERO;
+ }
+
if ("N".equals(frozen) && FinAccountHelper.ZERO.compareTo(availableBalance) < 1) {
finAccount.set("isFrozen", "Y");
Debug.logInfo("Financial account [" + finAccountId + "] has passed its threshold [" + availableBalance + "] (Frozen)", module);