This is an automated email from the ASF dual-hosted git repository. Aman-Mittal pushed a commit to branch revert-6809-FINERACT-643 in repository https://gitbox.apache.org/repos/asf/fineract.git
commit 9a3dfafead15224d90fba3a1b4c19bac1072204a Author: Aman Mittal <[email protected]> AuthorDate: Wed Nov 25 11:21:50 2026 +0530 Revert "FINERACT-643: Add an entrySource filter to the journal entries list" --- .../journalentry/data/JournalEntrySource.java | 28 ------- .../service/JournalEntryReadPlatformService.java | 6 +- .../api/JournalEntriesApiResource.java | 16 +--- .../JournalEntryReadPlatformServiceImpl.java | 14 +--- .../main/resources/static/legacy-docs/apiLive.htm | 9 --- .../tests/FeignJournalEntrySourceFilterTest.java | 94 ---------------------- 6 files changed, 7 insertions(+), 160 deletions(-) diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntrySource.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntrySource.java deleted file mode 100644 index d5a9242adb..0000000000 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntrySource.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.accounting.journalentry.data; - -/** - * Who created a journal entry: a user (manual entries, their reversals and opening balances) or the system. - */ -public enum JournalEntrySource { - - MANUAL, // - SYSTEM; -} diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformService.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformService.java index 10ee4883e7..b3b76e80ce 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformService.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformService.java @@ -21,7 +21,6 @@ package org.apache.fineract.accounting.journalentry.service; import java.time.LocalDate; import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData; import org.apache.fineract.accounting.journalentry.data.JournalEntryData; -import org.apache.fineract.accounting.journalentry.data.JournalEntrySource; import org.apache.fineract.accounting.journalentry.data.OfficeOpeningBalancesData; import org.apache.fineract.infrastructure.core.service.Page; import org.apache.fineract.infrastructure.core.service.SearchParameters; @@ -31,9 +30,8 @@ public interface JournalEntryReadPlatformService { JournalEntryData retrieveGLJournalEntryById(long glJournalEntryId, JournalEntryAssociationParametersData associationParametersData, String officeHierarchy); - Page<JournalEntryData> retrieveAll(SearchParameters searchParameters, Long glAccountId, Boolean onlyManualEntries, - JournalEntrySource entrySource, LocalDate fromDate, LocalDate toDate, LocalDate submittedOnDateFrom, - LocalDate submittedOnDateTo, String transactionId, Integer entityType, + Page<JournalEntryData> retrieveAll(SearchParameters searchParameters, Long glAccountId, Boolean onlyManualEntries, LocalDate fromDate, + LocalDate toDate, LocalDate submittedOnDateFrom, LocalDate submittedOnDateTo, String transactionId, Integer entityType, JournalEntryAssociationParametersData associationParametersData); OfficeOpeningBalancesData retrieveOfficeOpeningBalances(Long officeId, String currencyCode); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java index 273f8b5e60..4fc5b9d43e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java @@ -46,7 +46,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.journalentry.command.JournalEntryCommand; import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData; import org.apache.fineract.accounting.journalentry.data.JournalEntryData; -import org.apache.fineract.accounting.journalentry.data.JournalEntrySource; import org.apache.fineract.accounting.journalentry.data.OfficeOpeningBalancesData; import org.apache.fineract.accounting.journalentry.service.JournalEntryReadPlatformService; import org.apache.fineract.commands.domain.CommandWrapper; @@ -115,8 +114,6 @@ public class JournalEntriesApiResource { @QueryParam("officeId") @Parameter(description = "officeId") final Long officeId, @QueryParam("glAccountId") @Parameter(description = "glAccountId") final Long glAccountId, @QueryParam("manualEntriesOnly") @Parameter(description = "manualEntriesOnly") final Boolean onlyManualEntries, - @QueryParam("entrySource") @Parameter(description = "MANUAL returns manual entries, their reversals and opening balances; SYSTEM returns the entries posted by the system. Any other value is rejected. Combined with manualEntriesOnly=true, SYSTEM returns no entries.", schema = @Schema(allowableValues = { - "MANUAL", "SYSTEM" })) final String entrySource, @QueryParam("fromDate") @Parameter(description = "fromDate") final DateParam fromDateParam, @QueryParam("toDate") @Parameter(description = "toDate") final DateParam toDateParam, @QueryParam("submittedOnDateFrom") @Parameter(description = "submittedOnDateFrom") final DateParam submittedOnDateFromParam, @@ -164,9 +161,8 @@ public class JournalEntriesApiResource { JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails, runningBalance); - final JournalEntrySource source = parseEntrySource(entrySource); final Page<JournalEntryData> glJournalEntries = this.journalEntryReadPlatformService.retrieveAll(searchParameters, glAccountId, - onlyManualEntries, source, fromDate, toDate, submittedOnDateFrom, submittedOnDateTo, transactionId, entityType, + onlyManualEntries, fromDate, toDate, submittedOnDateFrom, submittedOnDateTo, transactionId, entityType, associationParametersData); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.apiJsonSerializerService.serialize(settings, glJournalEntries, RESPONSE_DATA_PARAMETERS); @@ -262,7 +258,7 @@ public class JournalEntriesApiResource { this.context.authenticatedUser(); String transactionId = "P" + entryId; SearchParameters params = SearchParameters.builder().limit(limit).offset(offset).build(); - Page<JournalEntryData> entries = this.journalEntryReadPlatformService.retrieveAll(params, null, null, null, null, null, null, null, + Page<JournalEntryData> entries = this.journalEntryReadPlatformService.retrieveAll(params, null, null, null, null, null, null, transactionId, PortfolioProductType.PROVISIONING.getValue(), null); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.apiJsonSerializerService.serialize(settings, entries, RESPONSE_DATA_PARAMETERS); @@ -311,12 +307,4 @@ public class JournalEntriesApiResource { uploadedInputStream, fileDetail, locale, dateFormat); return this.apiJsonSerializerService.serialize(importDocumentId); } - - private static JournalEntrySource parseEntrySource(final String entrySource) { - if (StringUtils.isBlank(entrySource)) { - return null; - } - return Arrays.stream(JournalEntrySource.values()).filter(source -> source.name().equalsIgnoreCase(entrySource)).findFirst() - .orElseThrow(() -> new UnrecognizedQueryParamException("entrySource", entrySource, (Object[]) JournalEntrySource.values())); - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java index 099bb77bd3..e7e6d9102c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java @@ -38,7 +38,6 @@ import org.apache.fineract.accounting.glaccount.domain.GLAccountType; import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService; import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData; import org.apache.fineract.accounting.journalentry.data.JournalEntryData; -import org.apache.fineract.accounting.journalentry.data.JournalEntrySource; import org.apache.fineract.accounting.journalentry.data.OfficeOpeningBalancesData; import org.apache.fineract.accounting.journalentry.data.TransactionDetailData; import org.apache.fineract.accounting.journalentry.data.TransactionTypeEnumData; @@ -242,8 +241,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat @Override public Page<JournalEntryData> retrieveAll(final SearchParameters searchParameters, final Long glAccountId, - final Boolean onlyManualEntries, final JournalEntrySource entrySource, final LocalDate fromDate, final LocalDate toDate, - final LocalDate submittedOnDateFrom, final LocalDate submittedOnDateTo, final String transactionId, final Integer entityType, + final Boolean onlyManualEntries, final LocalDate fromDate, final LocalDate toDate, final LocalDate submittedOnDateFrom, + final LocalDate submittedOnDateTo, final String transactionId, final Integer entityType, final JournalEntryAssociationParametersData associationParametersData) { GLJournalEntryMapper rm = getGlJournalEntryMapper(associationParametersData); final StringBuilder sqlBuilder = new StringBuilder(200); @@ -355,13 +354,6 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat } } - if (entrySource != null) { - sqlBuilder.append(whereClose).append(" journalEntry.manual_entry = ?"); - whereClose = " and "; - objectArray[arrayPos] = entrySource == JournalEntrySource.MANUAL; - arrayPos = arrayPos + 1; - } - if (searchParameters.hasLoanId()) { sqlBuilder.append(whereClose) .append(" journalEntry.loan_transaction_id in (select id from m_loan_transaction where loan_id = ?)"); @@ -544,7 +536,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat final SearchParameters searchParameters = SearchParameters.builder().orphansOnly(false).officeId(officeId).offset(0) .orderBy("journalEntry.id").sortOrder("ASC").currencyCode(currencyCode).build(); - return retrieveAll(searchParameters, contraId, onlyManualEntries, null, fromDate, toDate, submittedOnDateFrom, submittedOnDateTo, + return retrieveAll(searchParameters, contraId, onlyManualEntries, fromDate, toDate, submittedOnDateFrom, submittedOnDateTo, transactionId, entityType, associationParametersData); } diff --git a/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm b/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm index 77be8ac78c..342e111369 100644 --- a/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm +++ b/fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm @@ -41068,15 +41068,6 @@ No Request Body: <br/> Set to "false" by default if not passed in explicity </dd> - <dt>entrySource</dt> - <dd> - String <span>optional</span> - </dd> - <dd>MANUAL returns manual entries, their reversals and opening - balances; SYSTEM returns the entries posted by the system. - Any other value is rejected. Combined with - manualEntriesOnly=true, SYSTEM returns no entries. - </dd> <dt>fromDate</dt> <dd> Date<span>optional</span> diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/tests/FeignJournalEntrySourceFilterTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/tests/FeignJournalEntrySourceFilterTest.java deleted file mode 100644 index b465afe1aa..0000000000 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/tests/FeignJournalEntrySourceFilterTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.integrationtests.client.feign.tests; - -import static org.apache.fineract.client.feign.util.FeignCalls.fail; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.math.BigDecimal; -import java.time.LocalDate; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.fineract.client.feign.util.CallFailedRuntimeException; -import org.apache.fineract.client.models.JournalEntryCommand; -import org.apache.fineract.client.models.JournalEntryTransactionItem; -import org.apache.fineract.client.models.SingleDebitOrCreditEntryCommand; -import org.apache.fineract.integrationtests.client.feign.FeignSavingsTestBase; -import org.apache.fineract.integrationtests.client.feign.modules.SavingsRequestBuilders; -import org.apache.fineract.integrationtests.common.accounting.Account; -import org.junit.jupiter.api.Test; - -public class FeignJournalEntrySourceFilterTest extends FeignSavingsTestBase { - - private static final String DATE = "01 January 2026"; - - @Test - public void testEntrySourceFiltersManualAndSystemEntries() { - final Account assetAccount = accountHelper.createAssetAccount(); - final Account liabilityAccount = accountHelper.createLiabilityAccount(); - final Account incomeAccount = accountHelper.createIncomeAccount(); - final Account expenseAccount = accountHelper.createExpenseAccount(); - - // System entries: a deposit credits the savings control (liability) account - final Long productId = createSavingsProduct(SavingsRequestBuilders.withCashBasedAccounting( - SavingsRequestBuilders.defaultSavingsProduct().nominalAnnualInterestRate(0.0), assetAccount, liabilityAccount, - incomeAccount, expenseAccount)).getResourceId(); - final Long savingsId = createApproveActivateSavings(createClient(DATE), productId, DATE); - deposit(savingsId, "100", DATE); - - // Manual entry on the same liability account - journalEntryHelper.createJournalEntry(new JournalEntryCommand().officeId(1L).currencyCode("USD").locale("en") - .dateFormat("uuuu-MM-dd").transactionDate(LocalDate.of(2026, 1, 1)) - .addDebitsItem( - new SingleDebitOrCreditEntryCommand().glAccountId(assetAccount.getAccountID().longValue()).amount(BigDecimal.TEN)) - .addCreditsItem(new SingleDebitOrCreditEntryCommand().glAccountId(liabilityAccount.getAccountID().longValue()) - .amount(BigDecimal.TEN))); - - final Long glAccountId = liabilityAccount.getAccountID().longValue(); - final List<Boolean> all = manualFlags(glAccountId, Map.of()); - assertEquals(2, all.size()); - assertTrue(all.contains(true) && all.contains(false), "Both a manual and a system entry are expected: " + all); - assertEquals(List.of(true), manualFlags(glAccountId, Map.of("entrySource", "MANUAL"))); - assertEquals(List.of(false), manualFlags(glAccountId, Map.of("entrySource", "SYSTEM"))); - assertEquals(List.of(false), manualFlags(glAccountId, Map.of("entrySource", "system"))); - - // Both filters apply when manualEntriesOnly is sent as well - assertEquals(List.of(true), manualFlags(glAccountId, Map.of("manualEntriesOnly", "true", "entrySource", "MANUAL"))); - assertEquals(List.of(), manualFlags(glAccountId, Map.of("manualEntriesOnly", "true", "entrySource", "SYSTEM"))); - assertEquals(List.of(false), manualFlags(glAccountId, Map.of("manualEntriesOnly", "false", "entrySource", "SYSTEM"))); - } - - @Test - public void testEntrySourceRejectsUnsupportedValue() { - final CallFailedRuntimeException exception = fail( - () -> fineractClient().journalEntries().retrieveAllJournalEntries(Map.of("entrySource", "AUTOMATIC"))); - - assertEquals(400, exception.getStatus()); - assertTrue(exception.getResponseBody().contains("error.msg.query.parameter.value.unsupported"), exception.getResponseBody()); - } - - private List<Boolean> manualFlags(final Long glAccountId, final Map<String, String> filter) { - final Map<String, Object> query = new HashMap<>(filter); - query.put("glAccountId", glAccountId); - return ok(() -> fineractClient().journalEntries().retrieveAllJournalEntries(query)).getPageItems().stream() - .map(JournalEntryTransactionItem::getManualEntry).toList(); - } -}
