[
http://mifosforge.jira.com/browse/MIFOS-3103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58278#action_58278
]
Sam Birney commented on MIFOS-3103:
-----------------------------------
I'm testing the following patch to the 1.5.x version of the relevant code:
Index:
application/src/main/java/org/mifos/accounts/api/StandardAccountService.java
===================================================================
---
application/src/main/java/org/mifos/accounts/api/StandardAccountService.jav(revision
17357)
+++
application/src/main/java/org/mifos/accounts/api/StandardAccountService.jav(working
copy)
@@ -31,6 +31,7 @@
import org.mifos.accounts.persistence.AccountPersistence;
import org.mifos.accounts.util.helpers.AccountTypes;
import org.mifos.accounts.util.helpers.PaymentData;
+import org.mifos.accounts.util.helpers.AccountState;
import org.mifos.application.master.business.PaymentTypeEntity;
import org.mifos.application.util.helpers.TrxnTypes;
import org.mifos.framework.exceptions.PersistenceException;
@@ -147,6 +148,11 @@
if
(!accountBo.isTrxnDateValid(payment.getPaymentDate().toDateMidnight().toDate()))
{
errors.add(InvalidPaymentReason.INVALID_DATE);
}
+ if
(!accountBo.getState().equals(AccountState.LOAN_ACTIVE_IN_GOOD_STANDING) &&
+
!accountBo.getState().equals(AccountState.LOAN_ACTIVE_IN_BAD_STANDING) &&
+ !accountBo.getState().equals(AccountState.CUSTOMER_ACCOUNT_ACTIVE))
{
+ errors.add(InvalidPaymentReason.INVALID_ACCOUNT_STATE);
+ }
if
(AccountTypes.getAccountType(accountBo.getAccountType().getAccountTypeId()) ==
AccountTypes.LOAN_ACCOUNT) {
if (!getLoanPaymentTypes().contains(payment.getPaymentType())) {
errors.add(InvalidPaymentReason.UNSUPPORTED_PAYMENT_TYPE);
Index: api/src/main/java/org/mifos/accounts/api/InvalidPaymentReason.java
===================================================================
--- api/src/main/java/org/mifos/accounts/api/InvalidPaymentReason.java
(revision 17357)
+++ api/src/main/java/org/mifos/accounts/api/InvalidPaymentReason.java
(working copy)
@@ -30,5 +30,7 @@
/** The payment is invalid because the payment type is not supported. */
UNSUPPORTED_PAYMENT_TYPE,
/** The payment is invalid because the payment amount is not valid. */
- INVALID_PAYMENT_AMOUNT;
+ INVALID_PAYMENT_AMOUNT,
+ /** The payment is invalid because the account is not active. */
+ INVALID_ACCOUNT_STATE;
}
Index: src/main/java/org/almajmoua/AudiBankXlsImporter.java
===================================================================
--- src/main/java/org/almajmoua/AudiBankXlsImporter.java (revision 16777)
+++ src/main/java/org/almajmoua/AudiBankXlsImporter.java (working copy)
@@ -240,6 +246,9 @@
case INVALID_PAYMENT_AMOUNT:
errorsList.add("Invalid payment amount in row
" + friendlyRowNum);
break;
+ case INVALID_ACCOUNT_STATE:
+ errorsList.add("Invalid account state in row "
+ friendlyRowNum);
+ break;
default:
errorsList.add("Invalid payment in row " +
friendlyRowNum + " (reason unknown).");
break;
> Import breaks on LOAN_CANCELLED state
> -------------------------------------
>
> Key: MIFOS-3103
> URL: http://mifosforge.jira.com/browse/MIFOS-3103
> Project: mifos
> Issue Type: Bug
> Components: ImportExport
> Affects Versions: Release 1.5.0.1
> Reporter: Sam Birney
> Priority: Critical
>
> When a loan has been reversed and then an import file is processed which
> contains a reference to that account, the error is not validated. Then, when
> submitting the import, it breaks on this row, but silently returning the user
> to the initial import screen. The user must then figure out which loan was
> cancelled by searching each record (or using log(n) search) and then import
> the rest of the file. This becomes very tedious when there are hundreds of
> rows in the file and several that have been reversed. We see the following
> error in the log.
> 2010-06-17/14:39:37.166/EEST ERROR, org.mifos, MifosExceptionHandler,
> logException, 55, Loan not in a State for a Repayment to be made:
> LOAN_CANCELLED
> org.mifos.accounts.exceptions.AccountException: Loan not in a State for a
> Repayment to be made: LOAN_CANCELLED
> at
> org.mifos.accounts.loan.business.LoanBO.makePayment(LoanBO.java:1449)
> at
> org.mifos.accounts.business.AccountBO.applyPayment(AccountBO.java:446)
> at
> org.mifos.accounts.api.StandardAccountService.makePaymentNoCommit(StandardAccountService.java:118)
> at
> org.mifos.accounts.api.StandardAccountService.makePayments(StandardAccountService.java:97)
> at org.mifos.StandardImport.store(StandardImport.java:73)
> at
> org.mifos.application.importexport.struts.action.ImportTransactionsAction.confirm(ImportTransactionsAction.java:169)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
> at
> org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
> at
> org.mifos.framework.struts.action.BaseAction.execute(BaseAction.java:105)
> at
> org.mifos.framework.struts.action.MifosRequestProcessor.processActionPerform(MifosRequestProcessor.java:204)
> at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
> at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
> at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.mifos.security.util.LoginFilter.doFilter(LoginFilter.java:85)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.mifos.framework.persistence.DatabaseInitFilter.doFilter(DatabaseInitFilter.java:51)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
> at java.lang.Thread.run(Thread.java:619)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mifosforge.jira.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues