diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/archiveloanhistory/ArchiveLoansHistoryTasklet.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/archiveloanhistory/ArchiveLoansHistoryTasklet.java index 7e4c397099..77fc01697b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/archiveloanhistory/ArchiveLoansHistoryTasklet.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/archiveloanhistory/ArchiveLoansHistoryTasklet.java @@ -236,15 +236,14 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon } } - String cuoEstado = dataLoan.getCuoEstado(); - if (cuoEstado == null || cuoEstado.equals("CASTIGO")) { - cuoEstado = loan.getStatus().name(); - } + String estadoCuota = loan.getStatus().name(); + String cuoEstado = estadoCuota; String estadoCliente = dataLoan.getEstadoCliente(); if (estadoCliente == null || estadoCliente.equals("CASTIGO")) { estadoCliente = ClientStatus.fromInt(loan.getClient().getStatus()).name(); } + if (existingLoanArchive.isPresent()) { LoanArchiveHistory existingEntry = existingLoanArchive.get(); @@ -301,7 +300,7 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon existingEntry.setEmpresa(ally); existingEntry.setMarca(brand); existingEntry.setCiudadPuntoCredito(cityPoinfsales); - existingEntry.setEstadoCuota(dataLoan.getEstadoCuota()); + existingEntry.setEstadoCuota(estadoCuota); existingEntry.setIvaInteresDeMora(BigDecimal.ZERO); existingEntry.setFechaFinanciacion(loan.getDisbursementDate()); existingEntry.setPuntoDeVenta(pointOfSale); @@ -365,7 +364,7 @@ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkCon loanArchiveHistory.setEmpresa(ally); loanArchiveHistory.setMarca(brand); loanArchiveHistory.setCiudadPuntoCredito(cityPoinfsales); - loanArchiveHistory.setEstadoCuota(dataLoan.getEstadoCuota()); + loanArchiveHistory.setEstadoCuota(estadoCuota); loanArchiveHistory.setIvaInteresDeMora(BigDecimal.ZERO); loanArchiveHistory.setFechaFinanciacion(loan.getDisbursementDate()); loanArchiveHistory.setPuntoDeVenta(pointOfSale);