Merge branch 'develop' of github.com:openMF/mifosx into develop
This commit is contained in:
+2
-2
@@ -222,8 +222,8 @@ public class AccountingConstants {
|
|||||||
|
|
||||||
public static enum FINANCIAL_ACTIVITY {
|
public static enum FINANCIAL_ACTIVITY {
|
||||||
ASSET_TRANSFER(100, "assetTransfer", GLAccountType.ASSET), LIABILITY_TRANSFER(200, "liabilityTransfer", GLAccountType.LIABILITY),
|
ASSET_TRANSFER(100, "assetTransfer", GLAccountType.ASSET), LIABILITY_TRANSFER(200, "liabilityTransfer", GLAccountType.LIABILITY),
|
||||||
CASH_AT_MAINVAULT (300, "cashAtMainVault", GLAccountType.ASSET),
|
CASH_AT_MAINVAULT (101, "cashAtMainVault", GLAccountType.ASSET),
|
||||||
CASH_AT_TELLER (400, "cashAtTeller", GLAccountType.ASSET);
|
CASH_AT_TELLER (102, "cashAtTeller", GLAccountType.ASSET),OPENING_BALANCES_TRANSFER_CONTRA (300,"openingBalancesTransferContra",GLAccountType.EQUITY);;
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
+8
@@ -86,6 +86,14 @@ public class AccountingDropdownReadPlatformServiceImpl implements AccountingDrop
|
|||||||
liabilityAccountOptions = null;
|
liabilityAccountOptions = null;
|
||||||
}
|
}
|
||||||
accountOptions.put("liabilityAccountOptions", liabilityAccountOptions);
|
accountOptions.put("liabilityAccountOptions", liabilityAccountOptions);
|
||||||
|
|
||||||
|
List<GLAccountData> equityAccountOptions = this.accountReadPlatformService
|
||||||
|
.retrieveAllEnabledDetailGLAccounts(GLAccountType.EQUITY);
|
||||||
|
if (equityAccountOptions.isEmpty()) {
|
||||||
|
equityAccountOptions = null;
|
||||||
|
}
|
||||||
|
accountOptions.put("equityAccountOptions",equityAccountOptions);
|
||||||
|
|
||||||
return accountOptions;
|
return accountOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
|||||||
@Table(name = "acc_gl_financial_activity_account")
|
@Table(name = "acc_gl_financial_activity_account")
|
||||||
public class FinancialActivityAccount extends AbstractPersistable<Long> {
|
public class FinancialActivityAccount extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
@JoinColumn(name = "gl_account_id")
|
@JoinColumn(name = "gl_account_id")
|
||||||
private GLAccount glAccount;
|
private GLAccount glAccount;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -54,7 +54,7 @@ public final class FinancialActivityAccountDataValidator {
|
|||||||
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
||||||
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).notNull()
|
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).notNull()
|
||||||
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),
|
||||||
FINANCIAL_ACTIVITY.CASH_AT_MAINVAULT.getValue(), FINANCIAL_ACTIVITY.CASH_AT_TELLER.getValue());
|
FINANCIAL_ACTIVITY.CASH_AT_MAINVAULT.getValue(), FINANCIAL_ACTIVITY.CASH_AT_TELLER.getValue(),FINANCIAL_ACTIVITY.OPENING_BALANCES_TRANSFER_CONTRA.getValue());
|
||||||
|
|
||||||
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed(paramNameForGLAccount, element);
|
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed(paramNameForGLAccount, element);
|
||||||
baseDataValidator.reset().parameter(paramNameForGLAccount).value(glAccountId).notNull().integerGreaterThanZero();
|
baseDataValidator.reset().parameter(paramNameForGLAccount).value(glAccountId).notNull().integerGreaterThanZero();
|
||||||
@@ -79,7 +79,7 @@ public final class FinancialActivityAccountDataValidator {
|
|||||||
final Integer financialActivityId = this.fromApiJsonHelper
|
final Integer financialActivityId = this.fromApiJsonHelper
|
||||||
.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
||||||
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).ignoreIfNull()
|
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).ignoreIfNull()
|
||||||
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue());
|
.isOneOfTheseValues(FINANCIAL_ACTIVITY.ASSET_TRANSFER.getValue(), FINANCIAL_ACTIVITY.LIABILITY_TRANSFER.getValue(),FINANCIAL_ACTIVITY.OPENING_BALANCES_TRANSFER_CONTRA.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(paramNameForGLAccount, element)) {
|
if (this.fromApiJsonHelper.parameterExists(paramNameForGLAccount, element)) {
|
||||||
|
|||||||
+12
-15
@@ -18,6 +18,8 @@ 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;
|
||||||
|
import org.mifosplatform.accounting.financialactivityaccount.domain.FinancialActivityAccount;
|
||||||
|
import org.mifosplatform.accounting.financialactivityaccount.domain.FinancialActivityAccountRepositoryWrapper;
|
||||||
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;
|
||||||
@@ -28,7 +30,6 @@ import org.mifosplatform.accounting.journalentry.data.TransactionDetailData;
|
|||||||
import org.mifosplatform.accounting.journalentry.data.TransactionTypeEnumData;
|
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.configuration.domain.ConfigurationDomainService;
|
|
||||||
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;
|
||||||
@@ -58,20 +59,19 @@ import org.springframework.util.CollectionUtils;
|
|||||||
public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlatformService {
|
public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlatformService {
|
||||||
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
private final JdbcTemplate jdbcTemplate;
|
||||||
private final ConfigurationDomainService configurationDomainService;
|
|
||||||
private final GLAccountReadPlatformService glAccountReadPlatformService;
|
private final GLAccountReadPlatformService glAccountReadPlatformService;
|
||||||
private final OfficeReadPlatformService officeReadPlatformService;
|
private final OfficeReadPlatformService officeReadPlatformService;
|
||||||
|
private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper;
|
||||||
|
|
||||||
private final PaginationHelper<JournalEntryData> paginationHelper = new PaginationHelper<>();
|
private final PaginationHelper<JournalEntryData> paginationHelper = new PaginationHelper<>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource,
|
public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource, final GLAccountReadPlatformService glAccountReadPlatformService,
|
||||||
final ConfigurationDomainService configurationDomainService, final GLAccountReadPlatformService glAccountReadPlatformService,
|
final OfficeReadPlatformService officeReadPlatformService, final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper) {
|
||||||
final OfficeReadPlatformService officeReadPlatformService) {
|
|
||||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
this.configurationDomainService = configurationDomainService;
|
|
||||||
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
||||||
this.officeReadPlatformService = officeReadPlatformService;
|
this.officeReadPlatformService = officeReadPlatformService;
|
||||||
|
this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class GLJournalEntryMapper implements RowMapper<JournalEntryData> {
|
private static final class GLJournalEntryMapper implements RowMapper<JournalEntryData> {
|
||||||
@@ -356,15 +356,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);
|
||||||
* Global configuration 'office-opening-balances-contra-account'
|
final Long contraId = financialActivityAccountId.getGlAccount().getId();
|
||||||
* property value must not be null and it should be a equity account.
|
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
||||||
*/
|
"error.msg.financial.activity.mapping.opening.balance.contra.account.cannot.be.null",
|
||||||
final Long contraId = this.configurationDomainService.retrieveOpeningBalancesContraAccount();
|
"office-opening-balances-contra-account value can not be null",
|
||||||
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
"office-opening-balances-contra-account");}
|
||||||
"error.msg.configuration.opening.balance.contra.account.cannot.be.null",
|
|
||||||
"Configuration property 'office-opening-balances-contra-account' value can not be null",
|
|
||||||
"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);
|
||||||
|
|||||||
+11
-14
@@ -16,6 +16,8 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosplatform.accounting.closure.domain.GLClosure;
|
import org.mifosplatform.accounting.closure.domain.GLClosure;
|
||||||
import org.mifosplatform.accounting.closure.domain.GLClosureRepository;
|
import org.mifosplatform.accounting.closure.domain.GLClosureRepository;
|
||||||
|
import org.mifosplatform.accounting.financialactivityaccount.domain.FinancialActivityAccount;
|
||||||
|
import org.mifosplatform.accounting.financialactivityaccount.domain.FinancialActivityAccountRepositoryWrapper;
|
||||||
import org.mifosplatform.accounting.glaccount.data.GLAccountDataForLookup;
|
import org.mifosplatform.accounting.glaccount.data.GLAccountDataForLookup;
|
||||||
import org.mifosplatform.accounting.glaccount.domain.GLAccount;
|
import org.mifosplatform.accounting.glaccount.domain.GLAccount;
|
||||||
import org.mifosplatform.accounting.glaccount.domain.GLAccountRepository;
|
import org.mifosplatform.accounting.glaccount.domain.GLAccountRepository;
|
||||||
@@ -80,7 +82,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
private final OrganisationCurrencyRepositoryWrapper organisationCurrencyRepository;
|
private final OrganisationCurrencyRepositoryWrapper organisationCurrencyRepository;
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
private final PaymentDetailWritePlatformService paymentDetailWritePlatformService;
|
private final PaymentDetailWritePlatformService paymentDetailWritePlatformService;
|
||||||
private final ConfigurationDomainService configurationDomainService;
|
private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public JournalEntryWritePlatformServiceJpaRepositoryImpl(final GLClosureRepository glClosureRepository,
|
public JournalEntryWritePlatformServiceJpaRepositoryImpl(final GLClosureRepository glClosureRepository,
|
||||||
@@ -91,8 +93,7 @@ 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 PaymentDetailWritePlatformService paymentDetailWritePlatformService,final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper) {
|
||||||
final ConfigurationDomainService configurationDomainService) {
|
|
||||||
this.glClosureRepository = glClosureRepository;
|
this.glClosureRepository = glClosureRepository;
|
||||||
this.officeRepository = officeRepository;
|
this.officeRepository = officeRepository;
|
||||||
this.glJournalEntryRepository = glJournalEntryRepository;
|
this.glJournalEntryRepository = glJournalEntryRepository;
|
||||||
@@ -106,7 +107,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
this.organisationCurrencyRepository = organisationCurrencyRepository;
|
this.organisationCurrencyRepository = organisationCurrencyRepository;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.paymentDetailWritePlatformService = paymentDetailWritePlatformService;
|
this.paymentDetailWritePlatformService = paymentDetailWritePlatformService;
|
||||||
this.configurationDomainService = configurationDomainService;
|
this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -450,16 +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);
|
||||||
* Global configuration 'office-opening-balances-contra-account'
|
final Long contraId = financialActivityAccountId.getGlAccount().getId();
|
||||||
* property value must not be null and it should be a equity
|
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
||||||
* account.
|
"error.msg.financial.activity.mapping.opening.balance.contra.account.cannot.be.null",
|
||||||
*/
|
"office-opening-balances-contra-account value can not be null",
|
||||||
final Long contraId = this.configurationDomainService.retrieveOpeningBalancesContraAccount();
|
"office-opening-balances-contra-account");}
|
||||||
if (contraId == null) { throw new GeneralPlatformDomainRuleException(
|
|
||||||
"error.msg.configuration.opening.balance.contra.account.cannot.be.null",
|
|
||||||
"Configuration property 'office-opening-balances-contra-account' value can not be null",
|
|
||||||
"office-opening-balances-contra-account"); }
|
|
||||||
|
|
||||||
validateJournalEntriesArePostedBefore(contraId);
|
validateJournalEntriesArePostedBefore(contraId);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user