diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/SavingsTransactionDTO.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/SavingsTransactionDTO.java index b6fbf420c..00a4de949 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/SavingsTransactionDTO.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/SavingsTransactionDTO.java @@ -12,6 +12,7 @@ import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionEnumDat public class SavingsTransactionDTO { + private final Long officeId; private final String transactionId; private final Date transactionDate; private final Long paymentTypeId; @@ -22,7 +23,7 @@ public class SavingsTransactionDTO { /*** Boolean values determines if the transaction is reversed ***/ private final boolean reversed; - public SavingsTransactionDTO(final Long paymentTypeId, final String transactionId, final Date transactionDate, + public SavingsTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate, final SavingsAccountTransactionEnumData transactionType, final BigDecimal amount, final boolean reversed) { this.paymentTypeId = paymentTypeId; this.transactionId = transactionId; @@ -30,6 +31,11 @@ public class SavingsTransactionDTO { this.amount = amount; this.reversed = reversed; this.transactionType = transactionType; + this.officeId = officeId; + } + + public Long getOfficeId() { + return this.officeId; } public String getTransactionId() { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java index a96118bb9..aa757e8d8 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java @@ -122,6 +122,7 @@ public class AccountingProcessorHelper { final List> newTransactionsMap = (List>) accountingBridgeData.get("newSavingsTransactions"); for (final Map map : newTransactionsMap) { + final Long transactionOfficeId = (Long) map.get("officeId"); final String transactionId = ((Long) map.get("id")).toString(); final Date transactionDate = ((LocalDate) map.get("date")).toDate(); final SavingsAccountTransactionEnumData transactionType = (SavingsAccountTransactionEnumData) map.get("type"); @@ -129,8 +130,8 @@ public class AccountingProcessorHelper { final boolean reversed = (Boolean) map.get("reversed"); final Long paymentTypeId = (Long) map.get("paymentTypeId"); - final SavingsTransactionDTO transaction = new SavingsTransactionDTO(paymentTypeId, transactionId, transactionDate, - transactionType, amount, reversed); + final SavingsTransactionDTO transaction = new SavingsTransactionDTO(transactionOfficeId, paymentTypeId, transactionId, + transactionDate, transactionType, amount, reversed); newSavingsTransactions.add(transaction); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java index 676a7035e..7a57c9751 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java @@ -29,12 +29,12 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess @Override public void createJournalEntriesForSavings(SavingsDTO savingsDTO) { final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(savingsDTO.getOfficeId()); - final Office office = this.helper.getOfficeById(savingsDTO.getOfficeId()); final Long savingsProductId = savingsDTO.getSavingsProductId(); final Long savingsId = savingsDTO.getSavingsId(); for (final SavingsTransactionDTO savingsTransactionDTO : savingsDTO.getNewSavingsTransactions()) { final Date transactionDate = savingsTransactionDTO.getTransactionDate(); final String transactionId = savingsTransactionDTO.getTransactionId(); + final Office office = this.helper.getOfficeById(savingsTransactionDTO.getOfficeId()); final Long paymentTypeId = savingsTransactionDTO.getPaymentTypeId(); final boolean isReversal = savingsTransactionDTO.isReversed(); final BigDecimal amount = savingsTransactionDTO.getAmount(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java index 54bc36800..498325be9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java @@ -230,6 +230,7 @@ public final class SavingsAccountTransaction extends AbstractPersistable { final SavingsAccountTransactionEnumData transactionType = SavingsEnumerations.transactionType(this.typeOf); thisTransactionData.put("id", getId()); + thisTransactionData.put("officeId", this.office.getId()); thisTransactionData.put("type", transactionType); thisTransactionData.put("reversed", Boolean.valueOf(isReversed())); thisTransactionData.put("date", getTransactionLocalDate());