adamsaghy commented on code in PR #2928:
URL: https://github.com/apache/fineract/pull/2928#discussion_r1086796252
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/jobs/updateloanarrearsageing/UpdateLoanArrearsAgeingTasklet.java:
##########
@@ -84,18 +98,25 @@ public RepeatStatus execute(StepContribution contribution,
ChunkContext chunkCon
}
log.debug("{}: Records affected by updateLoanArrearsAgeingDetails:
{}", ThreadLocalContextUtil.getTenant().getName(), result);
- return RepeatStatus.FINISHED;
}
- private List<String> updateLoanArrearsAgeingDetailsWithOriginalSchedule() {
+ private List<String>
updateLoanArrearsAgeingDetailsWithOriginalSchedule(String loanIdsForUpdate) {
List<String> insertStatement = new ArrayList<>();
final StringBuilder loanIdentifier = new StringBuilder();
loanIdentifier.append("select ml.id as loanId FROM m_loan ml ");
loanIdentifier.append("INNER JOIN m_loan_repayment_schedule mr on
mr.loan_id = ml.id ");
loanIdentifier.append(
"inner join m_product_loan_recalculation_details prd on
prd.product_id = ml.product_id and prd.arrears_based_on_original_schedule =
true ");
- loanIdentifier.append("WHERE ml.loan_status_id = 300 and
mr.completed_derived is false and mr.duedate < ")
+ loanIdentifier.append("WHERE ml.loan_status_id = 300 ");
+ if (!loanIdsForUpdate.isEmpty()) {
+ if (!loanIdsForUpdate.equalsIgnoreCase(ALL_ACTIVE_LOANS)) {
+ loanIdentifier.append(" and ml.id IN (");
+ loanIdentifier.append(loanIdsForUpdate);
Review Comment:
please use parameterized query not string concatenation.
Only 1 loanId can be provided as per actual logic, you can modify it
accordingly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]