cleaning up MIFOSX-1897
This commit is contained in:
@@ -31824,6 +31824,18 @@ No Request Body:
|
|||||||
</dd>
|
</dd>
|
||||||
<dd>Flag determines whether running balances
|
<dd>Flag determines whether running balances
|
||||||
to be returned
|
to be returned
|
||||||
|
</dd>
|
||||||
|
<dt>loanId</dt>
|
||||||
|
<dd>
|
||||||
|
Integer <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Provides ability to restrict journal entries based on the loan they are associated with
|
||||||
|
</dd>
|
||||||
|
<dt>savingsId</dt>
|
||||||
|
<dd>
|
||||||
|
Integer <span>optional</span>
|
||||||
|
</dd>
|
||||||
|
<dd>Provides ability to restrict journal entries based on the savings account they are associated with
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<p>Example Requests:</p>
|
<p>Example Requests:</p>
|
||||||
@@ -31842,6 +31854,10 @@ No Request Body:
|
|||||||
<div class=apiClick>journalentries?runningBalance=true</div>
|
<div class=apiClick>journalentries?runningBalance=true</div>
|
||||||
<br>
|
<br>
|
||||||
<div class=apiClick>journalentries?transactionDetails=true</div>
|
<div class=apiClick>journalentries?transactionDetails=true</div>
|
||||||
|
<br>
|
||||||
|
<div class=apiClick>journalentries?loanId=12</div>
|
||||||
|
<br>
|
||||||
|
<div class=apiClick>journalentries?savingsId=24</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
<code class="method-declaration">
|
<code class="method-declaration">
|
||||||
|
|||||||
+15
-16
@@ -35,8 +35,8 @@ import org.mifosplatform.infrastructure.core.exception.UnrecognizedQueryParamExc
|
|||||||
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||||
import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||||
import org.mifosplatform.infrastructure.core.service.Page;
|
import org.mifosplatform.infrastructure.core.service.Page;
|
||||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
|
||||||
import org.mifosplatform.infrastructure.core.service.SearchParameters;
|
import org.mifosplatform.infrastructure.core.service.SearchParameters;
|
||||||
|
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -62,8 +62,7 @@ public class JournalEntriesApiResource {
|
|||||||
@Autowired
|
@Autowired
|
||||||
public JournalEntriesApiResource(final PlatformSecurityContext context,
|
public JournalEntriesApiResource(final PlatformSecurityContext context,
|
||||||
final JournalEntryReadPlatformService journalEntryReadPlatformService,
|
final JournalEntryReadPlatformService journalEntryReadPlatformService,
|
||||||
final DefaultToApiJsonSerializer<Object> toApiJsonSerializer,
|
final DefaultToApiJsonSerializer<Object> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||||
@@ -82,7 +81,7 @@ public class JournalEntriesApiResource {
|
|||||||
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
@QueryParam("offset") final Integer offset, @QueryParam("limit") final Integer limit,
|
||||||
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder,
|
@QueryParam("orderBy") final String orderBy, @QueryParam("sortOrder") final String sortOrder,
|
||||||
@QueryParam("locale") final String locale, @QueryParam("dateFormat") final String dateFormat,
|
@QueryParam("locale") final String locale, @QueryParam("dateFormat") final String dateFormat,
|
||||||
@QueryParam("loanId") final Long loanId,@QueryParam("savingsId") final Long savingsId,
|
@QueryParam("loanId") final Long loanId, @QueryParam("savingsId") final Long savingsId,
|
||||||
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||||
@@ -96,7 +95,8 @@ public class JournalEntriesApiResource {
|
|||||||
toDate = toDateParam.getDate("toDate", dateFormat, locale);
|
toDate = toDateParam.getDate("toDate", dateFormat, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forJournalEntries(officeId, offset, limit, orderBy, sortOrder,loanId,savingsId);
|
final SearchParameters searchParameters = SearchParameters.forJournalEntries(officeId, offset, limit, orderBy, sortOrder, loanId,
|
||||||
|
savingsId);
|
||||||
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
||||||
runningBalance);
|
runningBalance);
|
||||||
|
|
||||||
@@ -107,11 +107,11 @@ public class JournalEntriesApiResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{journalEntryId}")
|
@Path("{journalEntryId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retreiveJournalEntryById(@PathParam("journalEntryId") final Long journalEntryId, @Context final UriInfo uriInfo,
|
public String retreiveJournalEntryById(@PathParam("journalEntryId") final Long journalEntryId, @Context final UriInfo uriInfo,
|
||||||
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
@QueryParam("runningBalance") final boolean runningBalance, @QueryParam("transactionDetails") final boolean transactionDetails) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||||
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData(transactionDetails,
|
||||||
@@ -123,8 +123,6 @@ public class JournalEntriesApiResource {
|
|||||||
return this.apiJsonSerializerService.serialize(settings, glJournalEntryData, RESPONSE_DATA_PARAMETERS);
|
return this.apiJsonSerializerService.serialize(settings, glJournalEntryData, RESPONSE_DATA_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@@ -150,12 +148,12 @@ public class JournalEntriesApiResource {
|
|||||||
@Path("{transactionId}")
|
@Path("{transactionId}")
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String createReversalJournalEntry(final String jsonRequestBody,
|
public String createReversalJournalEntry(final String jsonRequestBody, @PathParam("transactionId") final String transactionId,
|
||||||
@PathParam("transactionId") final String transactionId,
|
|
||||||
@QueryParam("command") final String commandParam) {
|
@QueryParam("command") final String commandParam) {
|
||||||
CommandProcessingResult result = null;
|
CommandProcessingResult result = null;
|
||||||
if (is(commandParam, "reverse")) {
|
if (is(commandParam, "reverse")) {
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().reverseJournalEntry(transactionId).withJson(jsonRequestBody).build();
|
final CommandWrapper commandRequest = new CommandWrapperBuilder().reverseJournalEntry(transactionId).withJson(jsonRequestBody)
|
||||||
|
.build();
|
||||||
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||||
} else {
|
} else {
|
||||||
throw new UnrecognizedQueryParamException("command", commandParam);
|
throw new UnrecognizedQueryParamException("command", commandParam);
|
||||||
@@ -171,7 +169,8 @@ public class JournalEntriesApiResource {
|
|||||||
public String retrieveOpeningBalance(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId) {
|
public String retrieveOpeningBalance(@Context final UriInfo uriInfo, @QueryParam("officeId") final Long officeId) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||||
final OfficeOpeningBalancesData officeOpeningBalancesData = this.journalEntryReadPlatformService.retrieveOfficeOpeningBalances(officeId);
|
final OfficeOpeningBalancesData officeOpeningBalancesData = this.journalEntryReadPlatformService
|
||||||
|
.retrieveOfficeOpeningBalances(officeId);
|
||||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
return this.apiJsonSerializerService.serialize(settings, officeOpeningBalancesData);
|
return this.apiJsonSerializerService.serialize(settings, officeOpeningBalancesData);
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-24
@@ -5,6 +5,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.accounting.journalentry.service;
|
package org.mifosplatform.accounting.journalentry.service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosplatform.accounting.common.AccountingEnumerations;
|
import org.mifosplatform.accounting.common.AccountingEnumerations;
|
||||||
@@ -13,13 +23,21 @@ import org.mifosplatform.accounting.financialactivityaccount.domain.FinancialAct
|
|||||||
import org.mifosplatform.accounting.glaccount.data.GLAccountData;
|
import org.mifosplatform.accounting.glaccount.data.GLAccountData;
|
||||||
import org.mifosplatform.accounting.glaccount.domain.GLAccountType;
|
import org.mifosplatform.accounting.glaccount.domain.GLAccountType;
|
||||||
import org.mifosplatform.accounting.glaccount.service.GLAccountReadPlatformService;
|
import org.mifosplatform.accounting.glaccount.service.GLAccountReadPlatformService;
|
||||||
import org.mifosplatform.accounting.journalentry.data.*;
|
import org.mifosplatform.accounting.journalentry.data.JournalEntryAssociationParametersData;
|
||||||
|
import org.mifosplatform.accounting.journalentry.data.JournalEntryData;
|
||||||
|
import org.mifosplatform.accounting.journalentry.data.OfficeOpeningBalancesData;
|
||||||
|
import org.mifosplatform.accounting.journalentry.data.TransactionDetailData;
|
||||||
|
import org.mifosplatform.accounting.journalentry.data.TransactionTypeEnumData;
|
||||||
import org.mifosplatform.accounting.journalentry.exception.JournalEntriesNotFoundException;
|
import org.mifosplatform.accounting.journalentry.exception.JournalEntriesNotFoundException;
|
||||||
import org.mifosplatform.infrastructure.codes.data.CodeValueData;
|
import org.mifosplatform.infrastructure.codes.data.CodeValueData;
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||||
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||||
import org.mifosplatform.infrastructure.core.service.*;
|
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
||||||
|
import org.mifosplatform.infrastructure.core.service.Page;
|
||||||
|
import org.mifosplatform.infrastructure.core.service.PaginationHelper;
|
||||||
|
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||||
|
import org.mifosplatform.infrastructure.core.service.SearchParameters;
|
||||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||||
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
|
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
|
||||||
@@ -37,16 +55,6 @@ import org.springframework.jdbc.core.RowMapper;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlatformService {
|
public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlatformService {
|
||||||
|
|
||||||
@@ -58,8 +66,9 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
private final PaginationHelper<JournalEntryData> paginationHelper = new PaginationHelper<>();
|
private final PaginationHelper<JournalEntryData> paginationHelper = new PaginationHelper<>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource, final GLAccountReadPlatformService glAccountReadPlatformService,
|
public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource,
|
||||||
final OfficeReadPlatformService officeReadPlatformService, final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper) {
|
final GLAccountReadPlatformService glAccountReadPlatformService, final OfficeReadPlatformService officeReadPlatformService,
|
||||||
|
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper) {
|
||||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
||||||
this.officeReadPlatformService = officeReadPlatformService;
|
this.officeReadPlatformService = officeReadPlatformService;
|
||||||
@@ -229,7 +238,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
sqlBuilder.append("select SQL_CALC_FOUND_ROWS ");
|
sqlBuilder.append("select SQL_CALC_FOUND_ROWS ");
|
||||||
sqlBuilder.append(rm.schema());
|
sqlBuilder.append(rm.schema());
|
||||||
|
|
||||||
final Object[] objectArray = new Object[5];
|
final Object[] objectArray = new Object[15];
|
||||||
int arrayPos = 0;
|
int arrayPos = 0;
|
||||||
String whereClose = " where ";
|
String whereClose = " where ";
|
||||||
|
|
||||||
@@ -315,14 +324,15 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
whereClose = " and ";
|
whereClose = " and ";
|
||||||
}
|
}
|
||||||
if (searchParameters.isSavingsIdPassed()) {
|
if (searchParameters.isSavingsIdPassed()) {
|
||||||
sqlBuilder.append(whereClose + " journalEntry.savings_transaction_id in (select id from m_savings_account_transaction where savings_account_id = ?)");
|
sqlBuilder
|
||||||
|
.append(whereClose
|
||||||
|
+ " journalEntry.savings_transaction_id in (select id from m_savings_account_transaction where savings_account_id = ?)");
|
||||||
objectArray[arrayPos] = searchParameters.getSavingsId();
|
objectArray[arrayPos] = searchParameters.getSavingsId();
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
|
||||||
whereClose = " and ";
|
whereClose = " and ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (searchParameters.isOrderByRequested()) {
|
if (searchParameters.isOrderByRequested()) {
|
||||||
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy());
|
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy());
|
||||||
|
|
||||||
@@ -364,12 +374,12 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
@Override
|
@Override
|
||||||
public OfficeOpeningBalancesData retrieveOfficeOpeningBalances(final Long officeId) {
|
public OfficeOpeningBalancesData retrieveOfficeOpeningBalances(final Long officeId) {
|
||||||
|
|
||||||
final FinancialActivityAccount financialActivityAccountId = this.financialActivityAccountRepositoryWrapper.findByFinancialActivityTypeWithNotFoundDetection(300);
|
final FinancialActivityAccount financialActivityAccountId = this.financialActivityAccountRepositoryWrapper
|
||||||
final Long contraId = financialActivityAccountId.getGlAccount().getId();
|
.findByFinancialActivityTypeWithNotFoundDetection(300);
|
||||||
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
final Long contraId = financialActivityAccountId.getGlAccount().getId();
|
||||||
|
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
||||||
"error.msg.financial.activity.mapping.opening.balance.contra.account.cannot.be.null",
|
"error.msg.financial.activity.mapping.opening.balance.contra.account.cannot.be.null",
|
||||||
"office-opening-balances-contra-account value can not be null",
|
"office-opening-balances-contra-account value can not be null", "office-opening-balances-contra-account"); }
|
||||||
"office-opening-balances-contra-account");}
|
|
||||||
|
|
||||||
final JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData();
|
final JournalEntryAssociationParametersData associationParametersData = new JournalEntryAssociationParametersData();
|
||||||
final GLAccountData contraAccount = this.glAccountReadPlatformService.retrieveGLAccountById(contraId, associationParametersData);
|
final GLAccountData contraAccount = this.glAccountReadPlatformService.retrieveGLAccountById(contraId, associationParametersData);
|
||||||
@@ -456,7 +466,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
final String transactionId = "";
|
final String transactionId = "";
|
||||||
final Page<JournalEntryData> contraJournalEntries = retrieveContraTransactions(officeId, contraId, transactionId);
|
final Page<JournalEntryData> contraJournalEntries = retrieveContraTransactions(officeId, contraId, transactionId);
|
||||||
if (!CollectionUtils.isEmpty(contraJournalEntries.getPageItems())) {
|
if (!CollectionUtils.isEmpty(contraJournalEntries.getPageItems())) {
|
||||||
final JournalEntryData contraTransaction = contraJournalEntries.getPageItems().get(contraJournalEntries.getPageItems().size()-1);
|
final JournalEntryData contraTransaction = contraJournalEntries.getPageItems().get(
|
||||||
|
contraJournalEntries.getPageItems().size() - 1);
|
||||||
return contraTransaction.getTransactionId();
|
return contraTransaction.getTransactionId();
|
||||||
}
|
}
|
||||||
return transactionId;
|
return transactionId;
|
||||||
@@ -472,8 +483,11 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
final Date fromDate = null;
|
final Date fromDate = null;
|
||||||
final Date toDate = null;
|
final Date toDate = null;
|
||||||
final JournalEntryAssociationParametersData associationParametersData = null;
|
final JournalEntryAssociationParametersData associationParametersData = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
final SearchParameters searchParameters = SearchParameters.forJournalEntries(officeId, offset, limit, orderBy, sortOrder,null,null);
|
final SearchParameters searchParameters = SearchParameters.forJournalEntries(officeId, offset, limit, orderBy, sortOrder, loanId,
|
||||||
|
savingsId);
|
||||||
return retrieveAll(searchParameters, contraId, onlyManualEntries, fromDate, toDate, transactionId, entityType,
|
return retrieveAll(searchParameters, contraId, onlyManualEntries, fromDate, toDate, transactionId, entityType,
|
||||||
associationParametersData);
|
associationParametersData);
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -39,7 +39,6 @@ import org.mifosplatform.accounting.journalentry.serialization.JournalEntryComma
|
|||||||
import org.mifosplatform.accounting.rule.domain.AccountingRule;
|
import org.mifosplatform.accounting.rule.domain.AccountingRule;
|
||||||
import org.mifosplatform.accounting.rule.domain.AccountingRuleRepository;
|
import org.mifosplatform.accounting.rule.domain.AccountingRuleRepository;
|
||||||
import org.mifosplatform.accounting.rule.exception.AccountingRuleNotFoundException;
|
import org.mifosplatform.accounting.rule.exception.AccountingRuleNotFoundException;
|
||||||
import org.mifosplatform.infrastructure.configuration.domain.ConfigurationDomainService;
|
|
||||||
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
||||||
import org.mifosplatform.infrastructure.core.data.ApiParameterError;
|
import org.mifosplatform.infrastructure.core.data.ApiParameterError;
|
||||||
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
|
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
|
||||||
@@ -93,7 +92,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
final AccountingProcessorForSavingsFactory accountingProcessorForSavingsFactory,
|
final AccountingProcessorForSavingsFactory accountingProcessorForSavingsFactory,
|
||||||
final GLAccountReadPlatformService glAccountReadPlatformService,
|
final GLAccountReadPlatformService glAccountReadPlatformService,
|
||||||
final OrganisationCurrencyRepositoryWrapper organisationCurrencyRepository, final PlatformSecurityContext context,
|
final OrganisationCurrencyRepositoryWrapper organisationCurrencyRepository, final PlatformSecurityContext context,
|
||||||
final PaymentDetailWritePlatformService paymentDetailWritePlatformService,final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper) {
|
final PaymentDetailWritePlatformService paymentDetailWritePlatformService,
|
||||||
|
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper) {
|
||||||
this.glClosureRepository = glClosureRepository;
|
this.glClosureRepository = glClosureRepository;
|
||||||
this.officeRepository = officeRepository;
|
this.officeRepository = officeRepository;
|
||||||
this.glJournalEntryRepository = glJournalEntryRepository;
|
this.glJournalEntryRepository = glJournalEntryRepository;
|
||||||
@@ -451,12 +451,12 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
final JournalEntryCommand journalEntryCommand = this.fromApiJsonDeserializer.commandFromApiJson(command.json());
|
final JournalEntryCommand journalEntryCommand = this.fromApiJsonDeserializer.commandFromApiJson(command.json());
|
||||||
journalEntryCommand.validateForCreate();
|
journalEntryCommand.validateForCreate();
|
||||||
|
|
||||||
final FinancialActivityAccount financialActivityAccountId = this.financialActivityAccountRepositoryWrapper.findByFinancialActivityTypeWithNotFoundDetection(300);
|
final FinancialActivityAccount financialActivityAccountId = this.financialActivityAccountRepositoryWrapper
|
||||||
final Long contraId = financialActivityAccountId.getGlAccount().getId();
|
.findByFinancialActivityTypeWithNotFoundDetection(300);
|
||||||
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
final Long contraId = financialActivityAccountId.getGlAccount().getId();
|
||||||
|
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
||||||
"error.msg.financial.activity.mapping.opening.balance.contra.account.cannot.be.null",
|
"error.msg.financial.activity.mapping.opening.balance.contra.account.cannot.be.null",
|
||||||
"office-opening-balances-contra-account value can not be null",
|
"office-opening-balances-contra-account value can not be null", "office-opening-balances-contra-account"); }
|
||||||
"office-opening-balances-contra-account");}
|
|
||||||
|
|
||||||
validateJournalEntriesArePostedBefore(contraId);
|
validateJournalEntriesArePostedBefore(contraId);
|
||||||
|
|
||||||
|
|||||||
+34
-14
@@ -32,8 +32,10 @@ public final class SearchParameters {
|
|||||||
final String hierarchy) {
|
final String hierarchy) {
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
return new SearchParameters(sqlSearch, officeId, externalId, name, hierarchy, null, null, null, null, null, null, staffId,
|
return new SearchParameters(sqlSearch, officeId, externalId, name, hierarchy, null, null, null, null, null, null, staffId,
|
||||||
accountNo,null,null);
|
accountNo, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forClients(final String sqlSearch, final Long officeId, final String externalId,
|
public static SearchParameters forClients(final String sqlSearch, final Long officeId, final String externalId,
|
||||||
@@ -43,9 +45,11 @@ public final class SearchParameters {
|
|||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, officeId, externalId, displayName, hierarchy, firstname, lastname, offset, maxLimitAllowed,
|
return new SearchParameters(sqlSearch, officeId, externalId, displayName, hierarchy, firstname, lastname, offset, maxLimitAllowed,
|
||||||
orderBy, sortOrder, staffId, accountNo,null,null);
|
orderBy, sortOrder, staffId, accountNo, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forGroups(final String sqlSearch, final Long officeId, final Long staffId, final String externalId,
|
public static SearchParameters forGroups(final String sqlSearch, final Long officeId, final Long staffId, final String externalId,
|
||||||
@@ -54,14 +58,15 @@ public final class SearchParameters {
|
|||||||
|
|
||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, officeId, externalId, name, hierarchy, null, null, offset, maxLimitAllowed, orderBy,
|
return new SearchParameters(sqlSearch, officeId, externalId, name, hierarchy, null, null, offset, maxLimitAllowed, orderBy,
|
||||||
sortOrder, staffId, accountNo,null,null);
|
sortOrder, staffId, accountNo, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forOffices(final String orderBy, final String sortOrder) {
|
public static SearchParameters forOffices(final String orderBy, final String sortOrder) {
|
||||||
return new SearchParameters(null, null, null, null, null, null, null, null, null, orderBy, sortOrder,
|
return new SearchParameters(null, null, null, null, null, null, null, null, null, orderBy, sortOrder, null, null, null, null);
|
||||||
null, null,null,null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forLoans(final String sqlSearch, final String externalId, final Integer offset, final Integer limit,
|
public static SearchParameters forLoans(final String sqlSearch, final String externalId, final Integer offset, final Integer limit,
|
||||||
@@ -69,27 +74,32 @@ public final class SearchParameters {
|
|||||||
|
|
||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||||
staffId, accountNo,null,null);
|
staffId, accountNo, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forJournalEntries(final Long officeId, final Integer offset, final Integer limit, final String orderBy,
|
public static SearchParameters forJournalEntries(final Long officeId, final Integer offset, final Integer limit, final String orderBy,
|
||||||
final String sortOrder,final Long loanId,final Long savingsId) {
|
final String sortOrder, final Long loanId, final Long savingsId) {
|
||||||
|
|
||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
|
|
||||||
return new SearchParameters(null, officeId, null, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId,
|
return new SearchParameters(null, officeId, null, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId,
|
||||||
null,loanId,savingsId);
|
null, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forPagination(final Integer offset, final Integer limit, final String orderBy, final String sortOrder) {
|
public static SearchParameters forPagination(final Integer offset, final Integer limit, final String orderBy, final String sortOrder) {
|
||||||
|
|
||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
return new SearchParameters(null, null, null, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId, null,null,null);
|
return new SearchParameters(null, null, null, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder, staffId, null,
|
||||||
|
loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forSavings(final String sqlSearch, final String externalId, final Integer offset, final Integer limit,
|
public static SearchParameters forSavings(final String sqlSearch, final String externalId, final Integer offset, final Integer limit,
|
||||||
@@ -98,9 +108,11 @@ public final class SearchParameters {
|
|||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||||
staffId, accountNo,null,null);
|
staffId, accountNo, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchParameters forAccountTransfer(final String sqlSearch, final String externalId, final Integer offset,
|
public static SearchParameters forAccountTransfer(final String sqlSearch, final String externalId, final Integer offset,
|
||||||
@@ -109,14 +121,17 @@ public final class SearchParameters {
|
|||||||
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
final Integer maxLimitAllowed = getCheckedLimit(limit);
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String accountNo = null;
|
final String accountNo = null;
|
||||||
|
final Long loanId = null;
|
||||||
|
final Long savingsId = null;
|
||||||
|
|
||||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||||
staffId, accountNo,null,null);
|
staffId, accountNo, loanId, savingsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchParameters(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
private SearchParameters(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
||||||
final String hierarchy, final String firstname, final String lastname, final Integer offset, final Integer limit,
|
final String hierarchy, final String firstname, final String lastname, 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 String orderBy, final String sortOrder, final Long staffId, final String accountNo, final Long loanId,
|
||||||
|
final Long savingsId) {
|
||||||
this.sqlSearch = sqlSearch;
|
this.sqlSearch = sqlSearch;
|
||||||
this.officeId = officeId;
|
this.officeId = officeId;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
@@ -233,11 +248,16 @@ public final class SearchParameters {
|
|||||||
public boolean isLoanIdPassed() {
|
public boolean isLoanIdPassed() {
|
||||||
return this.loanId != null && this.loanId != 0;
|
return this.loanId != null && this.loanId != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSavingsIdPassed() {
|
public boolean isSavingsIdPassed() {
|
||||||
return this.savingsId != null && this.savingsId != 0;
|
return this.savingsId != null && this.savingsId != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getLoanId() {return this.loanId;}
|
public Long getLoanId() {
|
||||||
|
return this.loanId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getSavingsId() {return this.savingsId;}
|
public Long getSavingsId() {
|
||||||
|
return this.savingsId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user