diff --git a/Dockerfile b/Dockerfile index 19720805826..5ea075eea20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,7 @@ RUN wget -q https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.23/mys FROM azul/zulu-openjdk:17 as fineract COPY --from=builder /fineract/fineract-provider/pentahoReports/*.properties /root/.mifosx/pentahoReports/ COPY --from=builder /fineract/fineract-provider/pentahoReports/*.prpt /root/.mifosx/pentahoReports/ +COPY --from=builder /fineract/fineract-provider/pentahoReports/fonts/*.ttf /usr/local/share/fonts/ COPY --from=builder /fineract/fineract-provider/build/libs/ /app COPY --from=builder /app/libs /app/libs diff --git a/fineract-provider/pentahoReports/Pagare Libre Protesto Adicional.prpt b/fineract-provider/pentahoReports/Pagare Libre Protesto Adicional.prpt index dc8ac59f1d5..1c115d0eab9 100644 Binary files a/fineract-provider/pentahoReports/Pagare Libre Protesto Adicional.prpt and b/fineract-provider/pentahoReports/Pagare Libre Protesto Adicional.prpt differ diff --git a/fineract-provider/pentahoReports/Pagare Libre Protesto Grupal.prpt b/fineract-provider/pentahoReports/Pagare Libre Protesto Grupal.prpt index d8c9a29517d..19539018a71 100644 Binary files a/fineract-provider/pentahoReports/Pagare Libre Protesto Grupal.prpt and b/fineract-provider/pentahoReports/Pagare Libre Protesto Grupal.prpt differ diff --git a/fineract-provider/pentahoReports/Pagare Libre Protesto Individual.prpt b/fineract-provider/pentahoReports/Pagare Libre Protesto Individual.prpt index 8d9ca6564c1..d97889c4024 100644 Binary files a/fineract-provider/pentahoReports/Pagare Libre Protesto Individual.prpt and b/fineract-provider/pentahoReports/Pagare Libre Protesto Individual.prpt differ diff --git a/fineract-provider/pentahoReports/Print Bank Cheque.prpt b/fineract-provider/pentahoReports/Print Bank Cheque.prpt index 1acb2dd1e5a..156d7ef8939 100644 Binary files a/fineract-provider/pentahoReports/Print Bank Cheque.prpt and b/fineract-provider/pentahoReports/Print Bank Cheque.prpt differ diff --git a/fineract-provider/pentahoReports/fonts/SansSerif.ttf b/fineract-provider/pentahoReports/fonts/SansSerif.ttf new file mode 100644 index 00000000000..a1be076561e Binary files /dev/null and b/fineract-provider/pentahoReports/fonts/SansSerif.ttf differ diff --git a/fineract-provider/pentahoReports/fonts/accentregular.ttf b/fineract-provider/pentahoReports/fonts/accentregular.ttf new file mode 100644 index 00000000000..3936e54a135 Binary files /dev/null and b/fineract-provider/pentahoReports/fonts/accentregular.ttf differ diff --git a/fineract-provider/pentahoReports/fonts/bitwise.ttf b/fineract-provider/pentahoReports/fonts/bitwise.ttf new file mode 100644 index 00000000000..df8a45c9b3c Binary files /dev/null and b/fineract-provider/pentahoReports/fonts/bitwise.ttf differ diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java index 9ca14f77ab1..469cd9f1175 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java @@ -129,7 +129,7 @@ public static SearchParameters forBlacklist(final String displayName, final Stri public static SearchParameters forPrequalification(final String displayName, final String status, final Integer offset, final Integer limit, final String orderBy, final String sortOrder, final String type, String searchText, - final String groupingType) { + final String groupingType, Long portfolioCenterId) { final Integer maxLimitAllowed = getCheckedLimit(limit); final Long staffId = null; @@ -138,7 +138,8 @@ public static SearchParameters forPrequalification(final String displayName, fin final Long savingsId = null; return new SearchParameters(searchText, null, null, displayName, null, null, null, status, offset, maxLimitAllowed, orderBy, - sortOrder, staffId, accountNo, loanId, savingsId, null, false, null, type, null, null, null, groupingType); + sortOrder, staffId, accountNo, loanId, savingsId, null, false, null, type, null, null, null, groupingType, + portfolioCenterId); } public static SearchParameters forBankCheques(final Long agencyId, final String chequeNo, final String bankAccNo, final Long batchId, @@ -620,7 +621,8 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri final String hierarchy, final String firstname, final String lastname, final String status, final Integer offset, final Integer limit, final String orderBy, final String sortOrder, final Long staffId, final String accountNo, final Long loanId, final Long savingsId, final Boolean orphansOnly, boolean isSelfUser, final String dpiNumber, - final String type, final String groupName, final String groupNumber, final String centerName, final String groupingType) { + final String type, final String groupName, final String groupNumber, final String centerName, final String groupingType, + Long portfolioCenterId) { this.sqlSearch = sqlSearch; this.officeId = officeId; this.externalId = externalId; @@ -660,7 +662,7 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri this.agencyId = null; this.clientNo = null; this.groupId = null; - this.centerId = null; + this.centerId = portfolioCenterId; this.facilitatorId = null; this.isIndividualBusinessLoan = null; this.groupingType = groupingType; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java index a8128a48584..20b5e41ad0b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java @@ -43,7 +43,7 @@ public static void validateSQLInput(final String sqlSearch) { } String lowerCaseSQL = sqlSearch.toLowerCase(); for (String ddl : DDL_COMMANDS) { - if (lowerCaseSQL.contains(ddl)) { + if (ddl.equals(lowerCaseSQL)) { throw new SQLInjectionException(); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/GroupPrequalificationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/GroupPrequalificationApiResource.java index eb41dd4aba9..89ce2d3804d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/GroupPrequalificationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/GroupPrequalificationApiResource.java @@ -110,16 +110,16 @@ public class GroupPrequalificationApiResource { @Autowired public GroupPrequalificationApiResource(final PlatformSecurityContext context, - final CodeValueReadPlatformService codeValueReadPlatformService, final AgencyReadPlatformServiceImpl agencyReadPlatformService, - final PrequalificationWritePlatformService prequalificationWritePlatformService, - final CenterReadPlatformServiceImpl centerReadPlatformService, - final LoanProductReadPlatformService loanProductReadPlatformService, - final AppUserReadPlatformService appUserReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, - final ConfigurationReadPlatformService configurationReadPlatformService, - final PrequalificationReadPlatformService prequalificationReadPlatformService, final FileUploadValidator fileUploadValidator, - final DocumentWritePlatformService documentWritePlatformService, final ApiRequestParameterHelper apiRequestParameterHelper, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { + final CodeValueReadPlatformService codeValueReadPlatformService, final AgencyReadPlatformServiceImpl agencyReadPlatformService, + final PrequalificationWritePlatformService prequalificationWritePlatformService, + final CenterReadPlatformServiceImpl centerReadPlatformService, + final LoanProductReadPlatformService loanProductReadPlatformService, + final AppUserReadPlatformService appUserReadPlatformService, + final DefaultToApiJsonSerializer toApiJsonSerializer, + final ConfigurationReadPlatformService configurationReadPlatformService, + final PrequalificationReadPlatformService prequalificationReadPlatformService, final FileUploadValidator fileUploadValidator, + final DocumentWritePlatformService documentWritePlatformService, final ApiRequestParameterHelper apiRequestParameterHelper, + final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { this.context = context; this.codeValueReadPlatformService = codeValueReadPlatformService; this.toApiJsonSerializer = toApiJsonSerializer; @@ -141,14 +141,15 @@ public GroupPrequalificationApiResource(final PlatformSecurityContext context, @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "List all prequalifications", description = "Example Requests:\n" + "prequalification\n") public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo, - @QueryParam("offset") @Parameter(description = "offset") final Integer offset, - @QueryParam("limit") @Parameter(description = "limit") final Integer limit, - @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, - @QueryParam("status") @Parameter(description = "status") final String status, - @QueryParam("type") @Parameter(description = "type") final String type, - @QueryParam("searchText") @Parameter(description = "searchText") final String searchText, - @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, - @QueryParam("groupingType") @Parameter(description = "groupingType") final String groupingType) { + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("status") @Parameter(description = "status") final String status, + @QueryParam("type") @Parameter(description = "type") final String type, + @QueryParam("portfolioCenterId") @Parameter(description = "type") final Long portfolioCenterId, + @QueryParam("searchText") @Parameter(description = "searchText") final String searchText, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("groupingType") @Parameter(description = "groupingType") final String groupingType) { this.context.authenticatedUser().validateHasViewPermission(this.resourceNameForPermissions); @@ -156,7 +157,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo, String clientName = queryParameters.getFirst("clientName"); SearchParameters searchParameters = SearchParameters.forPrequalification(clientName, status, offset, limit, orderBy, sortOrder, - type, searchText, groupingType); + type, searchText, groupingType, portfolioCenterId); final Page clientData = this.prequalificationReadPlatformService.retrieveAll(searchParameters); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters); @@ -244,7 +245,7 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) { @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Retrieve Prequalification Details") public String getBlacklistDetails(@Context final UriInfo uriInfo, - @PathParam("groupId") @Parameter(description = "groupId") final Long groupId) { + @PathParam("groupId") @Parameter(description = "groupId") final Long groupId) { this.context.authenticatedUser().validateHasViewPermission(this.resourceNameForPermissions); @@ -260,8 +261,8 @@ public String getBlacklistDetails(@Context final UriInfo uriInfo, @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Retrieve Prequalification Details") public String prequalifyExistingGroup(@Context final UriInfo uriInfo, - @PathParam("groupId") @Parameter(description = "groupId") final Long groupId, - @Parameter(hidden = true) final String apiRequestBodyAsJson) { + @PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { try { final CommandWrapper commandRequest = new CommandWrapperBuilder().createPrequalification().withGroupId(groupId) @@ -299,7 +300,7 @@ public String createPrequalification(@Parameter(hidden = true) final String apiR @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String updatePrequalification(@Parameter(hidden = true) final String apiRequestBodyAsJson, - @PathParam("groupId") @Parameter(description = "groupId") final Long groupId) { + @PathParam("groupId") @Parameter(description = "groupId") final Long groupId) { try { final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePrequalification(groupId).withJson(apiRequestBodyAsJson) @@ -319,8 +320,8 @@ public String updatePrequalification(@Parameter(hidden = true) final String apiR @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String updatePrequalificationMember(@Parameter(hidden = true) final String apiRequestBodyAsJson, - @PathParam("groupId") @Parameter(description = "groupId") final Long groupId, - @PathParam("memberId") @Parameter(description = "memberId") final Long memberId) { + @PathParam("groupId") @Parameter(description = "groupId") final Long groupId, + @PathParam("memberId") @Parameter(description = "memberId") final Long memberId) { try { final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePrequalificationMemberDetails(memberId) @@ -340,10 +341,10 @@ public String updatePrequalificationMember(@Parameter(hidden = true) final Strin @Consumes({ MediaType.MULTIPART_FORM_DATA }) @Produces({ MediaType.APPLICATION_JSON }) public String createDocument(@PathParam("groupId") @Parameter(description = "groupId") final Long groupId, - @HeaderParam("Content-Length") @Parameter(description = "Content-Length") final Long fileSize, - @FormDataParam("file") final InputStream inputStream, @FormDataParam("file") final FormDataContentDisposition fileDetails, - @FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name, - @FormDataParam("description") final String description, @FormDataParam("comment") final String comment) { + @HeaderParam("Content-Length") @Parameter(description = "Content-Length") final Long fileSize, + @FormDataParam("file") final InputStream inputStream, @FormDataParam("file") final FormDataContentDisposition fileDetails, + @FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name, + @FormDataParam("description") final String description, @FormDataParam("comment") final String comment) { if (inputStream != null) { fileUploadValidator.validate(fileSize, inputStream, fileDetails, bodyPart); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/IndividualPrequalificationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/IndividualPrequalificationApiResource.java index ff7868f23bd..0a411b8041c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/IndividualPrequalificationApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/api/IndividualPrequalificationApiResource.java @@ -113,6 +113,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo, @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, @QueryParam("status") @Parameter(description = "status") final String status, @QueryParam("type") @Parameter(description = "type") final String type, + @QueryParam("portfolioCenterId") @Parameter(description = "type") final Long portfolioCenterId, @QueryParam("searchText") @Parameter(description = "searchText") final String searchText, @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, @QueryParam("groupingType") @Parameter(description = "groupingType") final String groupingType) { @@ -123,7 +124,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo, String clientName = queryParameters.getFirst("clientName"); SearchParameters searchParameters = SearchParameters.forPrequalification(clientName, status, offset, limit, orderBy, sortOrder, - type, searchText, groupingType); + type, searchText, groupingType, portfolioCenterId); final Page memberData = this.prequalificationReadPlatformService.retrieveAllMembers(searchParameters); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/data/GroupPrequalificationData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/data/GroupPrequalificationData.java index 9ee29a15de0..54d1550fcff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/data/GroupPrequalificationData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/data/GroupPrequalificationData.java @@ -20,6 +20,7 @@ import java.math.BigDecimal; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Collection; import java.util.List; import lombok.Data; @@ -62,7 +63,7 @@ public class GroupPrequalificationData { private final Long facilitatorId; private final String comments; private final Long groupId; - private final LocalDate createdAt; + private final LocalDateTime createdAt; private final Collection agencies; private final Collection centerData; private final Collection loanProducts; @@ -74,7 +75,6 @@ public class GroupPrequalificationData { private Long prequalilficationTimespan; private Collection groupMembers; private Collection groupStatusOptions; - private BigDecimal totalRequestedAmount; private BigDecimal totalApprovedAmount; private String substatus; @@ -84,10 +84,11 @@ public class GroupPrequalificationData { private Long linkedGroupId; public GroupPrequalificationData(final Long id, final String productName, final String prequalificationNumber, final String agencyName, - final String portforlioName, final String centerName, final String groupName, final String addedBy, final LocalDate createdAt, - final EnumOptionData status, String comments, Long groupId, final Collection groupMembers, - final Collection agencies, Collection centerData, Collection loanProducts, - Collection appUsers, Long prequalilficationTimespan, List groupStatusOptions) { + final String portforlioName, final String centerName, final String groupName, final String addedBy, + final LocalDateTime createdAt, final EnumOptionData status, String comments, Long groupId, + final Collection groupMembers, final Collection agencies, + Collection centerData, Collection loanProducts, Collection appUsers, + Long prequalilficationTimespan, List groupStatusOptions) { this.id = id; this.productName = productName; this.prequalificationNumber = prequalificationNumber; @@ -127,15 +128,16 @@ public GroupPrequalificationData(final Long id, final String productName, final } public GroupPrequalificationData(final Long id, final String productName, final String prequalificationNumber, final String agencyName, - final String portforlioName, final String centerName, final String groupName, final String addedBy, final LocalDate createdAt, - final EnumOptionData status, String comments, Long groupId, final Collection groupMembers, - final Collection agencies, Collection centerData, Collection loanProducts, - Collection appUsers, final Long agencyId, final Long centerId, final Long productId, final Long facilitatorId, - final String facilitatorName, Long greenValidationCount, Long yellowValidationCount, Long orangeValidationCount, - Long redValidationCount, Long prequalilficationTimespan, EnumOptionData lastPrequalificationStatus, String statusChangedBy, - LocalDate statusChangedOn, String processType, String processQuality, BigDecimal totalRequestedAmount, - BigDecimal totalApprovedAmount, EnumOptionData prequalificationType, String substatus, String assignedUser, - String assignedUserName, String latestComments, Long linkedGroupId) { + final String portforlioName, final String centerName, final String groupName, final String addedBy, + final LocalDateTime createdAt, final EnumOptionData status, String comments, Long groupId, + final Collection groupMembers, final Collection agencies, + Collection centerData, Collection loanProducts, Collection appUsers, + final Long agencyId, final Long centerId, final Long productId, final Long facilitatorId, final String facilitatorName, + Long greenValidationCount, Long yellowValidationCount, Long orangeValidationCount, Long redValidationCount, + Long prequalilficationTimespan, EnumOptionData lastPrequalificationStatus, String statusChangedBy, LocalDate statusChangedOn, + String processType, String processQuality, BigDecimal totalRequestedAmount, BigDecimal totalApprovedAmount, + EnumOptionData prequalificationType, String substatus, String assignedUser, String assignedUserName, String latestComments, + Long linkedGroupId) { this.id = id; this.productName = productName; this.prequalificationNumber = prequalificationNumber; @@ -189,14 +191,14 @@ public static GroupPrequalificationData template(final Collection ag } public static GroupPrequalificationData instance(Long id, String prequalificationNumber, EnumOptionData status, String agencyName, - String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDate createdAt, + String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDateTime createdAt, String comments, Long groupId, Long prequalilficationTimespan) { return new GroupPrequalificationData(id, productName, prequalificationNumber, agencyName, portfolioName, centerName, groupName, addedBy, createdAt, status, comments, groupId, null, null, null, null, null, prequalilficationTimespan, null); } public static GroupPrequalificationData instance(Long id, String prequalificationNumber, EnumOptionData status, String agencyName, - String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDate createdAt, + String portfolioName, String centerName, String groupName, String productName, String addedBy, LocalDateTime createdAt, String comments, Long groupId, final Long agencyId, final Long centerId, final Long productId, final Long facilitatorId, final String facilitatorName, Long greenValidationCount, Long yellowValidationCount, Long orangeValidationCount, Long redValidationCount, Long prequalilficationTimespan, EnumOptionData lastPrequalificationStatus, String statusChangedBy, @@ -212,7 +214,7 @@ public static GroupPrequalificationData instance(Long id, String prequalificatio } public static GroupPrequalificationData simpeGroupData(Long id, String prequalificationNumber, EnumOptionData status, String groupName, - String productName, String addedBy, LocalDate createdAt, Long groupId) { + String productName, String addedBy, LocalDateTime createdAt, Long groupId) { return new GroupPrequalificationData(id, productName, prequalificationNumber, null, null, null, groupName, addedBy, createdAt, status, null, groupId, null, null, null, null, null, null, null); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/domain/PrequalificationStatus.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/domain/PrequalificationStatus.java index f24884489dd..f3d284017f3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/domain/PrequalificationStatus.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/domain/PrequalificationStatus.java @@ -27,33 +27,33 @@ public enum PrequalificationStatus { PENDING(100, "prequalification.status.pending"), REJECTED(300, "prequalification.status.rejected"), BLACKLIST_CHECKED(400, "prequalification.status.blacklist.checked"), BLACKLIST_REJECTED(500, - "prequalification.status.blacklist.rejected"), BURO_CHECKED(600, - "prequalification.status.buro.checked"), HARD_POLICY_CHECKED(700, - "prequalification.status.hard.policy.checked"), TIME_EXPIRED(800, - "prequalification.status.expired"), COMPLETED(900, - "prequalification.status.completed"), CONSENT_ADDED(901, - "prequalification.status.concent.added"), AGENCY_LEAD_PENDING_APPROVAL(902, - "prequalification.status.pending.approval"), PREQUALIFICATION_UPDATE_REQUESTED( - 903, - "prequalification.status.update.requested"), AGENCY_LEAD_PENDING_APPROVAL_WITH_EXCEPTIONS( - 904, - "prequalification.status.agency.pending.approval.exceptions"), AGENCY_LEAD_APPROVED_WITH_EXCEPTIONS( - 905, - "prequalification.status.agency.approved.with.exceptions"), ANALYSIS_UNIT_PENDING_APPROVAL( - 1001, - "prequalification.status.analysis.pending.approval"), ANALYSIS_UNIT_PENDING_APPROVAL_WITH_EXCEPTIONS( - 1002, - "prequalification.status.analysis.pending.approval.exceptions"), PRE_COMMITTEE_D_PENDING_APPROVAL( - 1003, - "prequalification.status.pre.committee.d.pending.approval"), PRE_COMMITTEE_C_PENDING_APPROVAL( - 1004, - "prequalification.status.pre.committee.c.pending.approval"), PRE_COMMITTEE_B_PENDING_APPROVAL( - 1005, - "prequalification.status.committee.b.pending.approval"), PRE_COMMITTEE_A_PENDING_APPROVAL( - 1006, - "prequalification.status.committee.a.pending.approval"), INVALID( - 0, - "prequalification.status.invalid"); + "prequalification.status.blacklist.rejected"), BURO_CHECKED(600, + "prequalification.status.buro.checked"), HARD_POLICY_CHECKED(700, + "prequalification.status.hard.policy.checked"), TIME_EXPIRED(800, + "prequalification.status.expired"), COMPLETED(900, + "prequalification.status.completed"), CONSENT_ADDED(901, + "prequalification.status.concent.added"), AGENCY_LEAD_PENDING_APPROVAL(902, + "prequalification.status.pending.approval"), PREQUALIFICATION_UPDATE_REQUESTED( + 903, + "prequalification.status.update.requested"), AGENCY_LEAD_PENDING_APPROVAL_WITH_EXCEPTIONS( + 904, + "prequalification.status.agency.pending.approval.exceptions"), AGENCY_LEAD_APPROVED_WITH_EXCEPTIONS( + 905, + "prequalification.status.agency.approved.with.exceptions"), ANALYSIS_UNIT_PENDING_APPROVAL( + 1001, + "prequalification.status.analysis.pending.approval"), ANALYSIS_UNIT_PENDING_APPROVAL_WITH_EXCEPTIONS( + 1002, + "prequalification.status.analysis.pending.approval.exceptions"), PRE_COMMITTEE_D_PENDING_APPROVAL( + 1003, + "prequalification.status.pre.committee.d.pending.approval"), PRE_COMMITTEE_C_PENDING_APPROVAL( + 1004, + "prequalification.status.pre.committee.c.pending.approval"), PRE_COMMITTEE_B_PENDING_APPROVAL( + 1005, + "prequalification.status.committee.b.pending.approval"), PRE_COMMITTEE_A_PENDING_APPROVAL( + 1006, + "prequalification.status.committee.a.pending.approval"), INVALID( + 0, + "prequalification.status.invalid"); private final Integer value; private final String code; @@ -64,61 +64,61 @@ public static PrequalificationStatus fromInt(final Integer statusValue) { switch (statusValue) { case 100: enumeration = PrequalificationStatus.PENDING; - break; + break; case 300: enumeration = PrequalificationStatus.REJECTED; - break; + break; case 400: enumeration = PrequalificationStatus.BLACKLIST_CHECKED; - break; + break; case 500: enumeration = PrequalificationStatus.BLACKLIST_REJECTED; - break; + break; case 600: enumeration = PrequalificationStatus.BURO_CHECKED; - break; + break; case 700: enumeration = PrequalificationStatus.HARD_POLICY_CHECKED; - break; + break; case 800: enumeration = PrequalificationStatus.TIME_EXPIRED; - break; + break; case 900: enumeration = PrequalificationStatus.COMPLETED; - break; + break; case 901: enumeration = PrequalificationStatus.CONSENT_ADDED; - break; + break; case 902: enumeration = PrequalificationStatus.AGENCY_LEAD_PENDING_APPROVAL; - break; + break; case 903: enumeration = PrequalificationStatus.PREQUALIFICATION_UPDATE_REQUESTED; - break; + break; case 904: enumeration = PrequalificationStatus.AGENCY_LEAD_PENDING_APPROVAL_WITH_EXCEPTIONS; - break; + break; case 905: enumeration = PrequalificationStatus.AGENCY_LEAD_APPROVED_WITH_EXCEPTIONS; - break; + break; case 1001: enumeration = PrequalificationStatus.ANALYSIS_UNIT_PENDING_APPROVAL; - break; + break; case 1002: enumeration = PrequalificationStatus.ANALYSIS_UNIT_PENDING_APPROVAL_WITH_EXCEPTIONS; - break; + break; case 1003: enumeration = PrequalificationStatus.PRE_COMMITTEE_D_PENDING_APPROVAL; - break; + break; case 1004: enumeration = PrequalificationStatus.PRE_COMMITTEE_C_PENDING_APPROVAL; - break; + break; case 1005: enumeration = PrequalificationStatus.PRE_COMMITTEE_B_PENDING_APPROVAL; - break; + break; case 1006: enumeration = PrequalificationStatus.PRE_COMMITTEE_A_PENDING_APPROVAL; - break; + break; } return enumeration; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java index 059ff951920..ac2b1eff432 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/prequalification/service/PrequalificationReadPlatformServiceImpl.java @@ -22,9 +22,11 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.infrastructure.codes.data.CodeValueData; @@ -54,6 +56,7 @@ import org.apache.fineract.portfolio.client.service.ClientReadPlatformService; import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository; import org.apache.fineract.useradministration.domain.AppUser; +import org.apache.fineract.useradministration.domain.Role; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -84,11 +87,11 @@ public class PrequalificationReadPlatformServiceImpl implements Prequalification @Autowired public PrequalificationReadPlatformServiceImpl(final PlatformSecurityContext context, final PaginationHelper paginationHelper, - final DatabaseSpecificSQLGenerator sqlGenerator, final ColumnValidator columnValidator, - final PrequalificationDataValidator dataValidator, final LoanProductRepository loanProductRepository, - final PreQualificationMemberRepository preQualificationMemberRepository, - final ClientReadPlatformService clientReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService, - final JdbcTemplate jdbcTemplate) { + final DatabaseSpecificSQLGenerator sqlGenerator, final ColumnValidator columnValidator, + final PrequalificationDataValidator dataValidator, final LoanProductRepository loanProductRepository, + final PreQualificationMemberRepository preQualificationMemberRepository, + final ClientReadPlatformService clientReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService, + final JdbcTemplate jdbcTemplate) { this.context = context; this.dataValidator = dataValidator; this.loanProductRepository = loanProductRepository; @@ -285,6 +288,7 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search } String sqlSearch = searchParameters.getSqlSearch(); final Long officeId = searchParameters.getOfficeId(); + final Long centerId = searchParameters.getCenterId(); final String dpiNumber = searchParameters.getName(); final String status = searchParameters.getStatus(); final String type = searchParameters.getType(); @@ -298,6 +302,16 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search if (groupingType.equals("group")) { extraCriteria += " and g.prequalification_type_enum = ? "; paramList.add(PrequalificationType.GROUP.getValue()); + + Set roles = appUser.getRoles(); + for (Role userRole : roles) { + if (StringUtils.containsIgnoreCase(userRole.getName(), "Líder de agencia")) { + extraCriteria += " and ma.responsible_user_id = ? "; + paramList.add(appUser.getId()); + } + ; + } + } if (groupingType.equals("individual")) { @@ -323,6 +337,11 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search paramList.add(officeId); } + if (centerId != null) { + extraCriteria += " and g.center_id = ? "; + paramList.add(centerId); + } + if (dpiNumber != null) { paramList.add(dpiNumber); extraCriteria += " and g.prequalification_number like %?% "; @@ -412,8 +431,8 @@ private static final class PrequalificationsGroupMapper implements RowMapper0 THEN 'Reproceso' ELSE 'Nuevo' END) as processQuality, concat(mu.firstname, ' ', mu.lastname) as statusChangedBy, @@ -472,6 +491,14 @@ private static final class PrequalificationsGroupMapper implements RowMapper assembleMembersForUpdate(JsonCommand command, PrequalificationGroup prequalificationGroup, - AppUser addedBy) { + AppUser addedBy) { final List allMembers = new ArrayList<>(); @@ -567,7 +567,7 @@ private List assembleMembersForUpdate(JsonCommand c } private PrequalificationGroupMember assembleMemberForUpdate(JsonElement memberElement, - PrequalificationGroupMember prequalificationGroupMember, AppUser addedBy, PrequalificationGroup prequalificationGroup) { + PrequalificationGroupMember prequalificationGroupMember, AppUser addedBy, PrequalificationGroup prequalificationGroup) { apiJsonDeserializer.validateForUpdate(memberElement.toString()); JsonCommand command = JsonCommand.fromJsonElement(prequalificationGroupMember.getId(), memberElement, new FromJsonHelper()); @@ -867,7 +867,7 @@ public CommandProcessingResult processAnalysisRequest(Long entityId, JsonCommand } private void approveOrRejectLoanApplications(final PrequalificationGroup prequalificationGroup, - final PrequalificationStatus prequalificationStatus, final List prequalificationMembers) { + final PrequalificationStatus prequalificationStatus, final List prequalificationMembers) { final Long prequalificationId = prequalificationGroup.getId(); final List groupMembers = prequalificationGroup.getMembers(); final List approvedPrequalificationMembers = prequalificationMembers.stream() @@ -886,7 +886,7 @@ private void approveOrRejectLoanApplications(final PrequalificationGroup prequal && (memberPrequalificationData.getIsSelected() || prequalificationGroup.isPrequalificationTypeIndividual()); final boolean isRejected = PrequalificationStatus.REJECTED.equals(prequalificationStatus) || (!memberPrequalificationData.getIsSelected() && PrequalificationStatus.COMPLETED.equals(prequalificationStatus) - && prequalificationGroup.isPrequalificationTypeGroup()); + && prequalificationGroup.isPrequalificationTypeGroup()); final BigDecimal approvedLoanAmount = prequalificationGroupMember.getApprovedAmount(); final String dpi = prequalificationGroupMember.getDpi(); List submittedLoans; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java index 79002bcef5d..20293a558f6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java @@ -253,6 +253,9 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom { @Column(name = "secondlastname", nullable = false) private String secondlastname; + @Column(name = "loan_cycle", nullable = true) + private Integer loanCycle; + public static Client createNew(final AppUser currentUser, final Office clientOffice, final Group clientParentGroup, final Staff staff, final Long savingsProductId, final CodeValue gender, final CodeValue clientType, final CodeValue clientClassification, final Integer legalForm, final ClientInfoRelatedDetail clientInfoRelatedDetail, final JsonCommand command) { @@ -1130,4 +1133,12 @@ public ClientInfoRelatedDetail getClientInfoRelatedDetail() { public void setClientInfoRelatedDetail(ClientInfoRelatedDetail clientInfoRelatedDetail) { this.clientInfoRelatedDetail = clientInfoRelatedDetail; } + + public Integer getLoanCycle() { + return this.loanCycle; + } + + public void updateLoanCycle(final Integer loanCycle) { + this.loanCycle = loanCycle; + } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java index 4bfd85289a1..801a8c7f645 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientReadPlatformServiceImpl.java @@ -201,7 +201,7 @@ public Page retrieveAll(final SearchParameters searchParameters) { sqlBuilder.append("select " + sqlGenerator.calcFoundRows() + " "); sqlBuilder.append(this.clientMapper.schema()); sqlBuilder.append(" where (o.hierarchy like ? or transferToOffice.hierarchy like ?) "); - // sqlBuilder.append(" and c.external_id in (select NumeroCliente from PDA_MIG_017_P_SALDOS) "); + // sqlBuilder.append(" and c.external_id in (select NumeroCliente from PDA_MIG_017_P_SALDOS) "); if (searchParameters != null) { if (searchParameters.isSelfUser()) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java index a3e4f823a8e..f76d2054e22 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java @@ -289,33 +289,33 @@ public class LoansApiResource { private final CenterReadPlatformServiceImpl centerReadPlatformService; public LoansApiResource(final PlatformSecurityContext context, final LoanReadPlatformService loanReadPlatformService, - final LoanProductReadPlatformService loanProductReadPlatformService, - final LoanDropdownReadPlatformService dropdownReadPlatformService, final FundReadPlatformService fundReadPlatformService, - final ChargeReadPlatformService chargeReadPlatformService, final LoanChargeReadPlatformService loanChargeReadPlatformService, - final LoanScheduleCalculationPlatformService calculationPlatformService, - final GuarantorReadPlatformService guarantorReadPlatformService, final ClientReadPlatformService clientReadPlatformService, - final CodeValueReadPlatformService codeValueReadPlatformService, final GroupReadPlatformService groupReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, - final DefaultToApiJsonSerializer loanApprovalDataToApiJsonSerializer, - final DefaultToApiJsonSerializer loanScheduleToApiJsonSerializer, - final DefaultToApiJsonSerializer ageLimitValidationJsonSerializer, - final DefaultToApiJsonSerializer loanAdditionalDataToApiJsonSerializer, - final ApiRequestParameterHelper apiRequestParameterHelper, final FromJsonHelper fromJsonHelper, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final CalendarReadPlatformService calendarReadPlatformService, final NoteReadPlatformService noteReadPlatformService, - final PortfolioAccountReadPlatformService portfolioAccountReadPlatformServiceImpl, - final AccountAssociationsReadPlatformService accountAssociationsReadPlatformService, - final LoanScheduleHistoryReadPlatformService loanScheduleHistoryReadPlatformService, - final AccountDetailsReadPlatformService accountDetailsReadPlatformService, - final EntityDatatableChecksReadService entityDatatableChecksReadService, - final BulkImportWorkbookService bulkImportWorkbookService, - final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService, final RateReadService rateReadService, - final ConfigurationDomainService configurationDomainService, - final DefaultToApiJsonSerializer glimTemplateToApiJsonSerializer, - final GLIMAccountInfoReadPlatformService glimAccountInfoReadPlatformService, - final LoanCollateralManagementReadPlatformService loanCollateralManagementReadPlatformService, - final CupoReadService cupoReadService, AppUserReadPlatformService appUserReadPlatformService, - AgencyReadPlatformServiceImpl agencyReadPlatformService, CenterReadPlatformServiceImpl centerReadPlatformService) { + final LoanProductReadPlatformService loanProductReadPlatformService, + final LoanDropdownReadPlatformService dropdownReadPlatformService, final FundReadPlatformService fundReadPlatformService, + final ChargeReadPlatformService chargeReadPlatformService, final LoanChargeReadPlatformService loanChargeReadPlatformService, + final LoanScheduleCalculationPlatformService calculationPlatformService, + final GuarantorReadPlatformService guarantorReadPlatformService, final ClientReadPlatformService clientReadPlatformService, + final CodeValueReadPlatformService codeValueReadPlatformService, final GroupReadPlatformService groupReadPlatformService, + final DefaultToApiJsonSerializer toApiJsonSerializer, + final DefaultToApiJsonSerializer loanApprovalDataToApiJsonSerializer, + final DefaultToApiJsonSerializer loanScheduleToApiJsonSerializer, + final DefaultToApiJsonSerializer ageLimitValidationJsonSerializer, + final DefaultToApiJsonSerializer loanAdditionalDataToApiJsonSerializer, + final ApiRequestParameterHelper apiRequestParameterHelper, final FromJsonHelper fromJsonHelper, + final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, + final CalendarReadPlatformService calendarReadPlatformService, final NoteReadPlatformService noteReadPlatformService, + final PortfolioAccountReadPlatformService portfolioAccountReadPlatformServiceImpl, + final AccountAssociationsReadPlatformService accountAssociationsReadPlatformService, + final LoanScheduleHistoryReadPlatformService loanScheduleHistoryReadPlatformService, + final AccountDetailsReadPlatformService accountDetailsReadPlatformService, + final EntityDatatableChecksReadService entityDatatableChecksReadService, + final BulkImportWorkbookService bulkImportWorkbookService, + final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService, final RateReadService rateReadService, + final ConfigurationDomainService configurationDomainService, + final DefaultToApiJsonSerializer glimTemplateToApiJsonSerializer, + final GLIMAccountInfoReadPlatformService glimAccountInfoReadPlatformService, + final LoanCollateralManagementReadPlatformService loanCollateralManagementReadPlatformService, + final CupoReadService cupoReadService, AppUserReadPlatformService appUserReadPlatformService, + AgencyReadPlatformServiceImpl agencyReadPlatformService, CenterReadPlatformServiceImpl centerReadPlatformService) { this.context = context; this.loanReadPlatformService = loanReadPlatformService; this.loanProductReadPlatformService = loanProductReadPlatformService; @@ -367,8 +367,8 @@ public LoansApiResource(final PlatformSecurityContext context, final LoanReadPla @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String retrieveApprovalTemplate(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, - @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, - @Context final UriInfo uriInfo) { + @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -391,7 +391,7 @@ public String retrieveApprovalTemplate(@PathParam("loanId") @Parameter(descripti @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String retrieveLoanAdditionals(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, - @Context final UriInfo uriInfo) { + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -413,12 +413,12 @@ public String retrieveLoanAdditionals(@PathParam("loanId") @Parameter(descriptio @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansTemplateResponse.class))) }) public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, - @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, - @QueryParam("productId") @Parameter(description = "productId") final Long productId, - @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @DefaultValue("false") @QueryParam("activeOnly") @Parameter(description = "activeOnly") final boolean onlyActive, - @Context final UriInfo uriInfo) { + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @QueryParam("templateType") @Parameter(description = "templateType") final String templateType, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("false") @QueryParam("activeOnly") @Parameter(description = "activeOnly") final boolean onlyActive, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); @@ -596,7 +596,7 @@ public String template(@QueryParam("clientId") @Parameter(description = "clientI @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansTemplateResponse.class))) }) public String template(@PathParam("clientId") @Parameter(description = "clientId") final Long clientId, - @PathParam("productId") @Parameter(description = "productId") final Long productId, @Context final UriInfo uriInfo) { + @PathParam("productId") @Parameter(description = "productId") final Long productId, @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); @@ -628,7 +628,7 @@ public String template(@PathParam("clientId") @Parameter(description = "clientId } private Collection getaccountLinkingOptions(final LoanAccountData newLoanAccount, final Long clientId, - final Long groupId) { + final Long groupId) { final CurrencyData currencyData = newLoanAccount.currency(); String currencyCode = null; if (currencyData != null) { @@ -654,12 +654,12 @@ private Collection getaccountLinkingOptions(final LoanAcco @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansLoanIdResponse.class))) }) public String retrieveLoan(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, - @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, - @DefaultValue("all") @QueryParam("associations") @Parameter(in = ParameterIn.QUERY, name = "associations", description = "Loan object relations to be included in the response", required = false, examples = { - @ExampleObject(value = "all"), @ExampleObject(value = "repaymentSchedule,transactions") }) final String associations, - @QueryParam("exclude") @Parameter(in = ParameterIn.QUERY, name = "exclude", description = "Optional Loan object relation list to be filtered in the response", required = false, example = "guarantors,futureSchedule") final String exclude, - @QueryParam("fields") @Parameter(in = ParameterIn.QUERY, name = "fields", description = "Optional Loan attribute list to be in the response", required = false, example = "id,principal,annualInterestRate") final String fields, - @Context final UriInfo uriInfo) { + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("all") @QueryParam("associations") @Parameter(in = ParameterIn.QUERY, name = "associations", description = "Loan object relations to be included in the response", required = false, examples = { + @ExampleObject(value = "all"), @ExampleObject(value = "repaymentSchedule,transactions") }) final String associations, + @QueryParam("exclude") @Parameter(in = ParameterIn.QUERY, name = "exclude", description = "Optional Loan object relation list to be filtered in the response", required = false, example = "guarantors,futureSchedule") final String exclude, + @QueryParam("fields") @Parameter(in = ParameterIn.QUERY, name = "fields", description = "Optional Loan attribute list to be in the response", required = false, example = "id,principal,annualInterestRate") final String fields, + @Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); LoanAccountData loanBasicDetails = this.loanReadPlatformService.retrieveOne(loanId); @@ -960,26 +960,26 @@ public String retrieveLoan(@PathParam("loanId") @Parameter(description = "loanId @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.GetLoansResponse.class))) }) public String retrieveAll(@Context final UriInfo uriInfo, - @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, - @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, - // @QueryParam("underHierarchy") final String hierarchy, - @QueryParam("offset") @Parameter(description = "offset") final Integer offset, - @QueryParam("limit") @Parameter(description = "limit") final Integer limit, - @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, - @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, - @QueryParam("accountNo") @Parameter(description = "accountNo") final String accountNo, - @QueryParam("clientNo") @Parameter(description = "accountNo") final String clientNo, - @QueryParam("agencyId") @Parameter(description = "agencyId") final Long agencyId, - @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, - @QueryParam("centerId") @Parameter(description = "centerId") final Long centerId, - @QueryParam("facilitatorId") @Parameter(description = "facilitatorId") final Long facilitatorId, - @DefaultValue("false") @QueryParam("isIndividualBusinessLoan") @Parameter(description = "isIndividualBusinessLoan") final boolean isIndividualBusinessLoan, - @QueryParam("approvalEndDate") @Parameter(description = "approvalEndDate") final DateParam approvalEndDateParam, - @QueryParam("approvalStartDate") @Parameter(description = "approvalStartDate") final DateParam approvalStartDateParam, - @QueryParam("disbursementStartDate") @Parameter(description = "disbursementStartDate") final DateParam disbursementStartDateParam, - @QueryParam("disbursementEndDate") @Parameter(description = "disbursementEndDate") final DateParam disbursementEndDateParam, - @QueryParam("locale") @Parameter(description = "locale") final String locale, - @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat) { + @QueryParam("sqlSearch") @Parameter(description = "sqlSearch") final String sqlSearch, + @QueryParam("externalId") @Parameter(description = "externalId") final String externalId, + // @QueryParam("underHierarchy") final String hierarchy, + @QueryParam("offset") @Parameter(description = "offset") final Integer offset, + @QueryParam("limit") @Parameter(description = "limit") final Integer limit, + @QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy, + @QueryParam("sortOrder") @Parameter(description = "sortOrder") final String sortOrder, + @QueryParam("accountNo") @Parameter(description = "accountNo") final String accountNo, + @QueryParam("clientNo") @Parameter(description = "accountNo") final String clientNo, + @QueryParam("agencyId") @Parameter(description = "agencyId") final Long agencyId, + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("centerId") @Parameter(description = "centerId") final Long centerId, + @QueryParam("facilitatorId") @Parameter(description = "facilitatorId") final Long facilitatorId, + @DefaultValue("false") @QueryParam("isIndividualBusinessLoan") @Parameter(description = "isIndividualBusinessLoan") final boolean isIndividualBusinessLoan, + @QueryParam("approvalEndDate") @Parameter(description = "approvalEndDate") final DateParam approvalEndDateParam, + @QueryParam("approvalStartDate") @Parameter(description = "approvalStartDate") final DateParam approvalStartDateParam, + @QueryParam("disbursementStartDate") @Parameter(description = "disbursementStartDate") final DateParam disbursementStartDateParam, + @QueryParam("disbursementEndDate") @Parameter(description = "disbursementEndDate") final DateParam disbursementEndDateParam, + @QueryParam("locale") @Parameter(description = "locale") final String locale, + @QueryParam("dateFormat") @Parameter(description = "dateFormat") final String dateFormat) { this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); LocalDate approvalStartDate = null; if (approvalStartDateParam != null) { @@ -1054,7 +1054,7 @@ public String calculateLoanScheduleOrSubmitLoanApplication( @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PutLoansLoanIdResponse.class))) }) public String modifyLoanApplication(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, - @Parameter(hidden = true) final String apiRequestBodyAsJson) { + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().updateLoanApplication(loanId).withJson(apiRequestBodyAsJson) .build(); @@ -1100,8 +1100,8 @@ public String deleteLoanApplication(@PathParam("loanId") @Parameter(description @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansLoanIdResponse.class))) }) public String stateTransitions(@PathParam("loanId") @Parameter(description = "loanId") final Long loanId, - @QueryParam("command") @Parameter(description = "command") final String commandParam, - @Parameter(hidden = true) final String apiRequestBodyAsJson) { + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -1164,7 +1164,7 @@ private boolean is(final String commandParam, final String commandValue) { @Path("downloadtemplate") @Produces("application/vnd.ms-excel") public Response getLoansTemplate(@QueryParam("officeId") final Long officeId, @QueryParam("staffId") final Long staffId, - @QueryParam("dateFormat") final String dateFormat) { + @QueryParam("dateFormat") final String dateFormat) { return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.LOANS.toString(), officeId, staffId, dateFormat); } @@ -1195,7 +1195,7 @@ public String getGlimRepaymentTemplate(@PathParam("glimId") final Long glimId, @ @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoansApiResourceSwagger.PostLoansLoanIdResponse.class))) }) public String glimStateTransitions(@PathParam("glimId") final Long glimId, @QueryParam("command") final String commandParam, - final String apiRequestBodyAsJson) { + final String apiRequestBodyAsJson) { final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); @@ -1232,7 +1232,7 @@ public String glimStateTransitions(@PathParam("glimId") final Long glimId, @Quer @Path("repayments/downloadtemplate") @Produces("application/vnd.ms-excel") public Response getLoanRepaymentTemplate(@QueryParam("officeId") final Long officeId, - @QueryParam("dateFormat") final String dateFormat) { + @QueryParam("dateFormat") final String dateFormat) { return bulkImportWorkbookPopulatorService.getTemplate(GlobalEntityType.LOAN_TRANSACTIONS.toString(), officeId, null, dateFormat); } @@ -1242,8 +1242,8 @@ public Response getLoanRepaymentTemplate(@QueryParam("officeId") final Long offi @RequestBody(description = "Upload Loan template", content = { @Content(mediaType = MediaType.MULTIPART_FORM_DATA, schema = @Schema(implementation = UploadRequest.class)) }) public String postLoanTemplate(@FormDataParam("file") InputStream uploadedInputStream, - @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale, - @FormDataParam("dateFormat") final String dateFormat) { + @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat) { final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.LOANS.toString(), uploadedInputStream, fileDetail, locale, dateFormat); return this.toApiJsonSerializer.serialize(importDocumentId); @@ -1255,8 +1255,8 @@ public String postLoanTemplate(@FormDataParam("file") InputStream uploadedInputS @RequestBody(description = "Upload Loan repayments template", content = { @Content(mediaType = MediaType.MULTIPART_FORM_DATA, schema = @Schema(implementation = UploadRequest.class)) }) public String postLoanRepaymentTemplate(@FormDataParam("file") InputStream uploadedInputStream, - @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale, - @FormDataParam("dateFormat") final String dateFormat) { + @FormDataParam("file") FormDataContentDisposition fileDetail, @FormDataParam("locale") final String locale, + @FormDataParam("dateFormat") final String dateFormat) { final Long importDocumentId = this.bulkImportWorkbookService.importWorkbook(GlobalEntityType.LOAN_TRANSACTIONS.toString(), uploadedInputStream, fileDetail, locale, dateFormat); return this.toApiJsonSerializer.serialize(importDocumentId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java index ce09e8e6cda..5acc987908b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java @@ -283,8 +283,8 @@ public final class LoanAccountData { private GroupLoanAdditionalData groupLoanAdditionalData; public static LoanAccountData disburseLoanByCheques(final Collection agencyOptions, - final Collection centerOptions, final Collection groupOption, - final Collection facilitatorOptions, final Collection disbursementMethodOptions) { + final Collection centerOptions, final Collection groupOption, + final Collection facilitatorOptions, final Collection disbursementMethodOptions) { final Long id = null; final String accountNo = null; final LoanStatusEnumData status = null; @@ -433,14 +433,14 @@ public static LoanAccountData disburseLoanByCheques(final Collection } public static LoanAccountData importInstanceIndividual(EnumOptionData loanTypeEnumOption, Long clientId, Long productId, - Long loanOfficerId, LocalDate submittedOnDate, Long fundId, BigDecimal principal, Integer numberOfRepayments, - Integer repaymentEvery, EnumOptionData repaidEveryFrequencyEnums, Integer loanTermFrequency, - EnumOptionData loanTermFrequencyTypeEnum, BigDecimal nominalInterestRate, LocalDate expectedDisbursementDate, - EnumOptionData amortizationEnumOption, EnumOptionData interestMethodEnum, EnumOptionData interestCalculationPeriodTypeEnum, - BigDecimal inArrearsTolerance, Long transactionProcessingStrategyId, Integer graceOnPrincipalPayment, - Integer graceOnInterestPayment, Integer graceOnInterestCharged, LocalDate interestChargedFromDate, - LocalDate repaymentsStartingFromDate, Integer rowIndex, String externalId, Long groupId, Collection charges, - String linkAccountId, String locale, String dateFormat, List loanCollateralManagementData) { + Long loanOfficerId, LocalDate submittedOnDate, Long fundId, BigDecimal principal, Integer numberOfRepayments, + Integer repaymentEvery, EnumOptionData repaidEveryFrequencyEnums, Integer loanTermFrequency, + EnumOptionData loanTermFrequencyTypeEnum, BigDecimal nominalInterestRate, LocalDate expectedDisbursementDate, + EnumOptionData amortizationEnumOption, EnumOptionData interestMethodEnum, EnumOptionData interestCalculationPeriodTypeEnum, + BigDecimal inArrearsTolerance, Long transactionProcessingStrategyId, Integer graceOnPrincipalPayment, + Integer graceOnInterestPayment, Integer graceOnInterestCharged, LocalDate interestChargedFromDate, + LocalDate repaymentsStartingFromDate, Integer rowIndex, String externalId, Long groupId, Collection charges, + String linkAccountId, String locale, String dateFormat, List loanCollateralManagementData) { return new LoanAccountData(loanTypeEnumOption, clientId, productId, loanOfficerId, submittedOnDate, fundId, principal, numberOfRepayments, repaymentEvery, repaidEveryFrequencyEnums, loanTermFrequency, loanTermFrequencyTypeEnum, @@ -451,13 +451,13 @@ public static LoanAccountData importInstanceIndividual(EnumOptionData loanTypeEn } public static LoanAccountData importInstanceGroup(EnumOptionData loanTypeEnumOption, Long groupIdforGroupLoan, Long productId, - Long loanOfficerId, LocalDate submittedOnDate, Long fundId, BigDecimal principal, Integer numberOfRepayments, - Integer repaidEvery, EnumOptionData repaidEveryFrequencyEnums, Integer loanTermFrequency, - EnumOptionData loanTermFrequencyTypeEnum, BigDecimal nominalInterestRate, EnumOptionData amortizationEnumOption, - EnumOptionData interestMethodEnum, EnumOptionData interestCalculationPeriodEnum, BigDecimal arrearsTolerance, - Long transactionProcessingStrategyId, Integer graceOnPrincipalPayment, Integer graceOnInterestPayment, - Integer graceOnInterestCharged, LocalDate interestChargedFromDate, LocalDate repaymentsStartingFromDate, Integer rowIndex, - String externalId, String linkAccountId, String locale, String dateFormat) { + Long loanOfficerId, LocalDate submittedOnDate, Long fundId, BigDecimal principal, Integer numberOfRepayments, + Integer repaidEvery, EnumOptionData repaidEveryFrequencyEnums, Integer loanTermFrequency, + EnumOptionData loanTermFrequencyTypeEnum, BigDecimal nominalInterestRate, EnumOptionData amortizationEnumOption, + EnumOptionData interestMethodEnum, EnumOptionData interestCalculationPeriodEnum, BigDecimal arrearsTolerance, + Long transactionProcessingStrategyId, Integer graceOnPrincipalPayment, Integer graceOnInterestPayment, + Integer graceOnInterestCharged, LocalDate interestChargedFromDate, LocalDate repaymentsStartingFromDate, Integer rowIndex, + String externalId, String linkAccountId, String locale, String dateFormat) { return new LoanAccountData(loanTypeEnumOption, groupIdforGroupLoan, productId, loanOfficerId, submittedOnDate, fundId, principal, numberOfRepayments, repaidEvery, repaidEveryFrequencyEnums, loanTermFrequency, loanTermFrequencyTypeEnum, @@ -468,14 +468,14 @@ public static LoanAccountData importInstanceGroup(EnumOptionData loanTypeEnumOpt } private LoanAccountData(EnumOptionData loanType, Long clientId, Long productId, Long loanOfficerId, LocalDate submittedOnDate, - Long fundId, BigDecimal principal, Integer numberOfRepayments, Integer repaymentEvery, EnumOptionData repaymentFrequencyType, - Integer loanTermFrequency, EnumOptionData loanTermFrequencyType, BigDecimal interestRatePerPeriod, - LocalDate expectedDisbursementDate, EnumOptionData amortizationType, EnumOptionData interestType, - EnumOptionData interestCalculationPeriodType, BigDecimal inArrearsTolerance, Long transactionProcessingStrategyId, - Integer graceOnPrincipalPayment, Integer graceOnInterestPayment, Integer graceOnInterestCharged, - LocalDate interestChargedFromDate, LocalDate repaymentsStartingFromDate, Integer rowIndex, String externalId, Long groupId, - Collection charges, String linkAccountId, String locale, String dateFormat, - Collection loanCollateralManagementData) { + Long fundId, BigDecimal principal, Integer numberOfRepayments, Integer repaymentEvery, EnumOptionData repaymentFrequencyType, + Integer loanTermFrequency, EnumOptionData loanTermFrequencyType, BigDecimal interestRatePerPeriod, + LocalDate expectedDisbursementDate, EnumOptionData amortizationType, EnumOptionData interestType, + EnumOptionData interestCalculationPeriodType, BigDecimal inArrearsTolerance, Long transactionProcessingStrategyId, + Integer graceOnPrincipalPayment, Integer graceOnInterestPayment, Integer graceOnInterestCharged, + LocalDate interestChargedFromDate, LocalDate repaymentsStartingFromDate, Integer rowIndex, String externalId, Long groupId, + Collection charges, String linkAccountId, String locale, String dateFormat, + Collection loanCollateralManagementData) { this.dateFormat = dateFormat; this.locale = locale; this.rowIndex = rowIndex; @@ -629,15 +629,15 @@ private LoanAccountData(EnumOptionData loanType, Long clientId, Long productId, } public LoanAccountData(Collection loanCycleCompletedOptions, Collection loanPurposeOptions, - Collection businessEvolutionOptions, Collection yesnoOptions, - Collection businessExperienceOptions, Collection businessLocationOptions, - Collection clientTypeOptions, Collection loanStatusOptions, - Collection institutionTypeOptions, Collection housingTypeOptions, - Collection classificationOptions, Collection jobTypeOptions, - Collection educationLevelOptions, Collection maritalStatusOptions, - Collection groupPositionOptions, Collection sourceOfFundsOptions, - Collection cancellationReasonOptions, List facilitatorOptions, - Collection documentTypeOptions) { + Collection businessEvolutionOptions, Collection yesnoOptions, + Collection businessExperienceOptions, Collection businessLocationOptions, + Collection clientTypeOptions, Collection loanStatusOptions, + Collection institutionTypeOptions, Collection housingTypeOptions, + Collection classificationOptions, Collection jobTypeOptions, + Collection educationLevelOptions, Collection maritalStatusOptions, + Collection groupPositionOptions, Collection sourceOfFundsOptions, + Collection cancellationReasonOptions, List facilitatorOptions, + Collection documentTypeOptions) { this.loanCycleCompletedOptions = loanCycleCompletedOptions; this.loanPurposeOptions = loanPurposeOptions; this.businessEvolutionOptions = businessEvolutionOptions; @@ -1039,7 +1039,7 @@ public static LoanAccountData collateralTemplate(final Collection * Used to produce a {@link LoanAccountData} with only client information defaulted. */ public static LoanAccountData clientDefaults(final Long clientId, final String clientAccountNo, final String clientName, - final Long clientOfficeId, final LocalDate expectedDisbursementDate) { + final Long clientOfficeId, final LocalDate expectedDisbursementDate) { final Long id = null; final String accountNo = null; final LoanStatusEnumData status = null; @@ -1413,15 +1413,15 @@ public static LoanAccountData populateGroupDefaults(final LoanAccountData acc, f } public static LoanAccountData loanProductWithTemplateDefaults(final LoanProductData product, - final Collection termFrequencyTypeOptions, final Collection repaymentFrequencyTypeOptions, - final Collection repaymentFrequencyNthDayTypeOptions, - final Collection repaymentFrequencyDayOfWeekTypeOptions, - final Collection repaymentStrategyOptions, - final Collection interestRateFrequencyTypeOptions, final Collection amortizationTypeOptions, - final Collection interestTypeOptions, final Collection interestCalculationPeriodTypeOptions, - final Collection fundOptions, final Collection chargeOptions, - final Collection loanPurposeOptions, final Collection loanCollateralOptions, - final Integer loanCycleNumber, final Collection clientActiveLoanOptions) { + final Collection termFrequencyTypeOptions, final Collection repaymentFrequencyTypeOptions, + final Collection repaymentFrequencyNthDayTypeOptions, + final Collection repaymentFrequencyDayOfWeekTypeOptions, + final Collection repaymentStrategyOptions, + final Collection interestRateFrequencyTypeOptions, final Collection amortizationTypeOptions, + final Collection interestTypeOptions, final Collection interestCalculationPeriodTypeOptions, + final Collection fundOptions, final Collection chargeOptions, + final Collection loanPurposeOptions, final Collection loanCollateralOptions, + final Integer loanCycleNumber, final Collection clientActiveLoanOptions) { final Long id = null; final String accountNo = null; @@ -1670,32 +1670,32 @@ public static LoanAccountData populateLoanProductDefaults(final LoanAccountData * Used to send back loan account data with the basic details coming from query. */ public static LoanAccountData basicLoanDetails(final Long id, final String accountNo, final LoanStatusEnumData status, - final String externalId, final Long clientId, final String clientAccountNo, final String clientName, final Long clientOfficeId, - final GroupGeneralData group, final EnumOptionData loanType, final Long loanProductId, final String loanProductName, - final String loanProductDescription, final boolean isLoanProductLinkedToFloatingRate, final Long fundId, final String fundName, - final Long loanPurposeId, final String loanPurposeName, final Long loanOfficerId, final String loanOfficerName, - final CurrencyData currencyData, final BigDecimal proposedPrincipal, final BigDecimal principal, - final BigDecimal approvedPrincipal, final BigDecimal netDisbursalAmount, final BigDecimal totalOverpaid, - final BigDecimal inArrearsTolerance, final Integer termFrequency, final EnumOptionData termPeriodFrequencyType, - final Integer numberOfRepayments, final Integer repaymentEvery, final EnumOptionData repaymentFrequencyType, - EnumOptionData repaymentFrequencyNthDayType, EnumOptionData repaymentFrequencyDayOfWeekType, final Long transactionStrategyId, - final String transactionStrategyName, final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, - final EnumOptionData interestRateFrequencyType, final BigDecimal annualInterestRate, final EnumOptionData interestType, - final boolean isFloatingInterestRate, final BigDecimal interestRateDifferential, - final EnumOptionData interestCalculationPeriodType, Boolean allowPartialPeriodInterestCalcualtion, - final LocalDate expectedFirstRepaymentOnDate, final Integer graceOnPrincipalPayment, - final Integer recurringMoratoriumOnPrincipalPeriods, final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, - final LocalDate interestChargedFromDate, final LoanApplicationTimelineData timeline, final LoanSummaryData loanSummary, - final BigDecimal feeChargesDueAtDisbursementCharged, final Boolean syncDisbursementWithMeeting, final Integer loanCounter, - final Integer loanProductCounter, final Boolean multiDisburseLoan, Boolean canDefineInstallmentAmount, - final BigDecimal fixedEmiAmont, final BigDecimal outstandingLoanBalance, final Boolean inArrears, - final Integer graceOnArrearsAgeing, final Boolean isNPA, final EnumOptionData daysInMonthType, - final EnumOptionData daysInYearType, final boolean isInterestRecalculationEnabled, - final LoanInterestRecalculationData interestRecalculationData, final Boolean createStandingInstructionAtDisbursement, - final Boolean isVariableInstallmentsAllowed, Integer minimumGap, Integer maximumGap, final EnumOptionData subStatus, - final boolean canUseForTopup, final boolean isTopup, final Long closureLoanId, final String closureLoanAccountNo, - final BigDecimal topupAmount, final boolean isEqualAmortization, final BigDecimal fixedPrincipalPercentagePerInstallment, - String contractNo, BigDecimal requiredGuaranteeAmount, BigDecimal actualGuaranteeAmount) { + final String externalId, final Long clientId, final String clientAccountNo, final String clientName, final Long clientOfficeId, + final GroupGeneralData group, final EnumOptionData loanType, final Long loanProductId, final String loanProductName, + final String loanProductDescription, final boolean isLoanProductLinkedToFloatingRate, final Long fundId, final String fundName, + final Long loanPurposeId, final String loanPurposeName, final Long loanOfficerId, final String loanOfficerName, + final CurrencyData currencyData, final BigDecimal proposedPrincipal, final BigDecimal principal, + final BigDecimal approvedPrincipal, final BigDecimal netDisbursalAmount, final BigDecimal totalOverpaid, + final BigDecimal inArrearsTolerance, final Integer termFrequency, final EnumOptionData termPeriodFrequencyType, + final Integer numberOfRepayments, final Integer repaymentEvery, final EnumOptionData repaymentFrequencyType, + EnumOptionData repaymentFrequencyNthDayType, EnumOptionData repaymentFrequencyDayOfWeekType, final Long transactionStrategyId, + final String transactionStrategyName, final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, + final EnumOptionData interestRateFrequencyType, final BigDecimal annualInterestRate, final EnumOptionData interestType, + final boolean isFloatingInterestRate, final BigDecimal interestRateDifferential, + final EnumOptionData interestCalculationPeriodType, Boolean allowPartialPeriodInterestCalcualtion, + final LocalDate expectedFirstRepaymentOnDate, final Integer graceOnPrincipalPayment, + final Integer recurringMoratoriumOnPrincipalPeriods, final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, + final LocalDate interestChargedFromDate, final LoanApplicationTimelineData timeline, final LoanSummaryData loanSummary, + final BigDecimal feeChargesDueAtDisbursementCharged, final Boolean syncDisbursementWithMeeting, final Integer loanCounter, + final Integer loanProductCounter, final Boolean multiDisburseLoan, Boolean canDefineInstallmentAmount, + final BigDecimal fixedEmiAmont, final BigDecimal outstandingLoanBalance, final Boolean inArrears, + final Integer graceOnArrearsAgeing, final Boolean isNPA, final EnumOptionData daysInMonthType, + final EnumOptionData daysInYearType, final boolean isInterestRecalculationEnabled, + final LoanInterestRecalculationData interestRecalculationData, final Boolean createStandingInstructionAtDisbursement, + final Boolean isVariableInstallmentsAllowed, Integer minimumGap, Integer maximumGap, final EnumOptionData subStatus, + final boolean canUseForTopup, final boolean isTopup, final Long closureLoanId, final String closureLoanAccountNo, + final BigDecimal topupAmount, final boolean isEqualAmortization, final BigDecimal fixedPrincipalPercentagePerInstallment, + String contractNo, BigDecimal requiredGuaranteeAmount, BigDecimal actualGuaranteeAmount) { final LoanScheduleData repaymentSchedule = null; final Collection transactions = null; @@ -1769,24 +1769,24 @@ public static LoanAccountData basicLoanDetails(final Long id, final String accou * Used to combine the associations and template data on top of exist loan account data */ public static LoanAccountData associationsAndTemplate(final LoanAccountData acc, final LoanScheduleData repaymentSchedule, - final Collection transactions, final Collection charges, - final Collection collateral, final Collection guarantors, - final CalendarData calendarData, final Collection productOptions, - final Collection termFrequencyTypeOptions, final Collection repaymentFrequencyTypeOptions, - final Collection repaymentFrequencyNthDayTypeOptions, - final Collection repaymentFrequencyDayOfWeekTypeOptions, - final Collection transactionProcessingStrategyOptions, - final Collection interestRateFrequencyTypeOptions, final Collection amortizationTypeOptions, - final Collection interestTypeOptions, final Collection interestCalculationPeriodTypeOptions, - final Collection fundOptions, final Collection chargeOptions, final ChargeData chargeTemplate, - final Collection loanOfficerOptions, final Collection loanPurposeOptions, - final Collection loanCollateralOptions, final Collection calendarOptions, - final Collection notes, final Collection accountLinkingOptions, - final PortfolioAccountData linkedAccount, final Collection disbursementDetails, - final Collection emiAmountVariations, final Collection overdueCharges, - final PaidInAdvanceData paidInAdvance, Collection interestRatesPeriods, - final Collection clientActiveLoanOptions, final List rates, final Boolean isRatesEnabled, - final CollectionData delinquent) { + final Collection transactions, final Collection charges, + final Collection collateral, final Collection guarantors, + final CalendarData calendarData, final Collection productOptions, + final Collection termFrequencyTypeOptions, final Collection repaymentFrequencyTypeOptions, + final Collection repaymentFrequencyNthDayTypeOptions, + final Collection repaymentFrequencyDayOfWeekTypeOptions, + final Collection transactionProcessingStrategyOptions, + final Collection interestRateFrequencyTypeOptions, final Collection amortizationTypeOptions, + final Collection interestTypeOptions, final Collection interestCalculationPeriodTypeOptions, + final Collection fundOptions, final Collection chargeOptions, final ChargeData chargeTemplate, + final Collection loanOfficerOptions, final Collection loanPurposeOptions, + final Collection loanCollateralOptions, final Collection calendarOptions, + final Collection notes, final Collection accountLinkingOptions, + final PortfolioAccountData linkedAccount, final Collection disbursementDetails, + final Collection emiAmountVariations, final Collection overdueCharges, + final PaidInAdvanceData paidInAdvance, Collection interestRatesPeriods, + final Collection clientActiveLoanOptions, final List rates, final Boolean isRatesEnabled, + final CollectionData delinquent) { LoanProductConfigurableAttributes loanProductConfigurableAttributes = null; if (acc.product != null) { loanProductConfigurableAttributes = acc.product.getloanProductConfigurableAttributes(); @@ -1825,8 +1825,8 @@ public static LoanAccountData associationsAndTemplate(final LoanAccountData acc, } public static LoanAccountData associationsAndTemplate(final LoanAccountData acc, final Collection productOptions, - final Collection allowedLoanOfficers, final Collection calendarOptions, - final Collection accountLinkingOptions, final Boolean isRatesEnabled) { + final Collection allowedLoanOfficers, final Collection calendarOptions, + final Collection accountLinkingOptions, final Boolean isRatesEnabled) { return associationsAndTemplate(acc, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.meeting, productOptions, acc.termFrequencyTypeOptions, acc.repaymentFrequencyTypeOptions, acc.repaymentFrequencyNthDayTypeOptions, acc.repaymentFrequencyDaysOfWeekTypeOptions, @@ -1938,7 +1938,7 @@ public static LoanAccountData associateMemberVariations(final LoanAccountData ac } public static LoanAccountData withInterestRecalculationCalendarData(final LoanAccountData acc, final CalendarData calendarData, - final CalendarData compoundingCalendarData) { + final CalendarData compoundingCalendarData) { final LoanInterestRecalculationData interestRecalculationData = LoanInterestRecalculationData .withCalendarData(acc.interestRecalculationData, calendarData, compoundingCalendarData); @@ -2037,60 +2037,60 @@ public static LoanAccountData withOriginalSchedule(final LoanAccountData acc, fi } private LoanAccountData(final Long id, // - final String accountNo, // - final LoanStatusEnumData status, // - final String externalId, // - final Long clientId, final String clientAccountNo, final String clientName, final Long clientOfficeId, // - final GroupGeneralData group, final EnumOptionData loanType, final Long loanProductId, final String loanProductName, - final String loanProductDescription, // - final boolean isLoanProductLinkedToFloatingRate, final Long fundId, final String fundName, final Long loanPurposeId, - final String loanPurposeName, // - final Long loanOfficerId, final String loanOfficerName, // - final CurrencyData currency, BigDecimal proposedPrincipal, final BigDecimal principal, final BigDecimal approvedPrincipal, - final BigDecimal netDisbursalAmount, final BigDecimal totalOverpaid, // - final BigDecimal inArrearsTolerance, final Integer termFrequency, // - final EnumOptionData termPeriodFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery, - final EnumOptionData repaymentFrequencyType, // - final EnumOptionData repaymentFrequencyNthDayType, final EnumOptionData repaymentFrequencyDayOfWeekType, - final Long transactionProcessingStrategyId, final String transactionProcessingStrategyName, - final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType, - final BigDecimal annualInterestRate, final EnumOptionData interestType, final boolean isFloatingInterestRate, - final BigDecimal interestRateDifferential, final EnumOptionData interestCalculationPeriodType, - final Boolean allowPartialPeriodInterestCalcualtion, final LocalDate expectedFirstRepaymentOnDate, - final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods, - final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final LocalDate interestChargedFromDate, - final LoanApplicationTimelineData timeline, final LoanSummaryData summary, final BigDecimal feeChargesDueAtDisbursementCharged, - final LoanScheduleData repaymentSchedule, final Collection transactions, - final Collection charges, final Collection collateral, - final Collection guarantors, final CalendarData meeting, final Collection productOptions, - final Collection termFrequencyTypeOptions, final Collection repaymentFrequencyTypeOptions, - final Collection repaymentFrequencyNthDayTypeOptions, - final Collection repaymentFrequencyDaysOfWeekTypeOptions, - final Collection transactionProcessingStrategyOptions, - final Collection interestRateFrequencyTypeOptions, final Collection amortizationTypeOptions, - final Collection interestTypeOptions, final Collection interestCalculationPeriodTypeOptions, - final Collection fundOptions, final Collection chargeOptions, final ChargeData chargeTemplate, - final Collection loanOfficerOptions, final Collection loanPurposeOptions, - final Collection loanCollateralOptions, final Collection calendarOptions, - final Boolean syncDisbursementWithMeeting, final Integer loanCounter, final Integer loanProductCounter, - final Collection notes, final Collection accountLinkingOptions, - final PortfolioAccountData linkedAccount, final Collection disbursementDetails, - final Boolean multiDisburseLoan, final Boolean canDefineInstallmentAmount, BigDecimal fixedEmiAmount, - final BigDecimal maxOutstandingLoanBalance, final Collection emiAmountVariations, - final Map memberVariations, final LoanProductData product, final Boolean inArrears, - final Integer graceOnArrearsAgeing, final Collection overdueCharges, final Boolean isNPA, - final EnumOptionData daysInMonthType, final EnumOptionData daysInYearType, final boolean isInterestRecalculationEnabled, - final LoanInterestRecalculationData interestRecalculationData, final LoanScheduleData originalSchedule, - final Boolean createStandingInstructionAtDisbursement, final PaidInAdvanceData paidInAdvance, - final Collection interestRatesPeriods, final Boolean isVariableInstallmentsAllowed, - final Integer minimumGap, final Integer maximumGap, final EnumOptionData subStatus, final Boolean canUseForTopup, - final Collection clientActiveLoanOptions, final boolean isTopup, final Long closureLoanId, - final String closureLoanAccountNo, final BigDecimal topupAmount, final boolean isEqualAmortization, final List rates, - final Boolean isRatesEnabled, final BigDecimal fixedPrincipalPercentagePerInstallment, final CollectionData delinquent, - final String contractNo, final Collection agencyOptions, final Collection centerOptions, - final Collection groupOptions, final Collection facilitatorOptions, - final Collection disbursementMethodOptions, BigDecimal requiredGuaranteeAmount, - final BigDecimal actualGuaranteeAmount, GroupLoanAdditionalData groupLoanAdditionalData) { + final String accountNo, // + final LoanStatusEnumData status, // + final String externalId, // + final Long clientId, final String clientAccountNo, final String clientName, final Long clientOfficeId, // + final GroupGeneralData group, final EnumOptionData loanType, final Long loanProductId, final String loanProductName, + final String loanProductDescription, // + final boolean isLoanProductLinkedToFloatingRate, final Long fundId, final String fundName, final Long loanPurposeId, + final String loanPurposeName, // + final Long loanOfficerId, final String loanOfficerName, // + final CurrencyData currency, BigDecimal proposedPrincipal, final BigDecimal principal, final BigDecimal approvedPrincipal, + final BigDecimal netDisbursalAmount, final BigDecimal totalOverpaid, // + final BigDecimal inArrearsTolerance, final Integer termFrequency, // + final EnumOptionData termPeriodFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery, + final EnumOptionData repaymentFrequencyType, // + final EnumOptionData repaymentFrequencyNthDayType, final EnumOptionData repaymentFrequencyDayOfWeekType, + final Long transactionProcessingStrategyId, final String transactionProcessingStrategyName, + final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType, + final BigDecimal annualInterestRate, final EnumOptionData interestType, final boolean isFloatingInterestRate, + final BigDecimal interestRateDifferential, final EnumOptionData interestCalculationPeriodType, + final Boolean allowPartialPeriodInterestCalcualtion, final LocalDate expectedFirstRepaymentOnDate, + final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods, + final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final LocalDate interestChargedFromDate, + final LoanApplicationTimelineData timeline, final LoanSummaryData summary, final BigDecimal feeChargesDueAtDisbursementCharged, + final LoanScheduleData repaymentSchedule, final Collection transactions, + final Collection charges, final Collection collateral, + final Collection guarantors, final CalendarData meeting, final Collection productOptions, + final Collection termFrequencyTypeOptions, final Collection repaymentFrequencyTypeOptions, + final Collection repaymentFrequencyNthDayTypeOptions, + final Collection repaymentFrequencyDaysOfWeekTypeOptions, + final Collection transactionProcessingStrategyOptions, + final Collection interestRateFrequencyTypeOptions, final Collection amortizationTypeOptions, + final Collection interestTypeOptions, final Collection interestCalculationPeriodTypeOptions, + final Collection fundOptions, final Collection chargeOptions, final ChargeData chargeTemplate, + final Collection loanOfficerOptions, final Collection loanPurposeOptions, + final Collection loanCollateralOptions, final Collection calendarOptions, + final Boolean syncDisbursementWithMeeting, final Integer loanCounter, final Integer loanProductCounter, + final Collection notes, final Collection accountLinkingOptions, + final PortfolioAccountData linkedAccount, final Collection disbursementDetails, + final Boolean multiDisburseLoan, final Boolean canDefineInstallmentAmount, BigDecimal fixedEmiAmount, + final BigDecimal maxOutstandingLoanBalance, final Collection emiAmountVariations, + final Map memberVariations, final LoanProductData product, final Boolean inArrears, + final Integer graceOnArrearsAgeing, final Collection overdueCharges, final Boolean isNPA, + final EnumOptionData daysInMonthType, final EnumOptionData daysInYearType, final boolean isInterestRecalculationEnabled, + final LoanInterestRecalculationData interestRecalculationData, final LoanScheduleData originalSchedule, + final Boolean createStandingInstructionAtDisbursement, final PaidInAdvanceData paidInAdvance, + final Collection interestRatesPeriods, final Boolean isVariableInstallmentsAllowed, + final Integer minimumGap, final Integer maximumGap, final EnumOptionData subStatus, final Boolean canUseForTopup, + final Collection clientActiveLoanOptions, final boolean isTopup, final Long closureLoanId, + final String closureLoanAccountNo, final BigDecimal topupAmount, final boolean isEqualAmortization, final List rates, + final Boolean isRatesEnabled, final BigDecimal fixedPrincipalPercentagePerInstallment, final CollectionData delinquent, + final String contractNo, final Collection agencyOptions, final Collection centerOptions, + final Collection groupOptions, final Collection facilitatorOptions, + final Collection disbursementMethodOptions, BigDecimal requiredGuaranteeAmount, + final BigDecimal actualGuaranteeAmount, GroupLoanAdditionalData groupLoanAdditionalData) { this.id = id; this.accountNo = accountNo; @@ -2328,7 +2328,7 @@ public Long clientId() { } private static BigDecimal fetchLoanCycleDefaultValue(Collection borrowerCycleVariationData, - Integer loanCycleNumber) { + Integer loanCycleNumber) { BigDecimal defaultValue = null; Integer cycleNumberSelected = 0; for (LoanProductBorrowerCycleVariationData data : borrowerCycleVariationData) { @@ -2343,7 +2343,7 @@ private static BigDecimal fetchLoanCycleDefaultValue(Collection dataValidationErrors = new ArrayList<>(); this.apiJsonHelper.validateSelectedPeriodFrequencyTypeIsTheSame(dataValidationErrors, loanTermFrequency, loanTermFrequencyType, numberOfRepayments, repaymentEvery, repaymentEveryType); @@ -1314,7 +1314,7 @@ private void validateDisbursementsAreDatewiseOrdered(JsonElement element, final } public void validateLoanMultiDisbursementDate(final JsonElement element, final DataValidatorBuilder baseDataValidator, - LocalDate expectedDisbursement, BigDecimal totalPrincipal) { + LocalDate expectedDisbursement, BigDecimal totalPrincipal) { this.validateDisbursementsAreDatewiseOrdered(element, baseDataValidator); @@ -1396,22 +1396,22 @@ public void validateLoanCharges(final Set charges, final List activeLoansLoanProductIds, final Long productId, - final String productName) { + final String productName) { if (!CollectionUtils.isEmpty(activeLoansLoanProductIds)) { final Collection restrictedPrdouctsList = this.loanProductReadPlatformService @@ -949,17 +949,17 @@ private void createAndPersistCalendarInstanceForInterestRecalculation(final Loan } private void createCalendar(final Loan loan, LocalDate calendarStartDate, Integer recalculationFrequencyNthDay, - final Integer repeatsOnDay, final RecalculationFrequencyType recalculationFrequencyType, Integer frequency, - CalendarEntityType calendarEntityType, final String title) { + final Integer repeatsOnDay, final RecalculationFrequencyType recalculationFrequencyType, Integer frequency, + CalendarEntityType calendarEntityType, final String title) { CalendarFrequencyType calendarFrequencyType = CalendarFrequencyType.INVALID; Integer updatedRepeatsOnDay = repeatsOnDay; switch (recalculationFrequencyType) { case DAILY: calendarFrequencyType = CalendarFrequencyType.DAILY; - break; + break; case MONTHLY: calendarFrequencyType = CalendarFrequencyType.MONTHLY; - break; + break; case SAME_AS_REPAYMENT_PERIOD: frequency = loan.repaymentScheduleDetail().getRepayEvery(); calendarFrequencyType = CalendarFrequencyType.from(loan.repaymentScheduleDetail().getRepaymentPeriodFrequencyType()); @@ -967,12 +967,12 @@ private void createCalendar(final Loan loan, LocalDate calendarStartDate, Intege if (updatedRepeatsOnDay == null) { updatedRepeatsOnDay = calendarStartDate.get(ChronoField.DAY_OF_WEEK); } - break; + break; case WEEKLY: calendarFrequencyType = CalendarFrequencyType.WEEKLY; - break; + break; default: - break; + break; } final Calendar calendar = Calendar.createRepeatingCalendar(title, calendarStartDate, CalendarType.COLLECTION.getValue(), diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java index cbff8e95c48..bf05ca5bf5e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java @@ -120,16 +120,16 @@ public class LoanAssembler { @Autowired public LoanAssembler(final FromJsonHelper fromApiJsonHelper, final LoanRepositoryWrapper loanRepository, - final LoanProductRepository loanProductRepository, final ClientRepositoryWrapper clientRepository, - final GroupRepository groupRepository, final FundRepository fundRepository, - final LoanTransactionProcessingStrategyRepository loanTransactionProcessingStrategyRepository, - final StaffRepository staffRepository, final CodeValueRepositoryWrapper codeValueRepository, - final LoanScheduleAssembler loanScheduleAssembler, final LoanChargeAssembler loanChargeAssembler, - final LoanCollateralAssembler collateralAssembler, final LoanSummaryWrapper loanSummaryWrapper, - final LoanRepaymentScheduleTransactionProcessorFactory loanRepaymentScheduleTransactionProcessorFactory, - final HolidayRepository holidayRepository, final ConfigurationDomainService configurationDomainService, - final WorkingDaysRepositoryWrapper workingDaysRepository, final LoanUtilService loanUtilService, RateAssembler rateAssembler, - PrequalificationGroupRepositoryWrapper prequalificationGroupRepositoryWrapper) { + final LoanProductRepository loanProductRepository, final ClientRepositoryWrapper clientRepository, + final GroupRepository groupRepository, final FundRepository fundRepository, + final LoanTransactionProcessingStrategyRepository loanTransactionProcessingStrategyRepository, + final StaffRepository staffRepository, final CodeValueRepositoryWrapper codeValueRepository, + final LoanScheduleAssembler loanScheduleAssembler, final LoanChargeAssembler loanChargeAssembler, + final LoanCollateralAssembler collateralAssembler, final LoanSummaryWrapper loanSummaryWrapper, + final LoanRepaymentScheduleTransactionProcessorFactory loanRepaymentScheduleTransactionProcessorFactory, + final HolidayRepository holidayRepository, final ConfigurationDomainService configurationDomainService, + final WorkingDaysRepositoryWrapper workingDaysRepository, final LoanUtilService loanUtilService, RateAssembler rateAssembler, + PrequalificationGroupRepositoryWrapper prequalificationGroupRepositoryWrapper) { this.fromApiJsonHelper = fromApiJsonHelper; this.loanRepository = loanRepository; this.loanProductRepository = loanProductRepository; @@ -350,7 +350,8 @@ private Loan assembleApplication(final JsonElement element, final Long clientId, PrequalificationGroup prequalificationGroup = null; final Boolean isBulkImport = this.fromApiJsonHelper.extractBooleanNamed("isBulkImport", element); - if (isBulkImport == null || !isBulkImport) { + final Boolean isRestructuredLoan = this.fromApiJsonHelper.extractBooleanNamed("isRestructuredLoan", element); + if ((isBulkImport == null || !isBulkImport) && (isRestructuredLoan == null || !isRestructuredLoan)) { final Long prequalificationId = this.fromApiJsonHelper.extractLongNamed("prequalificationId", element); prequalificationGroup = this.prequalificationGroupRepositoryWrapper.findOneWithNotFoundDetection(prequalificationId); if (!PrequalificationStatus.BURO_CHECKED.getValue().equals(prequalificationGroup.getStatus())) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java index 08510843853..037a20f1db3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java @@ -98,6 +98,8 @@ LoanScheduleData retrieveRepaymentSchedule(Long loanId, RepaymentScheduleRelated Integer retriveLoanCounter(Long clientId, Long productId); + Integer retriveLoanCounterByClient(Long clientId); + Collection retrieveLoanDisbursementDetails(Long loanId); DisbursementData retrieveLoanDisbursementDetail(Long loanId, Long disbursementId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java index ac05ecc8352..c0903220b2a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java @@ -178,19 +178,19 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { @Autowired public LoanReadPlatformServiceImpl(final PlatformSecurityContext context, - final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository, - final LoanProductReadPlatformService loanProductReadPlatformService, final ClientReadPlatformService clientReadPlatformService, - final GroupReadPlatformService groupReadPlatformService, final LoanDropdownReadPlatformService loanDropdownReadPlatformService, - final FundReadPlatformService fundReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService, - final CodeValueReadPlatformService codeValueReadPlatformService, final JdbcTemplate jdbcTemplate, - final NamedParameterJdbcTemplate namedParameterJdbcTemplate, final CalendarReadPlatformService calendarReadPlatformService, - final StaffReadPlatformService staffReadPlatformService, final PaymentTypeReadPlatformService paymentTypeReadPlatformService, - final LoanRepaymentScheduleTransactionProcessorFactory loanRepaymentScheduleTransactionProcessorFactory, - final FloatingRatesReadPlatformService floatingRatesReadPlatformService, final LoanUtilService loanUtilService, - final ConfigurationDomainService configurationDomainService, final CodeValueRepositoryWrapper codeValueRepositoryWrapper, - final AccountDetailsReadPlatformService accountDetailsReadPlatformService, final LoanRepositoryWrapper loanRepositoryWrapper, - final ColumnValidator columnValidator, DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper paginationHelper, - LoanAdditionalPropertiesRepository loanAdditionalPropertiesRepository) { + final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository, + final LoanProductReadPlatformService loanProductReadPlatformService, final ClientReadPlatformService clientReadPlatformService, + final GroupReadPlatformService groupReadPlatformService, final LoanDropdownReadPlatformService loanDropdownReadPlatformService, + final FundReadPlatformService fundReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService, + final CodeValueReadPlatformService codeValueReadPlatformService, final JdbcTemplate jdbcTemplate, + final NamedParameterJdbcTemplate namedParameterJdbcTemplate, final CalendarReadPlatformService calendarReadPlatformService, + final StaffReadPlatformService staffReadPlatformService, final PaymentTypeReadPlatformService paymentTypeReadPlatformService, + final LoanRepaymentScheduleTransactionProcessorFactory loanRepaymentScheduleTransactionProcessorFactory, + final FloatingRatesReadPlatformService floatingRatesReadPlatformService, final LoanUtilService loanUtilService, + final ConfigurationDomainService configurationDomainService, final CodeValueRepositoryWrapper codeValueRepositoryWrapper, + final AccountDetailsReadPlatformService accountDetailsReadPlatformService, final LoanRepositoryWrapper loanRepositoryWrapper, + final ColumnValidator columnValidator, DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper paginationHelper, + LoanAdditionalPropertiesRepository loanAdditionalPropertiesRepository) { this.context = context; this.loanRepositoryWrapper = loanRepositoryWrapper; this.applicationCurrencyRepository = applicationCurrencyRepository; @@ -298,8 +298,8 @@ public List retrieveGLIMChildLoansByGLIMParentAccount(String pa @Override public LoanScheduleData retrieveRepaymentSchedule(final Long loanId, - final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, Collection disbursementData, - boolean isInterestRecalculationEnabled, BigDecimal totalPaidFeeCharges) { + final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, Collection disbursementData, + boolean isInterestRecalculationEnabled, BigDecimal totalPaidFeeCharges) { try { this.context.authenticatedUser(); @@ -569,7 +569,7 @@ public LoanTransactionData retrieveLoanTransactionTemplate(final Long loanId) { @Override public LoanTransactionData retrieveLoanPrePaymentTemplate(final LoanTransactionType repaymentTransactionType, final Long loanId, - LocalDate onDate) { + LocalDate onDate) { this.context.authenticatedUser(); this.loanUtilService.validateRepaymentTransactionType(repaymentTransactionType); @@ -1223,7 +1223,7 @@ private static final class LoanScheduleResultSetExtractor implements ResultSetEx private final BigDecimal totalPaidFeeCharges; LoanScheduleResultSetExtractor(final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, - Collection disbursementData, boolean isInterestRecalculationEnabled, BigDecimal totalPaidFeeCharges) { + Collection disbursementData, boolean isInterestRecalculationEnabled, BigDecimal totalPaidFeeCharges) { this.currency = repaymentScheduleRelatedLoanData.getCurrency(); this.disbursement = repaymentScheduleRelatedLoanData.disbursementData(); this.totalFeeChargesDueAtDisbursement = repaymentScheduleRelatedLoanData.getTotalFeeChargesAtDisbursement(); @@ -1548,7 +1548,7 @@ public LoanTransactionData mapRow(final ResultSet rs, @SuppressWarnings("unused" @Override public LoanAccountData retrieveLoanProductDetailsTemplate(final Long productId, final Long clientId, final Long groupId, - String templateType) { + String templateType) { this.context.authenticatedUser(); @@ -1699,7 +1699,7 @@ public Collection retrieveAllowedLoanOfficers(final Long selectedOffi @Override public Collection retrieveAllLoansWithOverdueInstallments(final Long penaltyWaitPeriod, - final Boolean backdatePenalties) { + final Boolean backdatePenalties) { final MusoniOverdueLoanScheduleMapper rm = new MusoniOverdueLoanScheduleMapper(); final StringBuilder sqlBuilder = new StringBuilder(400); @@ -1743,6 +1743,18 @@ public Integer retriveLoanCounter(final Long clientId, Long productId) { } } + @Override + public Integer retriveLoanCounterByClient(final Long clientId) { + final String sql = "Select COUNT(ml.id) from m_loan ml where ml.client_id = ? and ml.loan_status_id >=300 " + + "and ml.loan_status_id not in (400, 500, 601, 602)"; + Integer loanCounter = this.jdbcTemplate.queryForObject(sql, new Object[] { clientId }, Integer.class); + if (loanCounter != null) { + return loanCounter; + } else { + return 0; + } + } + @Override public Collection retrieveLoanDisbursementDetails(final Long loanId) { final LoanDisbursementDetailMapper rm = new LoanDisbursementDetailMapper(sqlGenerator); @@ -1827,7 +1839,7 @@ public Collection retriveScheduleAccrualData() { LocalDate organisationStartDate = this.configurationDomainService.retrieveOrganisationStartDate(); final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select ").append(mapper.schema()).append( - " where (recaldet.is_compounding_to_be_posted_as_transaction is null or recaldet.is_compounding_to_be_posted_as_transaction = false) ") + " where (recaldet.is_compounding_to_be_posted_as_transaction is null or recaldet.is_compounding_to_be_posted_as_transaction = false) ") .append(" and (((ls.fee_charges_amount <> COALESCE(ls.accrual_fee_charges_derived, 0))") .append(" or ( ls.penalty_charges_amount <> COALESCE(ls.accrual_penalty_charges_derived, 0))") .append(" or ( ls.interest_amount <> COALESCE(ls.accrual_interest_derived, 0)))") @@ -1852,7 +1864,7 @@ public Collection retrivePeriodicAccrualData(final Loca LocalDate organisationStartDate = this.configurationDomainService.retrieveOrganisationStartDate(); final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select ").append(mapper.schema()).append( - " where (recaldet.is_compounding_to_be_posted_as_transaction is null or recaldet.is_compounding_to_be_posted_as_transaction = false) ") + " where (recaldet.is_compounding_to_be_posted_as_transaction is null or recaldet.is_compounding_to_be_posted_as_transaction = false) ") .append(" and (((ls.fee_charges_amount <> COALESCE(ls.accrual_fee_charges_derived, 0))") .append(" or (ls.penalty_charges_amount <> COALESCE(ls.accrual_penalty_charges_derived, 0))") .append(" or (ls.interest_amount <> COALESCE(ls.accrual_interest_derived, 0)))") @@ -2299,7 +2311,7 @@ public LoanTransactionData retrieveCreditBalanceRefundTemplate(Long loanId) { } private LoanTransactionData retrieveRefundTemplate(Long loanId, LoanTransactionType loanTransactionType, - Collection paymentOptions, MonetaryCurrency currency, BigDecimal transactionAmount, BigDecimal netDisbursal) { + Collection paymentOptions, MonetaryCurrency currency, BigDecimal transactionAmount, BigDecimal netDisbursal) { final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency); @@ -2359,7 +2371,7 @@ private void updateInterestRatePeriodData(InterestRatePeriodData rate, LoanAccou public Collection retrieveLoanIdsWithPendingIncomePostingTransactions() { LocalDate currentdate = DateUtils.getBusinessLocalDate(); StringBuilder sqlBuilder = new StringBuilder().append(" select distinct loan.id ").append(" from m_loan as loan ").append( - " inner join m_loan_recalculation_details as recdet on (recdet.loan_id = loan.id and recdet.is_compounding_to_be_posted_as_transaction is not null and recdet.is_compounding_to_be_posted_as_transaction = true) ") + " inner join m_loan_recalculation_details as recdet on (recdet.loan_id = loan.id and recdet.is_compounding_to_be_posted_as_transaction is not null and recdet.is_compounding_to_be_posted_as_transaction = true) ") .append(" inner join m_loan_repayment_schedule as repsch on repsch.loan_id = loan.id ") .append(" inner join m_loan_interest_recalculation_additional_details as adddet on adddet.loan_repayment_schedule_id = repsch.id ") .append(" left join m_loan_transaction as trans on (trans.is_reversed <> true and trans.transaction_type_enum = 19 and trans.loan_id = loan.id and trans.transaction_date = adddet.effective_date) ") diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 6c30b455f6c..6753daf3f8d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -144,6 +144,7 @@ import org.apache.fineract.portfolio.charge.exception.LoanChargeWaiveCannotBeReversedException; import org.apache.fineract.portfolio.charge.exception.LoanChargeWaiveCannotBeReversedException.LoanChargeWaiveCannotUndoReason; import org.apache.fineract.portfolio.client.domain.Client; +import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper; import org.apache.fineract.portfolio.client.exception.ClientNotActiveException; import org.apache.fineract.portfolio.collateralmanagement.domain.ClientCollateralManagement; import org.apache.fineract.portfolio.collateralmanagement.exception.LoanCollateralAmountNotSufficientException; @@ -284,6 +285,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf private final SavingsAccountWritePlatformService savingsAccountWritePlatformService; + private final ClientRepositoryWrapper clientRepository; + private LoanLifecycleStateMachine defaultLoanLifecycleStateMachine() { final List allowedLoanStatuses = Arrays.asList(LoanStatus.values()); return new DefaultLoanLifecycleStateMachine(allowedLoanStatuses); @@ -407,6 +410,11 @@ public CommandProcessingResult disburseLoan(final Long loanId, final JsonCommand .isPaymnetypeApplicableforDisbursementCharge(); // Recalculate first repayment date based in actual disbursement date. + Client client = loan.getClient(); + Integer loanCycle = this.loanReadPlatformService.retriveLoanCounterByClient(client.getId()); + client.updateLoanCycle(loanCycle + 1); + this.clientRepository.save(client); + updateLoanCounters(loan, actualDisbursementDate, command); Money amountBeforeAdjust = loan.getPrincpal(); loan.validateAccountStatus(LoanEvent.LOAN_DISBURSED); @@ -1010,7 +1018,7 @@ public CommandProcessingResult makeLoanRepayment(final LoanTransactionType repay final boolean adjustGuarantee = command.booleanPrimitiveValueOfParameterNamed("adjustGuarantee"); if (adjustGuarantee) { - this.savingsAccountWritePlatformService.releaseLoanGuarantee(loanId, command); + this.savingsAccountWritePlatformService.releaseLoanGuarantee(loanId, command,transactionDate); } return commandProcessingResultBuilder.withCommandId(command.commandId()) // @@ -2490,6 +2498,10 @@ private void removeLoanCycle(final Loan loan) { loan.updateClientLoanCounter(null); loan.updateLoanProductLoanCounter(null); + Client client = loan.getClient(); + client.updateLoanCycle(client.getLoanCycle() - 1); + this.clientRepository.save(client); + } private void updateLoanCounters(final Loan loan, final LocalDate actualDisbursementDate, JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java index 168d1ab9363..bd7a0e04bdd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java @@ -938,4 +938,8 @@ public Long getLoanId() { public void setLoanId(Long loanId) { this.loanId = loanId; } + + public void updateDateOf(LocalDate transactionDate) { + this.dateOf =transactionDate; + } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ReleaseAmountSavingsAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ReleaseAmountSavingsAccountCommandHandler.java index 876f9776adc..6182738225e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ReleaseAmountSavingsAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/ReleaseAmountSavingsAccountCommandHandler.java @@ -42,7 +42,7 @@ public ReleaseAmountSavingsAccountCommandHandler(final SavingsAccountWritePlatfo @Override public CommandProcessingResult processCommand(JsonCommand command) { final Long transactionId = Long.valueOf(command.getTransactionId()); - return this.writePlatformService.releaseAmount(command.getSavingsId(), transactionId); + return this.writePlatformService.releaseAmount(command.getSavingsId(), transactionId, null); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformService.java index 59dec98d5b5..8acd5dc19dd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformService.java @@ -112,7 +112,7 @@ SavingsAccountData postInterest(SavingsAccountData account, boolean postInterest CommandProcessingResult unblockDebits(Long savingsId); - CommandProcessingResult releaseAmount(Long savingsId, Long transactionId); + CommandProcessingResult releaseAmount(Long savingsId, Long transactionId,LocalDate transactionDate); CommandProcessingResult gsimActivate(Long gsimId, JsonCommand command); @@ -123,5 +123,5 @@ SavingsAccountData postInterest(SavingsAccountData account, boolean postInterest CommandProcessingResult depositAndHoldToClientGuaranteeAccount(BigDecimal depositAmount, BigDecimal requiredGuaranteeAmount, Long clientId, Long loanId, LocalDate transactionDate); - CommandProcessingResult releaseLoanGuarantee(Long loanId, JsonCommand command); + CommandProcessingResult releaseLoanGuarantee(Long loanId, JsonCommand command, LocalDate transactionDate); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java index 40007eabf43..a76ae73a1a3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java @@ -1941,7 +1941,7 @@ public CommandProcessingResult holdAmount(final Long savingsId, final JsonComman @Transactional @Override - public CommandProcessingResult releaseAmount(final Long savingsId, final Long savingsTransactionId) { + public CommandProcessingResult releaseAmount(final Long savingsId, final Long savingsTransactionId,LocalDate transactionDate) { final AppUser submittedBy = this.context.authenticatedUser(); SavingsAccountTransaction holdTransaction = this.savingsAccountTransactionRepository @@ -1970,6 +1970,9 @@ public CommandProcessingResult releaseAmount(final Long savingsId, final Long sa this.savingsAccountTransactionRepository.saveAndFlush(transaction); holdTransaction.updateReleaseId(transaction.getId()); + if (transactionDate != null) { + holdTransaction.updateDateOf(transactionDate); + } if (backdatedTxnsAllowedTill) { this.savingsAccountTransactionRepository.saveAll(account.getSavingsAccountTransactionsWithPivotConfig()); @@ -2172,7 +2175,7 @@ public CommandProcessingResult depositAndHoldToClientGuaranteeAccount(BigDecimal } @Override - public CommandProcessingResult releaseLoanGuarantee(Long loanId, JsonCommand command) { + public CommandProcessingResult releaseLoanGuarantee(Long loanId, JsonCommand command, LocalDate transactionDate) { if (loanId != null && command != null) { List savingsAccountTransactions = this.savingsAccountTransactionRepository @@ -2187,7 +2190,7 @@ public CommandProcessingResult releaseLoanGuarantee(Long loanId, JsonCommand com Long savingsId = holdTransaction.getSavingsAccount().getId(); // release on hold guarantee - CommandProcessingResult releaseResult = this.releaseAmount(savingsId, holdTransaction.getId()); + CommandProcessingResult releaseResult = this.releaseAmount(savingsId, holdTransaction.getId(),transactionDate); SavingsAccountTransaction releaseTransaction = this.savingsAccountTransactionRepository .findOneByIdAndSavingsAccountId(releaseResult.resourceId(), savingsId); releaseTransaction.setLoanId(loanId); @@ -2200,13 +2203,7 @@ public CommandProcessingResult releaseLoanGuarantee(Long loanId, JsonCommand com object.addProperty("transactionAmount", holdTransaction.getAmount()); command.setJsonCommand(object.toString()); - CommandProcessingResult withdrawalResult = this.withdrawal(savingsId, command); - SavingsAccountTransaction withdrawalTransaction = this.savingsAccountTransactionRepository - .findOneByIdAndSavingsAccountId(withdrawalResult.resourceId(), savingsId); - withdrawalTransaction.setLoanId(loanId); - this.savingsAccountTransactionRepository.saveAndFlush(withdrawalTransaction); - - return new CommandProcessingResultBuilder().withEntityId(withdrawalResult.resourceId()) + return new CommandProcessingResultBuilder().withEntityId(releaseResult.resourceId()) .withOfficeId(holdTransaction.getSavingsAccount().officeId()) .withClientId(holdTransaction.getSavingsAccount().clientId()).withGroupId(holdTransaction.getSavingsAccount().groupId()) .withSavingsId(holdTransaction.getSavingsAccount().getId()).build(); diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index 6e5b08854dc..3406f46054b 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -135,4 +135,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0114_FBR_440_pagare_libre_protesto_reporte.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0114_FBR_440_pagare_libre_protesto_reporte.xml index 69ded3cc3ee..4cc9c98ac13 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0114_FBR_440_pagare_libre_protesto_reporte.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0114_FBR_440_pagare_libre_protesto_reporte.xml @@ -313,4 +313,254 @@ + + + + 0 then + case + when dig9=1 then set ans=concat(ans, 'Ciento'); + when dig9=2 then set ans=concat(ans, 'Doscientos'); + when dig9=3 then set ans=concat(ans, 'Trescientos'); + when dig9=4 then set ans=concat(ans, 'Cuatrocientos'); + when dig9=5 then set ans=concat(ans, 'Quinientos'); + when dig9=6 then set ans=concat(ans, 'Seiscientos'); + when dig9=7 then set ans=concat(ans, 'Setecientos'); + when dig9=8 then set ans=concat(ans, 'Ochocientos'); + when dig9=9 then set ans=concat(ans, 'Novecientos'); + else set ans = ans; + end case; + if ans <> '' and dig8 =0 and dig7 = 0 then + set ans=concat(ans, ' Millones'); + end if; + end if; + if ans <> '' and dig8 > 0 then + set ans=concat(ans, ' Y '); + end if; + if dig8 = 1 then + case + when (dig8*10 + dig7) = 10 then set ans=concat(ans,'Diez Millones'); + when (dig8*10 + dig7) = 11 then set ans=concat(ans,'Once Millones'); + when (dig8*10 + dig7) = 12 then set ans=concat(ans,'Doce Millones'); + when (dig8*10 + dig7) = 13 then set ans=concat(ans,'Trece Millones'); + when (dig8*10 + dig7) = 14 then set ans=concat(ans,'Catorce Millones'); + when (dig8*10 + dig7) = 15 then set ans=concat(ans,'Quince Millones'); + when (dig8*10 + dig7) = 16 then set ans=concat(ans,'Dieciséis Millones'); + when (dig8*10 + dig7) = 17 then set ans=concat(ans,'Diecisiete Millones'); + when (dig8*10 + dig7) = 18 then set ans=concat(ans,'Dieciocho Millones'); + when (dig8*10 + dig7) = 19 then set ans=concat(ans,'Diecinueve Millones'); + else set ans=ans; + end case; + else + if dig8 > 0 then + case + when dig8=2 then set ans=concat(ans, ' Veinte'); + when dig8=3 then set ans=concat(ans, ' Treinta'); + when dig8=4 then set ans=concat(ans, ' Cuarenta'); + when dig8=5 then set ans=concat(ans, ' Cincuenta'); + when dig8=6 then set ans=concat(ans, ' Sesenta'); + when dig8=7 then set ans=concat(ans, ' Setenta'); + when dig8=8 then set ans=concat(ans, ' Ochenta'); + when dig8=9 then set ans=concat(ans, ' Noventa'); + else set ans=ans; + end case; + if ans <> '' and dig7 =0 then + set ans=concat(ans, ' Millones'); + end if; + end if; + if ans <> '' and dig7 > 0 and dig8 =0 then + set ans=concat(ans, ' Y '); + end if; + if dig7 > 0 then + case + when dig7=1 then set ans=concat(ans, ' Un Millón'); + when dig7=2 then set ans=concat(ans, ' Dos Millones'); + when dig7=3 then set ans=concat(ans, ' Tres Millones'); + when dig7=4 then set ans=concat(ans, ' Cuatro Millones'); + when dig7=5 then set ans=concat(ans, ' Cinco Millones'); + when dig7=6 then set ans=concat(ans, ' Seis Millones'); + when dig7=7 then set ans=concat(ans, ' Siete Millones'); + when dig7=8 then set ans=concat(ans, ' Ocho Millones'); + when dig7=9 then set ans=concat(ans, ' Nueve Millones'); + else set ans = ans; + end case; + end if; + end if; + if ans <> '' and dig6 > 0 then + set ans=concat(ans, ' Y '); + end if; + + if dig6 > 0 then + case + when dig6=1 then set ans=concat(ans, 'Ciento'); + when dig6=2 then set ans=concat(ans, 'Doscientos'); + when dig6=3 then set ans=concat(ans, 'Trescientos'); + when dig6=4 then set ans=concat(ans, 'Cuatrocientos'); + when dig6=5 then set ans=concat(ans, 'Quinientos'); + when dig6=6 then set ans=concat(ans, 'Seiscientos'); + when dig6=7 then set ans=concat(ans, 'Setecientos'); + when dig6=8 then set ans=concat(ans, 'Ochocientos'); + when dig6=9 then set ans=concat(ans, 'Novecientos'); + else set ans = ans; + end case; + if ans <> '' and dig4 =0 and dig5 = 0 then + set ans=concat(ans, ' Mil'); + end if; + end if; + if ans <> '' and dig5 > 0 then + set ans=concat(ans, ' Y '); + end if; + if dig5 = 1 then + case + when (dig5*10 + dig4) = 10 then set ans=concat(ans,'Diez Mil'); + when (dig5*10 + dig4) = 11 then set ans=concat(ans,'Once Mil'); + when (dig5*10 + dig4) = 12 then set ans=concat(ans,'Doce Mil'); + when (dig5*10 + dig4) = 13 then set ans=concat(ans,'Trece Mil'); + when (dig5*10 + dig4) = 14 then set ans=concat(ans,'Catorce Mil'); + when (dig5*10 + dig4) = 15 then set ans=concat(ans,'Quince Mil'); + when (dig5*10 + dig4) = 16 then set ans=concat(ans,'Dieciséis Mil'); + when (dig5*10 + dig4) = 17 then set ans=concat(ans,'Diecisiete Mil'); + when (dig5*10 + dig4) = 18 then set ans=concat(ans,'Dieciocho Mil'); + when (dig5*10 + dig4) = 19 then set ans=concat(ans,'Diecinueve Mil'); + else set ans=ans; + end case; + else + if dig5 > 0 then + case + when dig5=2 then set ans=concat(ans, ' Veinte'); + when dig5=3 then set ans=concat(ans, ' Treinta'); + when dig5=4 then set ans=concat(ans, ' Cuarenta'); + when dig5=5 then set ans=concat(ans, ' Cincuenta'); + when dig5=6 then set ans=concat(ans, ' Sesenta'); + when dig5=7 then set ans=concat(ans, ' Setenta'); + when dig5=8 then set ans=concat(ans, ' Ochenta'); + when dig5=9 then set ans=concat(ans, ' Noventa'); + else set ans=ans; + end case; + if ans <> '' and dig4 =0 then + set ans=concat(ans, ' Mil'); + end if; + end if; + if ans <> '' and dig4 > 0 and dig5 =0 then + set ans=concat(ans, ' Y '); + end if; + if dig4 > 0 then + case + when dig4=1 then set ans=concat(ans, ' Un Mil'); + when dig4=2 then set ans=concat(ans, ' Dos Mil'); + when dig4=3 then set ans=concat(ans, ' Tres Mil'); + when dig4=4 then set ans=concat(ans, ' Cuatro Mil'); + when dig4=5 then set ans=concat(ans, ' Cinco Mil'); + when dig4=6 then set ans=concat(ans, ' Seis Mil'); + when dig4=7 then set ans=concat(ans, ' Siete Mil'); + when dig4=8 then set ans=concat(ans, ' Ocho Mil'); + when dig4=9 then set ans=concat(ans, ' Nueve Mil'); + else set ans = ans; + end case; + end if; + end if; + if ans <> '' and dig3 > 0 then + set ans=concat(ans, ' Y '); + end if; + if dig3 > 0 then + case + when dig3=1 then set ans=concat(ans, 'Ciento'); + when dig3=2 then set ans=concat(ans, 'Doscientos'); + when dig3=3 then set ans=concat(ans, 'Trescientos'); + when dig3=4 then set ans=concat(ans, 'Cuatrocientos'); + when dig3=5 then set ans=concat(ans, 'Quinientos'); + when dig3=6 then set ans=concat(ans, 'Seiscientos'); + when dig3=7 then set ans=concat(ans, 'Setecientos'); + when dig3=8 then set ans=concat(ans, 'Ochocientos'); + when dig3=9 then set ans=concat(ans, 'Novecientos'); + else set ans = ans; + end case; + end if; + if ans <> '' and dig2 > 0 then + set ans=concat(ans, ' Y '); + end if; + if dig2 = 1 then + case + when (dig2*10 + dig1) = 10 then set ans=concat(ans,'Diez'); + when (dig2*10 + dig1) = 11 then set ans=concat(ans,'Once'); + when (dig2*10 + dig1) = 12 then set ans=concat(ans,'Doce'); + when (dig2*10 + dig1) = 13 then set ans=concat(ans,'Trece'); + when (dig2*10 + dig1) = 14 then set ans=concat(ans,'Catorce'); + when (dig2*10 + dig1) = 15 then set ans=concat(ans,'Quince'); + when (dig2*10 + dig1) = 16 then set ans=concat(ans,'Dieciséis'); + when (dig2*10 + dig1) = 17 then set ans=concat(ans,'Diecisiete'); + when (dig2*10 + dig1) = 18 then set ans=concat(ans,'Dieciocho'); + when (dig2*10 + dig1) = 19 then set ans=concat(ans,'Diecinueve'); + else set ans=ans; + end case; + else + if dig2 > 0 then + case + when dig2=2 then set ans=concat(ans, ' Veinte'); + when dig2=3 then set ans=concat(ans, ' Treinta'); + when dig2=4 then set ans=concat(ans, ' Cuarenta'); + when dig2=5 then set ans=concat(ans, ' Cincuenta'); + when dig2=6 then set ans=concat(ans, ' Sesenta'); + when dig2=7 then set ans=concat(ans, ' Setenta'); + when dig2=8 then set ans=concat(ans, ' Ochenta'); + when dig2=9 then set ans=concat(ans, ' Noventa'); + else set ans=ans; + end case; + end if; + if ans <> '' and dig1 > 0 and dig2 =0 then + set ans=concat(ans, ' Y '); + end if; + if dig1 > 0 then + case + when dig1=1 then set ans=concat(ans, ' Uno'); + when dig1=2 then set ans=concat(ans, ' Dos'); + when dig1=3 then set ans=concat(ans, ' Tres'); + when dig1=4 then set ans=concat(ans, ' Cuatro'); + when dig1=5 then set ans=concat(ans, ' Cinco'); + when dig1=6 then set ans=concat(ans, ' Seis'); + when dig1=7 then set ans=concat(ans, ' Siete'); + when dig1=8 then set ans=concat(ans, ' Ocho'); + when dig1=9 then set ans=concat(ans, ' Nueve'); + else set ans=ans; + end case; + end if; + end if; + + return trim(ans); + END // + ]]> + + + + + + + + + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0118_FBR_518_update_client_loan_cycle.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0118_FBR_518_update_client_loan_cycle.xml new file mode 100644 index 00000000000..21ff8e7b6f4 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0118_FBR_518_update_client_loan_cycle.xml @@ -0,0 +1,41 @@ + + + + + + + =300 and ml.loan_status_id not in (400, 500, 601, 602) + group by mc.id + ) + update m_client mc + join cte on cte.id = mc.id + set mc.loan_cycle = cte.client_cycle; + ]]> + + +