From 4b110cfe4b916a25a192e3efbeeb96f255a5e61c Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Tue, 7 Apr 2015 16:06:31 -0700 Subject: [PATCH] MIFOSX-1948 --- .../integrationtests/ClientLoanIntegrationTest.java | 9 +++++---- .../serialization/AccrualAccountingDataValidator.java | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java index 0917bf44f..a610d27bb 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java @@ -3882,6 +3882,7 @@ public class ClientLoanIntegrationTest { this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); + dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); final Account assetAccount = this.accountHelper.createAssetAccount(); final Account incomeAccount = this.accountHelper.createIncomeAccount(); @@ -3983,6 +3984,7 @@ public class ClientLoanIntegrationTest { this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); + dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); todaysDate.add(Calendar.DAY_OF_MONTH, -14); @@ -4060,6 +4062,7 @@ public class ClientLoanIntegrationTest { this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); + dateFormat.setTimeZone(Utils.getTimeZoneOfTenant()); Calendar todaysDate = Calendar.getInstance(Utils.getTimeZoneOfTenant()); System.out.println("----timeeeeeeeeeeeeee------>" + dateFormat.format(todaysDate.getTime())); @@ -4139,7 +4142,7 @@ public class ClientLoanIntegrationTest { } else { values.put("dueDate", getDateAsArray(todaysDate, addPeriod * 7)); } - System.out.println("Updated date " + ((Calendar) values.get("dueDate")).getTime()); + System.out.println("Updated date " + values.get("dueDate")); values.put("principalDue", principalDue); values.put("interestDue", interestDue); values.put("feeChargesDue", feeChargesDue); @@ -4148,9 +4151,7 @@ public class ClientLoanIntegrationTest { } private List getDateAsArray(Calendar todaysDate, int addPeriod) { - getDateAsArray(todaysDate, addPeriod, Calendar.DAY_OF_MONTH); - return new ArrayList<>(Arrays.asList(todaysDate.get(Calendar.YEAR), todaysDate.get(Calendar.MONTH) + 1, - todaysDate.get(Calendar.DAY_OF_MONTH))); + return getDateAsArray(todaysDate, addPeriod, Calendar.DAY_OF_MONTH); } private List getDateAsArray(Calendar todaysDate, int addvalue, int type) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accrual/serialization/AccrualAccountingDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accrual/serialization/AccrualAccountingDataValidator.java index 70429540c..b7238f812 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/accrual/serialization/AccrualAccountingDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/accrual/serialization/AccrualAccountingDataValidator.java @@ -22,6 +22,7 @@ import org.mifosplatform.infrastructure.core.exception.InvalidJsonException; import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException; import org.mifosplatform.infrastructure.core.serialization.FromApiJsonDeserializer; import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper; +import org.mifosplatform.infrastructure.core.service.DateUtils; import org.mifosplatform.portfolio.loanaccount.guarantor.command.GuarantorCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -54,7 +55,7 @@ public final class AccrualAccountingDataValidator { .resource(PERIODIC_ACCRUAL_ACCOUNTING_RESOURCE_NAME); final LocalDate date = this.fromApiJsonHelper.extractLocalDateNamed(accrueTillParamName, element); - baseDataValidator.reset().parameter(accrueTillParamName).value(date).notNull().validateDateBefore(LocalDate.now()); + baseDataValidator.reset().parameter(accrueTillParamName).value(date).notNull().validateDateBefore(DateUtils.getLocalDateOfTenant()); throwExceptionIfValidationWarningsExist(dataValidationErrors);