FINERACT-1112 Replace ZoneId.systemDefault() with tenant's timezone
This commit is contained in:
committed by
Petri Tuomola
parent
7b34e83843
commit
814455769b
+2
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.accounting.closure.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
@@ -36,6 +35,7 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
import org.slf4j.Logger;
|
||||
@@ -151,7 +151,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
|
||||
if (realCause.getMessage().contains("office_id_closing_date")) {
|
||||
throw new GLClosureDuplicateException(command.longValueOfParameterNamed(GLClosureJsonInputParams.OFFICE_ID.getValue()),
|
||||
LocalDate.ofInstant(command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()).toInstant(),
|
||||
ZoneId.systemDefault()));
|
||||
DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
|
||||
+2
-2
@@ -19,11 +19,11 @@
|
||||
package org.apache.fineract.accounting.journalentry.api;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.JsonParserHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
/**
|
||||
* Class for parsing dates sent as query parameters
|
||||
@@ -41,6 +41,6 @@ public class DateParam {
|
||||
public Date getDate(final String parameterName, final String dateFormat, final String localeAsString) {
|
||||
final Locale locale = JsonParserHelper.localeFromString(localeAsString);
|
||||
final LocalDate localDate = JsonParserHelper.convertFrom(this.dateAsString, parameterName, dateFormat, locale);
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return Date.from(localDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -20,7 +20,6 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -59,6 +58,7 @@ import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGL
|
||||
import org.apache.fineract.accounting.producttoaccountmapping.exception.ProductToGLAccountMappingNotFoundException;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
@@ -132,7 +132,8 @@ public class AccountingProcessorHelper {
|
||||
for (final Map<String, Object> map : newTransactionsMap) {
|
||||
final Long transactionOfficeId = (Long) map.get("officeId");
|
||||
final String transactionId = ((Long) map.get("id")).toString();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final Date transactionDate = Date
|
||||
.from(((LocalDate) map.get("date")).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final LoanTransactionEnumData transactionType = (LoanTransactionEnumData) map.get("type");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
final BigDecimal principal = (BigDecimal) map.get("principalPortion");
|
||||
@@ -199,7 +200,8 @@ public class AccountingProcessorHelper {
|
||||
for (final Map<String, Object> map : newTransactionsMap) {
|
||||
final Long transactionOfficeId = (Long) map.get("officeId");
|
||||
final String transactionId = ((Long) map.get("id")).toString();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final Date transactionDate = Date
|
||||
.from(((LocalDate) map.get("date")).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final SavingsAccountTransactionEnumData transactionType = (SavingsAccountTransactionEnumData) map.get("type");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
final boolean reversed = (Boolean) map.get("reversed");
|
||||
@@ -268,7 +270,8 @@ public class AccountingProcessorHelper {
|
||||
for (final Map<String, Object> map : newTransactionsMap) {
|
||||
final Long transactionOfficeId = (Long) map.get("officeId");
|
||||
final String transactionId = ((Long) map.get("id")).toString();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final Date transactionDate = Date
|
||||
.from(((LocalDate) map.get("date")).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final ShareAccountTransactionEnumData transactionType = (ShareAccountTransactionEnumData) map.get("type");
|
||||
final ShareAccountTransactionEnumData transactionStatus = (ShareAccountTransactionEnumData) map.get("status");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
@@ -305,7 +308,7 @@ public class AccountingProcessorHelper {
|
||||
final Long clientId = (Long) accountingBridgeData.get("clientId");
|
||||
final Long transactionId = (Long) accountingBridgeData.get("id");
|
||||
final Date transactionDate = Date
|
||||
.from(((LocalDate) accountingBridgeData.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
.from(((LocalDate) accountingBridgeData.get("date")).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final EnumOptionData transactionType = (EnumOptionData) accountingBridgeData.get("type");
|
||||
final BigDecimal amount = (BigDecimal) accountingBridgeData.get("amount");
|
||||
final boolean reversed = (Boolean) accountingBridgeData.get("reversed");
|
||||
|
||||
+2
-2
@@ -20,7 +20,6 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -70,6 +69,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
@@ -593,7 +593,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
private void validateBusinessRulesForJournalEntries(final JournalEntryCommand command) {
|
||||
/** check if date of Journal entry is valid ***/
|
||||
final LocalDate entryLocalDate = command.getTransactionDate();
|
||||
final Date transactionDate = Date.from(entryLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final Date transactionDate = Date.from(entryLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
// shouldn't be in the future
|
||||
final Date todaysDate = new Date();
|
||||
if (transactionDate.after(todaysDate)) {
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@ package org.apache.fineract.accounting.provisioning.service;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -151,13 +150,13 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
|
||||
private Date parseDate(JsonCommand command) {
|
||||
LocalDate localDate = this.fromApiJsonHelper.extractLocalDateNamed("date", command.parsedJson());
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return Date.from(localDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
@Override
|
||||
@CronTarget(jobName = JobName.GENERATE_LOANLOSS_PROVISIONING)
|
||||
public void generateLoanLossProvisioningAmount() {
|
||||
Date currentDate = Date.from(DateUtils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date currentDate = Date.from(DateUtils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
boolean addJournalEntries = true;
|
||||
try {
|
||||
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService
|
||||
|
||||
+2
-2
@@ -19,13 +19,13 @@
|
||||
package org.apache.fineract.adhocquery.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.adhocquery.data.AdHocData;
|
||||
import org.apache.fineract.adhocquery.domain.ReportRunFrequency;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
|
||||
@@ -64,7 +64,7 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
|
||||
if (adhoc.getReportRunFrequency() != null) {
|
||||
if (adhoc.getLastRun() != null) {
|
||||
LocalDate start = adhoc.getLastRun().toLocalDate();
|
||||
LocalDate end = ZonedDateTime.now(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate end = ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()).toLocalDate();
|
||||
switch (ReportRunFrequency.fromId(adhoc.getReportRunFrequency())) {
|
||||
case DAILY:
|
||||
next = start.plusDays(1);
|
||||
|
||||
+2
-2
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.domain;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
@@ -31,6 +30,7 @@ import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
|
||||
@Entity
|
||||
@@ -103,7 +103,7 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
|
||||
public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) {
|
||||
return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(),
|
||||
command.json(), maker, ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
command.json(), maker, ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
|
||||
protected CommandSource() {
|
||||
|
||||
+2
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.commands.service;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Random;
|
||||
import org.apache.fineract.commands.domain.CommandSource;
|
||||
@@ -31,6 +30,7 @@ import org.apache.fineract.commands.exception.RollbackTransactionAsCommandIsNotA
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.jobs.service.SchedulerJobRunnerReadService;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
@@ -187,7 +187,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
||||
final CommandSource commandSourceInput = validateMakerCheckerTransaction(makerCheckerId);
|
||||
validateIsUpdateAllowed();
|
||||
final AppUser maker = this.context.authenticatedUser();
|
||||
commandSourceInput.markAsRejected(maker, ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
commandSourceInput.markAsRejected(maker, ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
this.commandSourceRepository.save(commandSourceInput);
|
||||
return makerCheckerId;
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.service;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.commands.domain.CommandSource;
|
||||
@@ -33,6 +32,7 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.hooks.event.HookEvent;
|
||||
import org.apache.fineract.infrastructure.hooks.event.HookEventSource;
|
||||
@@ -87,7 +87,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
|
||||
CommandSource commandSourceResult = null;
|
||||
if (command.commandId() != null) {
|
||||
commandSourceResult = this.commandSourceRepository.findById(command.commandId()).orElse(null);
|
||||
commandSourceResult.markAsChecked(maker, ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
commandSourceResult.markAsChecked(maker, ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
} else {
|
||||
commandSourceResult = CommandSource.fullEntryFrom(wrapper, command, maker);
|
||||
}
|
||||
|
||||
+5
-5
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.bulkimport.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -30,6 +29,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.domain.Document;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
final Boolean completed = Boolean.FALSE;
|
||||
final Integer successCount = 0;
|
||||
final Integer failureCount = 0;
|
||||
final LocalDateTime endTime = LocalDateTime.now(ZoneId.systemDefault());
|
||||
final LocalDateTime endTime = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
return new ImportDocument(document, importTime, endTime, completed, entityType, createdBy, totalRecords, successCount,
|
||||
failureCount);
|
||||
@@ -88,8 +88,8 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
final Integer entityType, final AppUser createdBy, final Integer totalRecords, final Integer successCount,
|
||||
final Integer failureCount) {
|
||||
this.document = document;
|
||||
this.importTime = Date.from(importTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.endTime = Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.importTime = Date.from(importTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.endTime = Date.from(endTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.completed = completed;
|
||||
this.entityType = entityType;
|
||||
this.createdBy = createdBy;
|
||||
@@ -100,7 +100,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public void update(final LocalDateTime endTime, final Integer successCount, final Integer errorCount) {
|
||||
this.endTime = Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.endTime = Date.from(endTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.completed = Boolean.TRUE;
|
||||
this.successCount = successCount;
|
||||
this.failureCount = errorCount;
|
||||
|
||||
+2
-2
@@ -21,12 +21,12 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformException;
|
||||
import org.apache.fineract.infrastructure.core.exception.UnsupportedParameterException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
@@ -145,7 +145,7 @@ public final class ImportHandlerUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
LocalDate localDate = LocalDate.ofInstant(c.getDateCellValue().toInstant(), ZoneId.systemDefault());
|
||||
LocalDate localDate = LocalDate.ofInstant(c.getDateCellValue().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
return localDate;
|
||||
}
|
||||
|
||||
|
||||
+19
-19
@@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.campaigns.email.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -153,15 +152,15 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
this.emailAttachmentFileFormat = emailAttachmentFileFormat.getValue();
|
||||
this.stretchyReport = stretchyReport;
|
||||
this.stretchyReportParamMap = stretchyReportParamMap;
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.submittedBy = submittedBy;
|
||||
this.recurrence = recurrence;
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
this.isVisible = true;
|
||||
if (localDateTime != null) {
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -185,7 +184,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
} else {
|
||||
emailAttachmentFileFormat = ScheduledEmailAttachmentFileFormat.instance(2);
|
||||
}
|
||||
LocalDate submittedOnDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate submittedOnDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (command.hasParameter(EmailCampaignValidator.submittedOnDateParamName)) {
|
||||
submittedOnDate = command.localDateValueOfParameterNamed(EmailCampaignValidator.submittedOnDateParamName);
|
||||
}
|
||||
@@ -194,7 +193,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (EmailCampaignType.fromInt(campaignType.intValue()).isSchedule()) {
|
||||
if (command.hasParameter(EmailCampaignValidator.recurrenceStartDate)) {
|
||||
recurrenceStartDate = LocalDateTime.parse(command.stringValueOfParameterNamed(EmailCampaignValidator.recurrenceStartDate),
|
||||
@@ -256,7 +255,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDateTime newValue = LocalDateTime.parse(valueAsInput, fmt);
|
||||
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
@@ -275,7 +274,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.approvedBy = currentUser;
|
||||
this.status = EmailCampaignStatus.ACTIVE.getValue();
|
||||
|
||||
@@ -299,7 +298,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
this.lastTriggerDate = null;
|
||||
}
|
||||
this.closedBy = currentUser;
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.status = EmailCampaignStatus.CLOSED.getValue();
|
||||
validateClosureDate();
|
||||
}
|
||||
@@ -318,7 +317,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.status = EmailCampaignStatus.ACTIVE.getValue();
|
||||
this.approvedBy = currentUser;
|
||||
this.closureDate = null;
|
||||
@@ -457,18 +456,18 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return activationLocalDate;
|
||||
}
|
||||
@@ -502,12 +501,13 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getRecurrenceStartDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
null);
|
||||
}
|
||||
|
||||
public LocalDateTime getRecurrenceStartDateTime() {
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
}
|
||||
|
||||
public void setLastTriggerDate(Date lastTriggerDate) {
|
||||
@@ -519,8 +519,8 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDateTime getNextTriggerDate() {
|
||||
return ObjectUtils
|
||||
.defaultIfNull(ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getLastTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public void updateIsVisible(boolean isVisible) {
|
||||
|
||||
+3
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.campaigns.email.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +33,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.EmailApiConstants;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
@@ -108,7 +108,8 @@ public class EmailMessage extends AbstractPersistableCustom {
|
||||
this.emailSubject = emailSubject;
|
||||
this.message = message;
|
||||
this.campaignName = campaignName;
|
||||
this.submittedOnDate = Date.from(LocalDate.now(ZoneId.systemDefault()).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date
|
||||
.from(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
|
||||
+6
-5
@@ -314,7 +314,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
final EmailCampaign emailCampaign = this.emailCampaignRepository.findById(campaignId)
|
||||
.orElseThrow(() -> new EmailCampaignNotFound(campaignId));
|
||||
LocalDateTime nextTriggerDate = emailCampaign.getNextTriggerDate();
|
||||
emailCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
emailCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
// calculate new trigger date and insert into next trigger date
|
||||
|
||||
/**
|
||||
@@ -340,7 +340,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
final LocalDateTime newTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
emailCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
emailCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
|
||||
@@ -388,7 +388,8 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
emailCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
emailCampaign
|
||||
.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
}
|
||||
@@ -539,7 +540,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
emailCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
emailCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
|
||||
@@ -557,7 +558,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
}
|
||||
|
||||
private LocalDateTime tenantDateTime() {
|
||||
LocalDateTime today = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime today = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
|
||||
|
||||
if (tenant != null) {
|
||||
|
||||
+19
-19
@@ -20,7 +20,6 @@ package org.apache.fineract.infrastructure.campaigns.sms.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -140,15 +139,15 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
this.paramValue = paramValue;
|
||||
this.status = SmsCampaignStatus.PENDING.getValue();
|
||||
this.message = message;
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.submittedBy = submittedBy;
|
||||
this.recurrence = recurrence;
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
this.isVisible = true;
|
||||
if (localDateTime != null) {
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
@@ -170,13 +169,13 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
final String paramValue = command.jsonFragment(SmsCampaignValidator.paramValue);
|
||||
|
||||
final String message = command.stringValueOfParameterNamed(SmsCampaignValidator.message);
|
||||
LocalDate submittedOnDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate submittedOnDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (command.hasParameter(SmsCampaignValidator.submittedOnDateParamName)) {
|
||||
submittedOnDate = command.localDateValueOfParameterNamed(SmsCampaignValidator.submittedOnDateParamName);
|
||||
}
|
||||
String recurrence = null;
|
||||
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (SmsCampaignTriggerType.fromInt(triggerType.intValue()).isSchedule()) {
|
||||
final Locale locale = command.extractLocale();
|
||||
String dateTimeFormat = null;
|
||||
@@ -262,7 +261,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDateTime newValue = LocalDateTime.parse(valueAsInput, fmt);
|
||||
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
@@ -281,7 +280,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.approvedBy = currentUser;
|
||||
this.status = SmsCampaignStatus.ACTIVE.getValue();
|
||||
|
||||
@@ -305,7 +304,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
this.lastTriggerDate = null;
|
||||
}
|
||||
this.closedBy = currentUser;
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.status = SmsCampaignStatus.CLOSED.getValue();
|
||||
validateClosureDate();
|
||||
}
|
||||
@@ -324,7 +323,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.status = SmsCampaignStatus.ACTIVE.getValue();
|
||||
this.approvedBy = currentUser;
|
||||
this.closureDate = null;
|
||||
@@ -467,18 +466,18 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return activationLocalDate;
|
||||
}
|
||||
@@ -508,12 +507,13 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getRecurrenceStartDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
null);
|
||||
}
|
||||
|
||||
public LocalDateTime getRecurrenceStartDateTime() {
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
}
|
||||
|
||||
public void setLastTriggerDate(Date lastTriggerDate) {
|
||||
@@ -525,8 +525,8 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDateTime getNextTriggerDate() {
|
||||
return ObjectUtils
|
||||
.defaultIfNull(ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getLastTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public void updateIsVisible(boolean isVisible) {
|
||||
|
||||
+5
-5
@@ -409,7 +409,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
final SmsCampaign smsCampaign = this.smsCampaignRepository.findById(campaignId)
|
||||
.orElseThrow(() -> new SmsCampaignNotFound(campaignId));
|
||||
LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate();
|
||||
smsCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
smsCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
// calculate new trigger date and insert into next trigger date
|
||||
|
||||
/**
|
||||
@@ -436,7 +436,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime newTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
smsCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
smsCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
}
|
||||
|
||||
@@ -645,7 +645,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
|
||||
@@ -682,7 +682,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
}
|
||||
|
||||
private LocalDateTime tenantDateTime() {
|
||||
LocalDateTime today = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime today = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
|
||||
|
||||
if (tenant != null) {
|
||||
|
||||
+3
-3
@@ -26,7 +26,6 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -36,6 +35,7 @@ import java.util.Set;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.domain.BasicPasswordEncodablePlatformUser;
|
||||
import org.apache.fineract.infrastructure.security.domain.PlatformUser;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformPasswordEncoder;
|
||||
@@ -368,7 +368,7 @@ public final class JsonCommand {
|
||||
public boolean isChangeInDateParameterNamed(final String parameterName, final Date existingValue) {
|
||||
LocalDate localDate = null;
|
||||
if (existingValue != null) {
|
||||
localDate = LocalDate.ofInstant(existingValue.toInstant(), ZoneId.systemDefault());
|
||||
localDate = LocalDate.ofInstant(existingValue.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return isChangeInLocalDateParameterNamed(parameterName, localDate);
|
||||
}
|
||||
@@ -417,7 +417,7 @@ public final class JsonCommand {
|
||||
if (localDate == null) {
|
||||
return null;
|
||||
}
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return Date.from(localDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public boolean isChangeInStringParameterNamed(final String parameterName, final String existingValue) {
|
||||
|
||||
+4
-4
@@ -26,9 +26,9 @@ import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ public final class JdbcSupport {
|
||||
ZonedDateTime dateTime = null;
|
||||
final Timestamp dateValue = rs.getTimestamp(columnName);
|
||||
if (dateValue != null) {
|
||||
dateTime = ZonedDateTime.ofInstant(new Date(dateValue.getTime()).toInstant(), ZoneId.systemDefault());
|
||||
dateTime = ZonedDateTime.ofInstant(new Date(dateValue.getTime()).toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public final class JdbcSupport {
|
||||
LocalDate localDate = null;
|
||||
final Date dateValue = rs.getTimestamp(columnName);
|
||||
if (dateValue != null) {
|
||||
localDate = LocalDate.ofInstant(dateValue.toInstant(), ZoneId.systemDefault());
|
||||
localDate = LocalDate.ofInstant(dateValue.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return localDate;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public final class JdbcSupport {
|
||||
LocalTime localTime = null;
|
||||
final Date timeValue = rs.getTimestamp(columnName);
|
||||
if (timeValue != null) {
|
||||
localTime = LocalTime.ofInstant(timeValue.toInstant(), ZoneId.systemDefault());
|
||||
localTime = LocalTime.ofInstant(timeValue.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return localTime;
|
||||
}
|
||||
|
||||
+3
-2
@@ -34,7 +34,6 @@ import java.text.ParseException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.temporal.ChronoField;
|
||||
@@ -46,6 +45,7 @@ import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.springframework.format.number.NumberStyleFormatter;
|
||||
|
||||
/**
|
||||
@@ -309,7 +309,8 @@ public class JsonParserHelper {
|
||||
final Integer month = dateArray.get(1).getAsInt();
|
||||
final Integer day = dateArray.get(2).getAsInt();
|
||||
|
||||
value = LocalDate.now(ZoneId.systemDefault()).with(YEAR_OF_ERA, year).with(MONTH_OF_YEAR, month).with(DAY_OF_MONTH, day);
|
||||
value = LocalDate.now(DateUtils.getDateTimeZoneOfTenant()).with(YEAR_OF_ERA, year).with(MONTH_OF_YEAR, month)
|
||||
.with(DAY_OF_MONTH, day);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-16
@@ -41,7 +41,7 @@ public final class DateUtils {
|
||||
|
||||
public static ZoneId getDateTimeZoneOfTenant() {
|
||||
final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
|
||||
ZoneId zone = null;
|
||||
ZoneId zone = ZoneId.systemDefault();
|
||||
if (tenant != null) {
|
||||
zone = ZoneId.of(tenant.getTimezoneId());
|
||||
}
|
||||
@@ -58,30 +58,18 @@ public final class DateUtils {
|
||||
}
|
||||
|
||||
public static Date getDateOfTenant() {
|
||||
return Date.from(getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return Date.from(getLocalDateOfTenant().atStartOfDay(getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public static LocalDate getLocalDateOfTenant() {
|
||||
|
||||
LocalDate today = LocalDate.now(ZoneId.systemDefault());
|
||||
|
||||
final ZoneId zone = getDateTimeZoneOfTenant();
|
||||
if (zone != null) {
|
||||
today = LocalDate.now(zone);
|
||||
}
|
||||
|
||||
LocalDate today = LocalDate.now(zone);
|
||||
return today;
|
||||
}
|
||||
|
||||
public static LocalDateTime getLocalDateTimeOfTenant() {
|
||||
|
||||
LocalDateTime today = LocalDateTime.now(ZoneId.systemDefault());
|
||||
|
||||
final ZoneId zone = getDateTimeZoneOfTenant();
|
||||
if (zone != null) {
|
||||
today = LocalDateTime.now(zone);
|
||||
}
|
||||
|
||||
LocalDateTime today = LocalDateTime.now(zone);
|
||||
return today;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.gcm.domain;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -51,7 +50,7 @@ public final class DeviceRegistration extends AbstractPersistableCustom {
|
||||
private DeviceRegistration(final Client client, final String registrationId) {
|
||||
this.client = client;
|
||||
this.registrationId = registrationId;
|
||||
this.updatedOnDate = Date.from(DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.updatedOnDate = Date.from(DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public static DeviceRegistration instance(final Client client, final String registrationId) {
|
||||
|
||||
+2
-2
@@ -21,10 +21,10 @@ package org.apache.fineract.infrastructure.gcm.service;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationData;
|
||||
import org.apache.fineract.infrastructure.gcm.exception.DeviceRegistrationNotFoundException;
|
||||
@@ -75,7 +75,7 @@ public class DeviceRegistrationReadPlatformServiceImpl implements DeviceRegistra
|
||||
final String clientName = rs.getString("clientName");
|
||||
ClientData clientData = ClientData.instance(clientId, clientName);
|
||||
return DeviceRegistrationData.instance(id, clientData, registrationId,
|
||||
Date.from(updatedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(updatedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.gcm.service;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.PersistenceException;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
@@ -95,7 +94,8 @@ public class DeviceRegistrationWritePlatformServiceImpl implements DeviceRegistr
|
||||
Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
|
||||
deviceRegistration.setClient(client);
|
||||
deviceRegistration.setRegistrationId(registrationId);
|
||||
deviceRegistration.setUpdatedOnDate(Date.from(DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault()).toInstant()));
|
||||
deviceRegistration
|
||||
.setUpdatedOnDate(Date.from(DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
return deviceRegistration;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.gcm.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -110,7 +109,7 @@ public class NotificationSenderService {
|
||||
if (res.getSuccess() != null && res.getSuccess() > 0) {
|
||||
smsMessage.setStatusType(SmsMessageStatusType.SENT.getValue());
|
||||
smsMessage.setDeliveredOnDate(
|
||||
Date.from(DateUtils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(DateUtils.getLocalDateOfTenant().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
} else if (res.getFailure() != null && res.getFailure() > 0) {
|
||||
smsMessage.setStatusType(SmsMessageStatusType.FAILED.getValue());
|
||||
}
|
||||
|
||||
+14
-10
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
@@ -36,6 +35,7 @@ import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.dataqueries.domain.Report;
|
||||
import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConstants;
|
||||
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobEmailAttachmentFileFormat;
|
||||
@@ -129,7 +129,7 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
this.startDateTime = null;
|
||||
|
||||
if (startDateTime != null) {
|
||||
this.startDateTime = Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.startDateTime = Date.from(startDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
this.recurrence = recurrence;
|
||||
@@ -142,13 +142,13 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
this.previousRunDateTime = null;
|
||||
|
||||
if (previousRunDateTime != null) {
|
||||
this.previousRunDateTime = Date.from(previousRunDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.previousRunDateTime = Date.from(previousRunDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
this.nextRunDateTime = null;
|
||||
|
||||
if (nextRunDateTime != null) {
|
||||
this.nextRunDateTime = Date.from(nextRunDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.nextRunDateTime = Date.from(nextRunDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
this.previousRunStatus = null;
|
||||
@@ -201,7 +201,7 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
.integerValueOfParameterNamed(ReportMailingJobConstants.EMAIL_ATTACHMENT_FILE_FORMAT_ID_PARAM_NAME);
|
||||
final ReportMailingJobEmailAttachmentFileFormat emailAttachmentFileFormat = ReportMailingJobEmailAttachmentFileFormat
|
||||
.newInstance(emailAttachmentFileFormatId);
|
||||
LocalDateTime startDateTime = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime startDateTime = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
if (jsonCommand.hasParameter(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME)) {
|
||||
final String startDateTimeString = jsonCommand
|
||||
@@ -308,13 +308,13 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
.withLocale(jsonCommand.extractLocale());
|
||||
final LocalDateTime newStartDateTime = LocalDateTime.parse(newStartDateTimeString, dateTimeFormatter);
|
||||
final LocalDateTime oldStartDateTime = (this.startDateTime != null)
|
||||
? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), ZoneId.systemDefault()).toLocalDateTime()
|
||||
? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime()
|
||||
: null;
|
||||
|
||||
if ((oldStartDateTime != null) && !newStartDateTime.equals(oldStartDateTime)) {
|
||||
actualChanges.put(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME, newStartDateTimeString);
|
||||
|
||||
this.startDateTime = Date.from(newStartDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.startDateTime = Date.from(newStartDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +375,8 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
* @return the value of the startDateTime property
|
||||
**/
|
||||
public ZonedDateTime getStartDateTime() {
|
||||
return (this.startDateTime != null) ? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), ZoneId.systemDefault()) : null;
|
||||
return (this.startDateTime != null) ? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,7 +460,8 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
* @return the previousRunDateTime
|
||||
*/
|
||||
public ZonedDateTime getPreviousRunDateTime() {
|
||||
return (this.previousRunDateTime != null) ? ZonedDateTime.ofInstant(this.previousRunDateTime.toInstant(), ZoneId.systemDefault())
|
||||
return (this.previousRunDateTime != null)
|
||||
? ZonedDateTime.ofInstant(this.previousRunDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -467,7 +469,9 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
* @return the nextRunDateTime
|
||||
*/
|
||||
public ZonedDateTime getNextRunDateTime() {
|
||||
return (this.nextRunDateTime != null) ? ZonedDateTime.ofInstant(this.nextRunDateTime.toInstant(), ZoneId.systemDefault()) : null;
|
||||
return (this.nextRunDateTime != null)
|
||||
? ZonedDateTime.ofInstant(this.nextRunDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-3
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.domain;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
@@ -29,6 +28,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_report_mailing_job_run_history")
|
||||
@@ -106,14 +106,16 @@ public class ReportMailingJobRunHistory extends AbstractPersistableCustom {
|
||||
* @return the startDateTime
|
||||
*/
|
||||
public ZonedDateTime getStartDateTime() {
|
||||
return (this.startDateTime != null) ? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), ZoneId.systemDefault()) : null;
|
||||
return (this.startDateTime != null) ? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endDateTime
|
||||
*/
|
||||
public ZonedDateTime getEndDateTime() {
|
||||
return (this.endDateTime != null) ? ZonedDateTime.ofInstant(this.endDateTime.toInstant(), ZoneId.systemDefault()) : null;
|
||||
return (this.endDateTime != null) ? ZonedDateTime.ofInstant(this.endDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-4
@@ -25,7 +25,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collection;
|
||||
@@ -171,7 +170,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
// go ahead if the recurrence is not null
|
||||
if (StringUtils.isNotBlank(recurrence)) {
|
||||
// set the start ZonedDateTime to the current tenant date time
|
||||
ZonedDateTime startDateTime = DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault());
|
||||
ZonedDateTime startDateTime = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
// check if the start ZonedDateTime was updated
|
||||
if (changes.containsKey(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME)) {
|
||||
@@ -253,7 +252,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
|
||||
for (ReportMailingJob reportMailingJob : reportMailingJobCollection) {
|
||||
// get the tenant's date as a ZonedDateTime object
|
||||
final ZonedDateTime localDateTimeOftenant = DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault());
|
||||
final ZonedDateTime localDateTimeOftenant = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
final ZonedDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
|
||||
if (nextRunDateTime != null && nextRunDateTime.isBefore(localDateTimeOftenant)) {
|
||||
@@ -394,7 +393,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
**/
|
||||
private void createReportMailingJobRunHistroryAfterJobExecution(final ReportMailingJob reportMailingJob, final StringBuilder errorLog,
|
||||
final ZonedDateTime jobStartDateTime, final String jobRunStatus) {
|
||||
final ZonedDateTime jobEndDateTime = DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault());
|
||||
final ZonedDateTime jobEndDateTime = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
final String errorLogToString = (errorLog != null) ? errorLog.toString() : null;
|
||||
final ReportMailingJobRunHistory reportMailingJobRunHistory = ReportMailingJobRunHistory.newInstance(reportMailingJob,
|
||||
jobStartDateTime, jobEndDateTime, jobRunStatus, null, errorLogToString);
|
||||
|
||||
+2
-3
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.security.data;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@@ -33,7 +32,7 @@ public class OTPRequest {
|
||||
}
|
||||
|
||||
public static OTPRequest create(String token, int tokenLiveTimeInSec, boolean extendedAccessToken, OTPDeliveryMethod deliveryMethod) {
|
||||
final OTPMetadata metadata = new OTPMetadata(DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault()),
|
||||
final OTPMetadata metadata = new OTPMetadata(DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant()),
|
||||
tokenLiveTimeInSec, extendedAccessToken, deliveryMethod);
|
||||
return new OTPRequest(token, metadata);
|
||||
}
|
||||
@@ -48,6 +47,6 @@ public class OTPRequest {
|
||||
|
||||
public boolean isValid() {
|
||||
ZonedDateTime expireTime = metadata.getRequestTime().plusSeconds(metadata.getTokenLiveTimeInSec());
|
||||
return ZonedDateTime.now(ZoneId.systemDefault()).isBefore(expireTime);
|
||||
return ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()).isBefore(expireTime);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.security.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
@@ -61,7 +60,7 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
public TFAccessToken() {}
|
||||
|
||||
public static TFAccessToken create(String token, AppUser user, int tokenLiveTimeInSec) {
|
||||
ZonedDateTime validFrom = DateUtils.getLocalDateTimeOfTenant().atZone(ZoneId.systemDefault());
|
||||
ZonedDateTime validFrom = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
ZonedDateTime validTo = validFrom.plusSeconds(tokenLiveTimeInSec);
|
||||
|
||||
return new TFAccessToken(token, user, Date.from(validFrom.toInstant()), Date.from(validTo.toInstant()), true);
|
||||
@@ -80,8 +79,8 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public AccessTokenData toTokenData() {
|
||||
return new AccessTokenData(this.token, getValidFromDate().atZone(ZoneId.systemDefault()),
|
||||
getValidToDate().atZone(ZoneId.systemDefault()));
|
||||
return new AccessTokenData(this.token, getValidFromDate().atZone(DateUtils.getDateTimeZoneOfTenant()),
|
||||
getValidToDate().atZone(DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
@@ -97,11 +96,11 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDateTime getValidFromDate() {
|
||||
return ZonedDateTime.ofInstant(validFrom.toInstant(), ZoneId.systemDefault()).toLocalDateTime();
|
||||
return ZonedDateTime.ofInstant(validFrom.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime();
|
||||
}
|
||||
|
||||
public LocalDateTime getValidToDate() {
|
||||
return ZonedDateTime.ofInstant(validTo.toInstant(), ZoneId.systemDefault()).toLocalDateTime();
|
||||
return ZonedDateTime.ofInstant(validTo.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime();
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
|
||||
+3
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.sms.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +33,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.sms.domain.SmsCampaign;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.sms.SmsApiConstants;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
@@ -121,7 +121,8 @@ public class SmsMessage extends AbstractPersistableCustom {
|
||||
this.mobileNo = mobileNo;
|
||||
this.message = message;
|
||||
this.smsCampaign = smsCampaign;
|
||||
this.submittedOnDate = Date.from(LocalDate.now(ZoneId.systemDefault()).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date
|
||||
.from(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -19,11 +19,11 @@
|
||||
package org.apache.fineract.infrastructure.survey.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
|
||||
@@ -139,10 +139,10 @@ public class ReadSurveyServiceImpl implements ReadSurveyService {
|
||||
List<ClientScoresOverview> scoresOverviews = new ArrayList<>();
|
||||
|
||||
while (rs.next()) {
|
||||
scoresOverviews.add(
|
||||
new ClientScoresOverview(rs.getString("code"), rs.getString("name"), rs.getLong("score"), rs.getDouble("poverty_line"),
|
||||
LocalDate.ofInstant(new Date(rs.getTimestamp("date").getTime()).toInstant(), ZoneId.systemDefault()),
|
||||
rs.getLong("id"), surveyName));
|
||||
scoresOverviews.add(new ClientScoresOverview(rs.getString("code"), rs.getString("name"), rs.getLong("score"),
|
||||
rs.getDouble("poverty_line"),
|
||||
LocalDate.ofInstant(new Date(rs.getTimestamp("date").getTime()).toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
rs.getLong("id"), surveyName));
|
||||
}
|
||||
|
||||
return scoresOverviews;
|
||||
@@ -172,7 +172,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService {
|
||||
while (rs.next()) {
|
||||
scoresOverviews.add(new ClientScoresOverview(rs.getString("code"), rs.getString("name"), rs.getLong("score"),
|
||||
rs.getDouble("poverty_line"),
|
||||
LocalDate.ofInstant(new Date(rs.getTimestamp("date").getTime()).toInstant(), ZoneId.systemDefault()),
|
||||
LocalDate.ofInstant(new Date(rs.getTimestamp("date").getTime()).toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
rs.getLong("id"), rs.getString("surveyName")));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -21,12 +21,12 @@ package org.apache.fineract.interoperation.data;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.beans.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.interoperation.domain.InteropActionState;
|
||||
|
||||
public class InteropResponseData extends CommandProcessingResult {
|
||||
@@ -100,6 +100,6 @@ public class InteropResponseData extends CommandProcessingResult {
|
||||
}
|
||||
|
||||
protected static String format(LocalDateTime date) {
|
||||
return date == null ? null : ZonedDateTime.of(date, ZoneId.systemDefault()).format(ISO_DATE_TIME_FORMATTER);
|
||||
return date == null ? null : ZonedDateTime.of(date, DateUtils.getDateTimeZoneOfTenant()).format(ISO_DATE_TIME_FORMATTER);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -223,7 +223,8 @@ public class InteropServiceImpl implements InteropService {
|
||||
return true;
|
||||
}
|
||||
|
||||
java.time.LocalDateTime transactionDate = t.getTransactionLocalDate().atStartOfDay(ZoneId.systemDefault()).toLocalDateTime();
|
||||
java.time.LocalDateTime transactionDate = t.getTransactionLocalDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant())
|
||||
.toLocalDateTime();
|
||||
return (transactionsTo == null || transactionsTo.compareTo(transactionDate) > 0) && (transactionsFrom == null
|
||||
|| transactionsFrom.compareTo(transactionDate.withHour(23).withMinute(59).withSecond(59)) <= 0);
|
||||
};
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.notification.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
public class TopicSubscriberData {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TopicSubscriberData {
|
||||
this.id = id;
|
||||
this.topicId = topicId;
|
||||
this.userId = userId;
|
||||
this.subscriptionDate = LocalDate.now(ZoneId.systemDefault());
|
||||
this.subscriptionDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
|
||||
+10
-10
@@ -29,7 +29,6 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.localePa
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@@ -53,6 +52,7 @@ import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.holiday.api.HolidayApiConstants;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
|
||||
@@ -150,7 +150,7 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
actualChanges.put(dateFormatParamName, dateFormatAsInput);
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(fromDateParamName);
|
||||
this.fromDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(toDateParamName, getToDateLocalDate())) {
|
||||
@@ -160,7 +160,7 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(toDateParamName);
|
||||
this.toDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.toDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(repaymentsRescheduledToParamName, getRepaymentsRescheduledToLocalDate())) {
|
||||
@@ -170,7 +170,7 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(repaymentsRescheduledToParamName);
|
||||
this.repaymentsRescheduledTo = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.repaymentsRescheduledTo = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.hasParameter(officesParamName)) {
|
||||
@@ -233,15 +233,15 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
if (fromDate != null) {
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (toDate != null) {
|
||||
this.toDate = Date.from(toDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.toDate = Date.from(toDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (repaymentsRescheduledTo != null) {
|
||||
this.repaymentsRescheduledTo = Date.from(repaymentsRescheduledTo.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.repaymentsRescheduledTo = Date.from(repaymentsRescheduledTo.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
this.status = status;
|
||||
@@ -264,7 +264,7 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
public LocalDate getRepaymentsRescheduledToLocalDate() {
|
||||
LocalDate repaymentsRescheduledTo = null;
|
||||
if (this.repaymentsRescheduledTo != null) {
|
||||
repaymentsRescheduledTo = LocalDate.ofInstant(this.repaymentsRescheduledTo.toInstant(), ZoneId.systemDefault());
|
||||
repaymentsRescheduledTo = LocalDate.ofInstant(this.repaymentsRescheduledTo.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return repaymentsRescheduledTo;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
public LocalDate getFromDateLocalDate() {
|
||||
LocalDate fromDate = null;
|
||||
if (this.fromDate != null) {
|
||||
fromDate = LocalDate.ofInstant(this.fromDate.toInstant(), ZoneId.systemDefault());
|
||||
fromDate = LocalDate.ofInstant(this.fromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return fromDate;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public class Holiday extends AbstractPersistableCustom {
|
||||
public LocalDate getToDateLocalDate() {
|
||||
LocalDate toDate = null;
|
||||
if (this.toDate != null) {
|
||||
toDate = LocalDate.ofInstant(this.toDate.toInstant(), ZoneId.systemDefault());
|
||||
toDate = LocalDate.ofInstant(this.toDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return toDate;
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,9 +19,9 @@
|
||||
package org.apache.fineract.organisation.holiday.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.holiday.exception.HolidayNotFoundException;
|
||||
import org.apache.fineract.organisation.holiday.service.HolidayUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -72,7 +72,7 @@ public class HolidayRepositoryWrapper {
|
||||
|
||||
public boolean isHoliday(Long officeId, LocalDate transactionDate) {
|
||||
final List<Holiday> holidays = findByOfficeIdAndGreaterThanDate(officeId,
|
||||
Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
return HolidayUtil.isHoliday(transactionDate, holidays);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,7 +20,6 @@ package org.apache.fineract.organisation.office.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -39,6 +38,7 @@ import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.exception.CannotUpdateOfficeWithParentOfficeSameAsSelf;
|
||||
import org.apache.fineract.organisation.office.exception.RootOfficeParentCannotBeUpdated;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
|
||||
private Office(final Office parent, final String name, final LocalDate openingDate, final String externalId) {
|
||||
this.parent = parent;
|
||||
this.openingDate = Date.from(openingDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.openingDate = Date.from(openingDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
if (parent != null) {
|
||||
this.parent.addChild(this);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(openingDateParamName);
|
||||
this.openingDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.openingDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String nameParamName = "name";
|
||||
@@ -167,7 +167,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
public LocalDate getOpeningLocalDate() {
|
||||
LocalDate openingLocalDate = null;
|
||||
if (this.openingDate != null) {
|
||||
openingLocalDate = LocalDate.ofInstant(this.openingDate.toInstant(), ZoneId.systemDefault());
|
||||
openingLocalDate = LocalDate.ofInstant(this.openingDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return openingLocalDate;
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,7 +20,6 @@ package org.apache.fineract.organisation.office.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
@@ -33,6 +32,7 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class OfficeTransaction extends AbstractPersistableCustom {
|
||||
this.from = fromOffice;
|
||||
this.to = toOffice;
|
||||
if (transactionLocalDate != null) {
|
||||
this.transactionDate = Date.from(transactionLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.transactionDate = Date.from(transactionLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
this.currency = amount.getCurrency();
|
||||
this.transactionAmount = amount.getAmount();
|
||||
|
||||
+3
-3
@@ -22,10 +22,10 @@ import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
@@ -210,7 +210,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
return OfficeData.template(null, LocalDate.now(ZoneId.systemDefault()));
|
||||
return OfficeData.template(null, LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,7 +258,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
final Collection<OfficeData> parentLookups = retrieveAllOfficesForDropdown();
|
||||
final Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
return OfficeTransactionData.template(LocalDate.now(ZoneId.systemDefault()), parentLookups, currencyOptions);
|
||||
return OfficeTransactionData.template(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()), parentLookups, currencyOptions);
|
||||
}
|
||||
|
||||
public PlatformSecurityContext getContext() {
|
||||
|
||||
+3
-3
@@ -22,7 +22,6 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -32,6 +31,7 @@ import java.util.Set;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.provisioning.constants.ProvisioningCriteriaConstants;
|
||||
import org.apache.fineract.organisation.provisioning.domain.LoanProductProvisionCriteria;
|
||||
@@ -122,8 +122,8 @@ public class ProvisioningCriteriaAssembler {
|
||||
jsonElement);
|
||||
|
||||
ProvisioningCriteria criteria = new ProvisioningCriteria(criteriaName, platformSecurityContext.authenticatedUser(),
|
||||
ZonedDateTime.now(ZoneId.systemDefault()), platformSecurityContext.authenticatedUser(),
|
||||
ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()), platformSecurityContext.authenticatedUser(),
|
||||
ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
return criteria;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.organisation.staff.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -36,6 +35,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.domain.Image;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class Staff extends AbstractPersistableCustom {
|
||||
this.active = isActive == null ? true : isActive;
|
||||
deriveDisplayName(firstname);
|
||||
if (joiningDate != null) {
|
||||
this.joiningDate = Date.from(joiningDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.joiningDate = Date.from(joiningDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ public class Staff extends AbstractPersistableCustom {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(joiningDateParamName);
|
||||
actualChanges.put(joiningDateParamName, valueAsInput);
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(joiningDateParamName);
|
||||
this.joiningDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.joiningDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
|
||||
+3
-4
@@ -21,7 +21,6 @@ package org.apache.fineract.organisation.teller.data;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -80,8 +79,8 @@ public class CashierTransactionDataValidator {
|
||||
|
||||
public void validateCashierAllowedDateAndTime(final Cashier cashier, final Teller teller) {
|
||||
Long staffId = cashier.getStaff().getId();
|
||||
final LocalDate fromDate = LocalDate.ofInstant(cashier.getStartDate().toInstant(), ZoneId.systemDefault());
|
||||
final LocalDate endDate = LocalDate.ofInstant(cashier.getEndDate().toInstant(), ZoneId.systemDefault());
|
||||
final LocalDate fromDate = LocalDate.ofInstant(cashier.getStartDate().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final LocalDate endDate = LocalDate.ofInstant(cashier.getEndDate().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final LocalDate tellerFromDate = teller.getStartLocalDate();
|
||||
final LocalDate tellerEndDate = teller.getEndLocalDate();
|
||||
/**
|
||||
@@ -116,7 +115,7 @@ public class CashierTransactionDataValidator {
|
||||
String sql = "select c.id from m_cashiers c where c.staff_id = " + user.getStaff().getId() + " AND "
|
||||
+ " (case when c.full_day then '" + localDateTime.toLocalDate() + "' BETWEEN c.start_date AND c.end_date " + " else ('"
|
||||
+ localDateTime.toLocalDate() + "' BETWEEN c.start_date AND c.end_date and " + " TIME('"
|
||||
+ ZonedDateTime.of(localDateTime, ZoneId.systemDefault())
|
||||
+ ZonedDateTime.of(localDateTime, DateUtils.getDateTimeZoneOfTenant())
|
||||
+ "') BETWEEN TIME(c.start_time) AND TIME(c.end_time) ) end)";
|
||||
try {
|
||||
Long cashierId = this.jdbcTemplate.queryForObject(sql, Long.class);
|
||||
|
||||
+7
-7
@@ -20,7 +20,6 @@ package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -37,6 +36,7 @@ import javax.persistence.Transient;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
|
||||
@@ -114,8 +114,8 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
this.teller = teller;
|
||||
this.staff = staff;
|
||||
this.description = description;
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.isFullDay = isFullDay;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
@@ -143,7 +143,7 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(startDateParamName);
|
||||
this.startDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String endDateParamName = "endDate";
|
||||
@@ -154,7 +154,7 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
this.endDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final Boolean isFullDay = command.booleanObjectValueOfParameterNamed("isFullDay");
|
||||
@@ -347,7 +347,7 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
public LocalDate getStartLocalDate() {
|
||||
LocalDate startLocalDate = null;
|
||||
if (this.startDate != null) {
|
||||
startLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), ZoneId.systemDefault());
|
||||
startLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return startLocalDate;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
public LocalDate getEndLocalDate() {
|
||||
LocalDate endLocalDate = null;
|
||||
if (this.endDate != null) {
|
||||
endLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault());
|
||||
endLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endLocalDate;
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,7 +20,6 @@ package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -35,6 +34,7 @@ import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
|
||||
@Entity
|
||||
@@ -103,7 +103,7 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
this.cashier = cashier;
|
||||
this.txnType = txnType;
|
||||
if (txnDate != null) {
|
||||
this.txnDate = Date.from(txnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.txnDate = Date.from(txnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
this.txnAmount = txnAmount;
|
||||
this.entityType = entityType;
|
||||
@@ -135,7 +135,7 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(txnDateParamName);
|
||||
this.txnDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.txnDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String txnAmountParamName = "txnAmount";
|
||||
@@ -235,7 +235,7 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
public LocalDate getTxnLocalDate() {
|
||||
LocalDate txnLocalDate = null;
|
||||
if (this.txnDate != null) {
|
||||
txnLocalDate = LocalDate.ofInstant(this.txnDate.toInstant(), ZoneId.systemDefault());
|
||||
txnLocalDate = LocalDate.ofInstant(this.txnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return txnLocalDate;
|
||||
}
|
||||
|
||||
+7
-7
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -38,6 +37,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
|
||||
@Entity
|
||||
@@ -86,10 +86,10 @@ public class Teller extends AbstractPersistableCustom {
|
||||
this.name = StringUtils.defaultIfEmpty(name, null);
|
||||
this.description = StringUtils.defaultIfEmpty(description, null);
|
||||
if (startDate != null) {
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
if (endDate != null) {
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
if (status != null) {
|
||||
this.status = status.getValue();
|
||||
@@ -152,7 +152,7 @@ public class Teller extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(startDateParamName);
|
||||
this.startDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String endDateParamName = "endDate";
|
||||
@@ -163,7 +163,7 @@ public class Teller extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
this.endDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String statusParamName = "status";
|
||||
@@ -227,7 +227,7 @@ public class Teller extends AbstractPersistableCustom {
|
||||
public LocalDate getStartLocalDate() {
|
||||
LocalDate startLocalDate = null;
|
||||
if (this.startDate != null) {
|
||||
startLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), ZoneId.systemDefault());
|
||||
startLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return startLocalDate;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public class Teller extends AbstractPersistableCustom {
|
||||
public LocalDate getEndLocalDate() {
|
||||
LocalDate endLocalDate = null;
|
||||
if (this.endDate != null) {
|
||||
endLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault());
|
||||
endLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endLocalDate;
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,13 +22,13 @@ import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
@@ -599,8 +599,8 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
final String endTime = rs.getString("end_time");
|
||||
|
||||
return CashierData.instance(id, null, null, staffId, staffName, tellerId, tellerName, description,
|
||||
Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), fullDay, startTime, endTime);
|
||||
Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), fullDay, startTime, endTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,11 +750,11 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
|
||||
|
||||
Date txnDate = null;
|
||||
if (txnLocalDate != null) {
|
||||
txnDate = Date.from(txnLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
txnDate = Date.from(txnLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
Date createdDate = null;
|
||||
if (createdLocalDate != null) {
|
||||
createdDate = Date.from(createdLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
createdDate = Date.from(createdLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final Long officeId = rs.getLong("office_id");
|
||||
|
||||
+7
-7
@@ -34,7 +34,6 @@ import static org.apache.fineract.portfolio.account.api.StandingInstructionApiCo
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -53,6 +52,7 @@ import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
|
||||
@Entity
|
||||
@@ -135,12 +135,12 @@ public class AccountTransferStandingInstruction extends AbstractPersistableCusto
|
||||
this.status = status;
|
||||
this.amount = amount;
|
||||
if (validFrom != null) {
|
||||
this.validFrom = Date.from(validFrom.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.validFrom = Date.from(validFrom.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
if (validTill == null) {
|
||||
this.validTill = null;
|
||||
} else {
|
||||
this.validTill = Date.from(validTill.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.validTill = Date.from(validTill.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
this.recurrenceType = recurrenceType;
|
||||
this.recurrenceFrequency = recurrenceFrequency;
|
||||
@@ -171,13 +171,13 @@ public class AccountTransferStandingInstruction extends AbstractPersistableCusto
|
||||
if (command.isChangeInDateParameterNamed(validFromParamName, this.validFrom)) {
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(validFromParamName);
|
||||
actualChanges.put(validFromParamName, newValue);
|
||||
this.validFrom = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.validFrom = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInDateParameterNamed(validTillParamName, this.validTill)) {
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(validTillParamName);
|
||||
actualChanges.put(validTillParamName, newValue);
|
||||
this.validTill = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.validTill = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInBigDecimalParameterNamed(amountParamName, this.amount)) {
|
||||
@@ -248,8 +248,8 @@ public class AccountTransferStandingInstruction extends AbstractPersistableCusto
|
||||
|
||||
if (this.validTill != null && this.validFrom != null) {
|
||||
baseDataValidator.reset().parameter(validTillParamName)
|
||||
.value(LocalDate.ofInstant(this.validTill.toInstant(), ZoneId.systemDefault()))
|
||||
.validateDateAfter(LocalDate.ofInstant(this.validFrom.toInstant(), ZoneId.systemDefault()));
|
||||
.value(LocalDate.ofInstant(this.validTill.toInstant(), DateUtils.getDateTimeZoneOfTenant()))
|
||||
.validateDateAfter(LocalDate.ofInstant(this.validFrom.toInstant(), DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
|
||||
if (AccountTransferRecurrenceType.fromInt(recurrenceType).isPeriodicRecurrence()) {
|
||||
|
||||
+2
-2
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.account.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
@@ -31,6 +30,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
||||
@@ -111,7 +111,7 @@ public class AccountTransferTransaction extends AbstractPersistableCustom {
|
||||
this.fromSavingsTransaction = withdrawal;
|
||||
this.toSavingsTransaction = deposit;
|
||||
this.toLoanTransaction = loanRepaymentTransaction;
|
||||
this.date = Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.date = Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.currency = transactionAmount.getCurrency();
|
||||
this.amount = transactionAmount.getAmountDefaultedToNullIfZero();
|
||||
this.description = description;
|
||||
|
||||
+2
-2
@@ -30,7 +30,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -437,7 +436,8 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr
|
||||
final Integer recurrenceOnDay = JdbcSupport.getInteger(rs, "recurrenceOnDay");
|
||||
final Integer recurrenceOnMonth = JdbcSupport.getInteger(rs, "recurrenceOnMonth");
|
||||
if (recurrenceOnDay != null) {
|
||||
recurrenceOnMonthDay = MonthDay.now(ZoneId.systemDefault()).withMonth(recurrenceOnMonth).withDayOfMonth(recurrenceOnDay);
|
||||
recurrenceOnMonthDay = MonthDay.now(DateUtils.getDateTimeZoneOfTenant()).withMonth(recurrenceOnMonth)
|
||||
.withDayOfMonth(recurrenceOnDay);
|
||||
}
|
||||
|
||||
final Integer transferType = rs.getInt("transferType");
|
||||
|
||||
+5
-5
@@ -25,7 +25,6 @@ import static org.apache.fineract.portfolio.account.api.StandingInstructionApiCo
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -38,6 +37,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformServiceUnavailableException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
|
||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||
@@ -199,7 +199,7 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
|
||||
boolean isDueForTransfer = false;
|
||||
AccountTransferRecurrenceType recurrenceType = data.recurrenceType();
|
||||
StandingInstructionType instructionType = data.instructionType();
|
||||
LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate transactionDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (recurrenceType.isPeriodicRecurrence()) {
|
||||
final ScheduledDateGenerator scheduledDateGenerator = new DefaultScheduledDateGenerator();
|
||||
PeriodFrequencyType frequencyType = data.recurrenceFrequency();
|
||||
@@ -228,7 +228,7 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
|
||||
transactionAmount = standingInstructionDuesData.totalDueAmount();
|
||||
}
|
||||
if (recurrenceType.isDuesRecurrence()) {
|
||||
isDueForTransfer = LocalDate.now(ZoneId.systemDefault()).equals(standingInstructionDuesData.dueDate());
|
||||
isDueForTransfer = LocalDate.now(DateUtils.getDateTimeZoneOfTenant()).equals(standingInstructionDuesData.dueDate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst
|
||||
|
||||
if (transferCompleted) {
|
||||
final String updateQuery = "UPDATE m_account_transfer_standing_instructions SET last_run_date = ? where id = ?";
|
||||
this.jdbcTemplate.update(updateQuery, Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
data.getId());
|
||||
this.jdbcTemplate.update(updateQuery,
|
||||
Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), data.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.address.domain;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@@ -36,6 +35,7 @@ import javax.persistence.Table;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientAddress;
|
||||
|
||||
@Entity
|
||||
@@ -122,12 +122,12 @@ public class Address extends AbstractPersistableCustom {
|
||||
// this.updatedOn = updatedOn;
|
||||
|
||||
if (createdOn != null) {
|
||||
this.createdOn = Date.from(createdOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.createdOn = Date.from(createdOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
|
||||
}
|
||||
|
||||
if (updatedOn != null) {
|
||||
this.updatedOn = Date.from(updatedOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.updatedOn = Date.from(updatedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -363,7 +363,7 @@ public class Address extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public void setCreatedOn(LocalDate createdOn) {
|
||||
this.createdOn = Date.from(createdOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.createdOn = Date.from(createdOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public String getUpdatedBy() {
|
||||
@@ -379,7 +379,7 @@ public class Address extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public void setUpdatedOn(LocalDate updatedOn) {
|
||||
this.updatedOn = Date.from(updatedOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.updatedOn = Date.from(updatedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -22,12 +22,12 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValueRepository;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.address.domain.Address;
|
||||
import org.apache.fineract.portfolio.address.domain.AddressRepository;
|
||||
@@ -90,8 +90,8 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
|
||||
final CodeValue addressTypeIdObj = this.codeValueRepository.getOne(addressTypeId);
|
||||
|
||||
final Address add = Address.fromJson(command, stateIdobj, countryIdObj);
|
||||
add.setCreatedOn(LocalDate.now(ZoneId.systemDefault()));
|
||||
add.setUpdatedOn(LocalDate.now(ZoneId.systemDefault()));
|
||||
add.setCreatedOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
add.setUpdatedOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
this.addressRepository.save(add);
|
||||
final Long addressid = add.getId();
|
||||
final Address addobj = this.addressRepository.getOne(addressid);
|
||||
@@ -138,8 +138,8 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
|
||||
final CodeValue addressTypeIdObj = this.codeValueRepository.getOne(addressTypeId);
|
||||
|
||||
final Address add = Address.fromJsonObject(jsonObject, stateIdobj, countryIdObj);
|
||||
add.setCreatedOn(LocalDate.now(ZoneId.systemDefault()));
|
||||
add.setUpdatedOn(LocalDate.now(ZoneId.systemDefault()));
|
||||
add.setCreatedOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
add.setUpdatedOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
this.addressRepository.save(add);
|
||||
final Long addressid = add.getId();
|
||||
final Address addobj = this.addressRepository.getOne(addressid);
|
||||
@@ -268,7 +268,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
|
||||
}
|
||||
|
||||
if (is_address_update) {
|
||||
addobj.setUpdatedOn(LocalDate.now(ZoneId.systemDefault()));
|
||||
addobj.setUpdatedOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
this.addressRepository.save(addobj);
|
||||
|
||||
}
|
||||
|
||||
+12
-13
@@ -22,7 +22,6 @@ import static org.apache.fineract.portfolio.calendar.CalendarConstants.CALENDAR_
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -127,13 +126,13 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
this.location = StringUtils.defaultIfEmpty(location, null);
|
||||
|
||||
if (null != startDate) {
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.startDate = null;
|
||||
}
|
||||
|
||||
if (null != endDate) {
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.endDate = null;
|
||||
}
|
||||
@@ -190,7 +189,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
.integerValueSansLocaleOfParameterNamed(CalendarSupportedParameters.SECOND_REMINDER.getValue());
|
||||
final LocalDateTime time = command.localTimeValueOfParameterNamed(CalendarSupportedParameters.MEETING_TIME.getValue());
|
||||
if (time != null) {
|
||||
meetingtime = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
|
||||
meetingtime = Date.from(time.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
final String recurrence = Calendar.constructRecurrence(command, null);
|
||||
|
||||
@@ -217,7 +216,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
} else {
|
||||
|
||||
actualChanges.put(CalendarSupportedParameters.START_DATE.getValue(), newMeetingStartDate.toString());
|
||||
this.startDate = Date.from(newMeetingStartDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(newMeetingStartDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
|
||||
/*
|
||||
* If meeting start date is changed then there is possibilities of recurring day may change, so derive the
|
||||
@@ -293,7 +292,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
actualChanges.put(startDateParamName, valueAsInput);
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
this.startDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +304,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
this.endDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String durationParamName = CalendarSupportedParameters.DURATION.getValue();
|
||||
@@ -410,7 +409,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
actualChanges.put(CalendarSupportedParameters.MEETING_TIME.getValue(), newValue);
|
||||
LocalDateTime timeInLocalDateTimeFormat = command.localTimeValueOfParameterNamed(time);
|
||||
if (timeInLocalDateTimeFormat != null) {
|
||||
this.meetingtime = Date.from(timeInLocalDateTimeFormat.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.meetingtime = Date.from(timeInLocalDateTimeFormat.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -426,7 +425,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
if (calendarStartDate != null && this.startDate != null) {
|
||||
if (!calendarStartDate.equals(this.getStartDateLocalDate())) {
|
||||
actualChanges.put("startDate", calendarStartDate);
|
||||
this.startDate = Date.from(calendarStartDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(calendarStartDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +492,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
public LocalDate getStartDateLocalDate() {
|
||||
LocalDate startDateLocalDate = null;
|
||||
if (this.startDate != null) {
|
||||
startDateLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), ZoneId.systemDefault());
|
||||
startDateLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return startDateLocalDate;
|
||||
}
|
||||
@@ -501,7 +500,7 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
public LocalDate getEndDateLocalDate() {
|
||||
LocalDate endDateLocalDate = null;
|
||||
if (this.endDate != null) {
|
||||
endDateLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault());
|
||||
endDateLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endDateLocalDate;
|
||||
}
|
||||
@@ -664,8 +663,8 @@ public class Calendar extends AbstractAuditableCustom {
|
||||
final String newRecurrence = Calendar.constructRecurrence(frequencyType, interval, startDate.get(ChronoField.DAY_OF_WEEK), null);
|
||||
|
||||
this.recurrence = newRecurrence;
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public Set<CalendarHistory> getCalendarHistory() {
|
||||
|
||||
+3
-3
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.calendar.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -29,6 +28,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_calendar_history")
|
||||
@@ -104,7 +104,7 @@ public class CalendarHistory extends AbstractPersistableCustom {
|
||||
public LocalDate getStartDateLocalDate() {
|
||||
LocalDate startDateLocalDate = null;
|
||||
if (this.startDate != null) {
|
||||
startDateLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), ZoneId.systemDefault());
|
||||
startDateLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return startDateLocalDate;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class CalendarHistory extends AbstractPersistableCustom {
|
||||
public LocalDate getEndDateLocalDate() {
|
||||
LocalDate endDateLocalDate = null;
|
||||
if (this.endDate != null) {
|
||||
endDateLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault());
|
||||
endDateLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endDateLocalDate;
|
||||
}
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -435,7 +434,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
||||
final String sql = rm.schema() + " where c.calendar_id = ? and date(?) between c.start_date and c.end_date limit 1";
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, rm,
|
||||
new Object[] { calendarId, Date.from(compareDate.atStartOfDay(ZoneId.systemDefault()).toInstant()) });
|
||||
new Object[] { calendarId, Date.from(compareDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()) });
|
||||
} catch (final EmptyResultDataAccessException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+12
-8
@@ -23,7 +23,6 @@ import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
@@ -111,17 +110,19 @@ public final class CalendarUtils {
|
||||
}
|
||||
|
||||
private static LocalDate getNextRecurringDate(final Recur recur, final LocalDate seedDate, final LocalDate startDate) {
|
||||
final DateTime periodStart = new DateTime(java.util.Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final DateTime periodStart = new DateTime(
|
||||
java.util.Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
final Date seed = convertToiCal4JCompatibleDate(seedDate);
|
||||
final Date nextRecDate = recur.getNextDate(seed, periodStart);
|
||||
return nextRecDate == null ? null : ZonedDateTime.ofInstant(nextRecDate.toInstant(), ZoneId.systemDefault()).toLocalDate();
|
||||
return nextRecDate == null ? null
|
||||
: ZonedDateTime.ofInstant(nextRecDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDate();
|
||||
}
|
||||
|
||||
private static Date convertToiCal4JCompatibleDate(final LocalDate inputDate) {
|
||||
// Date format in iCal4J is hard coded
|
||||
Date formattedDate = null;
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final String seedDateStr = df.format(java.util.Date.from(inputDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String seedDateStr = df.format(java.util.Date.from(inputDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
try {
|
||||
formattedDate = new Date(seedDateStr, "yyyy-MM-dd");
|
||||
} catch (final ParseException e) {
|
||||
@@ -168,8 +169,10 @@ public final class CalendarUtils {
|
||||
return null;
|
||||
}
|
||||
final Date seed = convertToiCal4JCompatibleDate(seedDate);
|
||||
final DateTime periodStart = new DateTime(java.util.Date.from(periodStartDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final DateTime periodEnd = new DateTime(java.util.Date.from(periodEndDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final DateTime periodStart = new DateTime(
|
||||
java.util.Date.from(periodStartDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
final DateTime periodEnd = new DateTime(
|
||||
java.util.Date.from(periodEndDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
|
||||
final Value value = new Value(Value.DATE.getValue());
|
||||
final DateList recurringDates = recur.getDates(seed, periodStart, periodEnd, value, maxCount);
|
||||
@@ -185,7 +188,8 @@ public final class CalendarUtils {
|
||||
for (@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = dates.iterator(); iterator.hasNext();) {
|
||||
final Date date = (Date) iterator.next();
|
||||
recurringDates.add(adjustDate(LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()), seedDate, frequencyType));
|
||||
recurringDates
|
||||
.add(adjustDate(LocalDate.ofInstant(date.toInstant(), DateUtils.getDateTimeZoneOfTenant()), seedDate, frequencyType));
|
||||
}
|
||||
|
||||
if (isSkippMeetingOnFirstDay) {
|
||||
@@ -345,7 +349,7 @@ public final class CalendarUtils {
|
||||
|
||||
final Date endDate = recur.getUntil();
|
||||
if (endDate != null) {
|
||||
final LocalDate date = LocalDate.ofInstant(endDate.toInstant(), ZoneId.systemDefault());
|
||||
final LocalDate date = LocalDate.ofInstant(endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern("dd MMMM yy");
|
||||
final String formattedDate = date.format(fmt);
|
||||
humanReadable += ", until " + formattedDate;
|
||||
|
||||
+3
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.calendar.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -35,6 +34,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.calendar.CalendarConstants.CalendarSupportedParameters;
|
||||
import org.apache.fineract.portfolio.calendar.domain.Calendar;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarEntityType;
|
||||
@@ -281,7 +281,8 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
|
||||
presentMeetingDate = command.localDateValueOfParameterNamed(CalendarSupportedParameters.START_DATE.getValue());
|
||||
}
|
||||
if (null != newMeetingDate) {
|
||||
final Date endDate = Date.from(presentMeetingDate.minusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final Date endDate = Date
|
||||
.from(presentMeetingDate.minusDays(1).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
calendarHistory.updateEndDate(endDate);
|
||||
}
|
||||
this.calendarHistoryRepository.save(calendarHistory);
|
||||
|
||||
+2
-2
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.charge.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -41,6 +40,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.portfolio.charge.api.ChargesApiConstants;
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
@@ -558,7 +558,7 @@ public class Charge extends AbstractPersistableCustom {
|
||||
public MonthDay getFeeOnMonthDay() {
|
||||
MonthDay feeOnMonthDay = null;
|
||||
if (this.feeOnDay != null && this.feeOnMonth != null) {
|
||||
feeOnMonthDay = MonthDay.now(ZoneId.systemDefault()).withMonth(this.feeOnMonth).withDayOfMonth(this.feeOnDay);
|
||||
feeOnMonthDay = MonthDay.now(DateUtils.getDateTimeZoneOfTenant()).withMonth(this.feeOnMonth).withDayOfMonth(this.feeOnDay);
|
||||
}
|
||||
return feeOnMonthDay;
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,7 +22,6 @@ import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -31,6 +30,7 @@ import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformServi
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.entityaccess.domain.FineractEntityType;
|
||||
import org.apache.fineract.infrastructure.entityaccess.service.FineractEntityAccessUtil;
|
||||
@@ -343,7 +343,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
final Integer feeOnMonth = JdbcSupport.getInteger(rs, "feeOnMonth");
|
||||
final Integer feeOnDay = JdbcSupport.getInteger(rs, "feeOnDay");
|
||||
if (feeOnDay != null && feeOnMonth != null) {
|
||||
feeOnMonthDay = MonthDay.now(ZoneId.systemDefault()).withDayOfMonth(feeOnDay).withMonth(feeOnMonth);
|
||||
feeOnMonthDay = MonthDay.now(DateUtils.getDateTimeZoneOfTenant()).withDayOfMonth(feeOnDay).withMonth(feeOnMonth);
|
||||
}
|
||||
final BigDecimal minCap = rs.getBigDecimal("minCap");
|
||||
final BigDecimal maxCap = rs.getBigDecimal("maxCap");
|
||||
|
||||
+3
-3
@@ -30,7 +30,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -62,6 +61,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
@@ -462,7 +462,7 @@ public class ClientsApiResource {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(ClientApiConstants.CLIENT_RESOURCE_NAME);
|
||||
final Date transferDate = this.clientReadPlatformService.retrieveClientTransferProposalDate(clientId);
|
||||
return this.toApiJsonSerializer
|
||||
.serialize((transferDate != null ? LocalDate.ofInstant(transferDate.toInstant(), ZoneId.systemDefault()) : null));
|
||||
return this.toApiJsonSerializer.serialize(
|
||||
(transferDate != null ? LocalDate.ofInstant(transferDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()) : null));
|
||||
}
|
||||
}
|
||||
|
||||
+17
-18
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.client.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -267,7 +266,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
officeJoiningDate = activationDate;
|
||||
}
|
||||
|
||||
LocalDate submittedOnDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate submittedOnDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (active && submittedOnDate.isAfter(activationDate)) {
|
||||
submittedOnDate = activationDate;
|
||||
}
|
||||
@@ -298,7 +297,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
this.accountNumber = accountNo;
|
||||
}
|
||||
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.submittedBy = currentUser;
|
||||
|
||||
this.status = status.getValue();
|
||||
@@ -322,11 +321,11 @@ public final class Client extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
if (activationDate != null) {
|
||||
this.activationDate = Date.from(activationDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.activationDate = Date.from(activationDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.activatedBy = currentUser;
|
||||
}
|
||||
if (officeJoiningDate != null) {
|
||||
this.officeJoiningDate = Date.from(officeJoiningDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.officeJoiningDate = Date.from(officeJoiningDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
if (StringUtils.isNotBlank(firstname)) {
|
||||
this.firstname = firstname.trim();
|
||||
@@ -365,7 +364,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
this.gender = gender;
|
||||
}
|
||||
if (dateOfBirth != null) {
|
||||
this.dateOfBirth = Date.from(dateOfBirth.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dateOfBirth = Date.from(dateOfBirth.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
this.clientType = clientType;
|
||||
this.clientClassification = clientClassification;
|
||||
@@ -434,7 +433,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.activationDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.activationDate = Date.from(activationLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.activatedBy = currentUser;
|
||||
this.officeJoiningDate = this.activationDate;
|
||||
this.status = ClientStatus.ACTIVE.getValue();
|
||||
@@ -613,7 +612,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
actualChanges.put(ClientApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(ClientApiConstants.activationDateParamName);
|
||||
this.activationDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.activationDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.officeJoiningDate = this.activationDate;
|
||||
}
|
||||
|
||||
@@ -624,7 +623,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
actualChanges.put(ClientApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(ClientApiConstants.dateOfBirthParamName);
|
||||
this.dateOfBirth = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dateOfBirth = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(ClientApiConstants.submittedOnDateParamName, getSubmittedOnDate())) {
|
||||
@@ -634,7 +633,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
actualChanges.put(ClientApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(ClientApiConstants.submittedOnDateParamName);
|
||||
this.submittedOnDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
validateUpdate();
|
||||
@@ -747,13 +746,13 @@ public final class Client extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.activationDate != null) {
|
||||
activationLocalDate = LocalDate.ofInstant(this.activationDate.toInstant(), ZoneId.systemDefault());
|
||||
activationLocalDate = LocalDate.ofInstant(this.activationDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return activationLocalDate;
|
||||
}
|
||||
@@ -761,7 +760,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
public LocalDate getOfficeJoiningLocalDate() {
|
||||
LocalDate officeJoiningLocalDate = null;
|
||||
if (this.officeJoiningDate != null) {
|
||||
officeJoiningLocalDate = LocalDate.ofInstant(this.officeJoiningDate.toInstant(), ZoneId.systemDefault());
|
||||
officeJoiningLocalDate = LocalDate.ofInstant(this.officeJoiningDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return officeJoiningLocalDate;
|
||||
}
|
||||
@@ -953,19 +952,19 @@ public final class Client extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getRejectedDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.rejectionDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.rejectionDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getWithdrawalDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.withdrawalDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.withdrawalDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getReopenedDate() {
|
||||
return this.reopenedDate == null ? null : LocalDate.ofInstant(this.reopenedDate.toInstant(), ZoneId.systemDefault());
|
||||
return this.reopenedDate == null ? null : LocalDate.ofInstant(this.reopenedDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public CodeValue gender() {
|
||||
@@ -999,7 +998,7 @@ public final class Client extends AbstractPersistableCustom {
|
||||
public LocalDate dateOfBirthLocalDate() {
|
||||
LocalDate dateOfBirth = null;
|
||||
if (this.dateOfBirth != null) {
|
||||
dateOfBirth = LocalDate.ofInstant(this.dateOfBirth.toInstant(), ZoneId.systemDefault());
|
||||
dateOfBirth = LocalDate.ofInstant(this.dateOfBirth.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return dateOfBirth;
|
||||
}
|
||||
|
||||
+3
-3
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.client.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -32,6 +31,7 @@ import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.organisation.office.domain.OrganisationCurrency;
|
||||
@@ -115,7 +115,7 @@ public class ClientCharge extends AbstractPersistableCustom {
|
||||
this.charge = charge;
|
||||
this.penaltyCharge = charge.isPenalty();
|
||||
this.chargeTime = charge.getChargeTimeType();
|
||||
this.dueDate = (dueDate == null) ? null : Date.from(dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = (dueDate == null) ? null : Date.from(dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.chargeCalculation = charge.getChargeCalculation();
|
||||
|
||||
BigDecimal chargeAmount = charge.getAmount();
|
||||
@@ -221,7 +221,7 @@ public class ClientCharge extends AbstractPersistableCustom {
|
||||
public LocalDate getDueLocalDate() {
|
||||
LocalDate dueDate = null;
|
||||
if (this.dueDate != null) {
|
||||
dueDate = LocalDate.ofInstant(this.dueDate.toInstant(), ZoneId.systemDefault());
|
||||
dueDate = LocalDate.ofInstant(this.dueDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return dueDate;
|
||||
}
|
||||
|
||||
+4
-4
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.client.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -40,6 +39,7 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
|
||||
|
||||
@Entity
|
||||
@@ -98,7 +98,7 @@ public class ClientNonPerson extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
if (incorpValidityTill != null) {
|
||||
this.incorpValidityTill = Date.from(incorpValidityTill.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.incorpValidityTill = Date.from(incorpValidityTill.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(remarks)) {
|
||||
@@ -140,7 +140,7 @@ public class ClientNonPerson extends AbstractPersistableCustom {
|
||||
public LocalDate getIncorpValidityTillLocalDate() {
|
||||
LocalDate incorpValidityTillLocalDate = null;
|
||||
if (this.incorpValidityTill != null) {
|
||||
incorpValidityTillLocalDate = LocalDate.ofInstant(this.incorpValidityTill.toInstant(), ZoneId.systemDefault());
|
||||
incorpValidityTillLocalDate = LocalDate.ofInstant(this.incorpValidityTill.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return incorpValidityTillLocalDate;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public class ClientNonPerson extends AbstractPersistableCustom {
|
||||
actualChanges.put(ClientApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(ClientApiConstants.incorpValidityTillParamName);
|
||||
this.incorpValidityTill = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.incorpValidityTill = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInLongParameterNamed(ClientApiConstants.constitutionIdParamName, constitutionId())) {
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.client.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@@ -126,7 +125,7 @@ public class ClientTransaction extends AbstractPersistableCustom {
|
||||
this.office = office;
|
||||
this.paymentDetail = paymentDetail;
|
||||
this.typeOf = typeOf;
|
||||
this.dateOf = Date.from(transactionLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dateOf = Date.from(transactionLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.amount = amount.getAmount();
|
||||
this.reversed = reversed;
|
||||
this.externalId = externalId;
|
||||
@@ -228,7 +227,7 @@ public class ClientTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getTransactionDate() {
|
||||
return LocalDate.ofInstant(this.dateOf.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.dateOf.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-2
@@ -25,7 +25,6 @@ import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -230,7 +229,7 @@ public final class ClientFamilyMemberCommandFromApiJsonDeserializer {
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.extractLocalDateNamed("dateOfBirth", element) != null) {
|
||||
LocalDateTime currentDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
LocalDateTime currentDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
final LocalDate dateOfBirth = this.fromApiJsonHelper.extractLocalDateNamed("dateOfBirth", element);
|
||||
baseDataValidator.reset().parameter("dateOfBirth").value(dateOfBirth).validateDateBefore(currentDate.toLocalDate());
|
||||
|
||||
+3
-3
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.client.service;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -36,6 +35,7 @@ import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
@@ -169,8 +169,8 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
||||
final List<DatatableData> datatableTemplates = this.entityDatatableChecksReadService
|
||||
.retrieveTemplates(StatusEnum.CREATE.getCode().longValue(), EntityTables.CLIENT.getName(), null);
|
||||
|
||||
return ClientData.template(defaultOfficeId, LocalDate.now(ZoneId.systemDefault()), offices, staffOptions, null, genderOptions,
|
||||
savingsProductDatas, clientTypeOptions, clientClassificationOptions, clientNonPersonConstitutionOptions,
|
||||
return ClientData.template(defaultOfficeId, LocalDate.now(DateUtils.getDateTimeZoneOfTenant()), offices, staffOptions, null,
|
||||
genderOptions, savingsProductDatas, clientTypeOptions, clientClassificationOptions, clientNonPersonConstitutionOptions,
|
||||
clientNonPersonMainBusinessLineOptions, clientLegalFormOptions, familyMemberOptions,
|
||||
new ArrayList<AddressData>(Arrays.asList(address)), isAddressEnabled, datatableTemplates);
|
||||
}
|
||||
|
||||
+10
-9
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.client.service;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -46,6 +45,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.EntityTables;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.StatusEnum;
|
||||
import org.apache.fineract.infrastructure.dataqueries.service.EntityDatatableChecksWritePlatformService;
|
||||
@@ -735,8 +735,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
if (loanStatus.isOpen() || loanStatus.isPendingApproval() || loanStatus.isAwaitingDisbursal()) {
|
||||
final String errorMessage = "Client cannot be closed because of non-closed loans.";
|
||||
throw new InvalidClientStateTransitionException("close", "loan.non-closed", errorMessage);
|
||||
} else if (loanStatus.isClosed()
|
||||
&& loan.getClosedOnDate().after(Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant()))) {
|
||||
} else if (loanStatus.isClosed() && loan.getClosedOnDate()
|
||||
.after(Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()))) {
|
||||
final String errorMessage = "The client closureDate cannot be before the loan closedOnDate.";
|
||||
throw new InvalidClientStateTransitionException("close", "date.cannot.before.loan.closed.date", errorMessage,
|
||||
closureDate, loan.getClosedOnDate());
|
||||
@@ -754,7 +754,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
}
|
||||
}
|
||||
|
||||
client.close(currentUser, closureReason, Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
client.close(currentUser, closureReason, Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -848,7 +848,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
throw new InvalidClientStateTransitionException("rejection", "date.cannot.before.client.submitted.date", errorMessage,
|
||||
rejectionDate, client.getSubmittedOnDate());
|
||||
}
|
||||
client.reject(currentUser, rejectionReason, Date.from(rejectionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
client.reject(currentUser, rejectionReason, Date.from(rejectionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
this.businessEventNotifierService.notifyBusinessEventWasExecuted(BusinessEvents.CLIENTS_REJECT,
|
||||
constructEntityMap(BusinessEntity.CLIENT, client));
|
||||
@@ -880,7 +880,8 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
throw new InvalidClientStateTransitionException("withdrawal", "date.cannot.before.client.submitted.date", errorMessage,
|
||||
withdrawalDate, client.getSubmittedOnDate());
|
||||
}
|
||||
client.withdraw(currentUser, withdrawalReason, Date.from(withdrawalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
client.withdraw(currentUser, withdrawalReason,
|
||||
Date.from(withdrawalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -905,7 +906,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
throw new InvalidClientStateTransitionException("reactivation", "date.cannot.before.client.closed.date", errorMessage,
|
||||
reactivateDate, client.getClosureDate());
|
||||
}
|
||||
client.reActivate(currentUser, Date.from(reactivateDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
client.reActivate(currentUser, Date.from(reactivateDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
@@ -931,7 +932,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
undoRejectDate, client.getRejectedDate());
|
||||
}
|
||||
|
||||
client.reOpened(currentUser, Date.from(undoRejectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
client.reOpened(currentUser, Date.from(undoRejectDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
@@ -957,7 +958,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
throw new InvalidClientStateTransitionException("reopened", "date.cannot.before.client.withdrawal.date", errorMessage,
|
||||
undoWithdrawalDate, client.getWithdrawalDate());
|
||||
}
|
||||
client.reOpened(currentUser, Date.from(undoWithdrawalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
client.reOpened(currentUser, Date.from(undoWithdrawalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
this.clientRepository.saveAndFlush(client);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
|
||||
+6
-4
@@ -29,7 +29,6 @@ import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -41,6 +40,7 @@ import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDoma
|
||||
import org.apache.fineract.infrastructure.core.api.JsonQuery;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
@@ -319,7 +319,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
final Long calendarId = query.longValueOfParameterNamed(calendarIdParamName);
|
||||
final LocalDate transactionDate = query.localDateValueOfParameterNamed(transactionDateParamName);
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final String transactionDateStr = df.format(Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String transactionDateStr = df
|
||||
.format(Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
|
||||
final Calendar calendar = this.calendarRepositoryWrapper.findOneWithNotFoundDetection(calendarId);
|
||||
// check if transaction against calendar effective from date
|
||||
@@ -455,7 +456,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
|
||||
final LocalDate transactionDate = query.localDateValueOfParameterNamed(transactionDateParamName);
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final String dueDateStr = df.format(Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String dueDateStr = df.format(Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
|
||||
final JLGCollectionSheetFaltDataMapper mapper = new JLGCollectionSheetFaltDataMapper();
|
||||
|
||||
@@ -668,7 +669,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
|
||||
final LocalDate transactionDate = query.localDateValueOfParameterNamed(transactionDateParamName);
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final String transactionDateStr = df.format(Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String transactionDateStr = df
|
||||
.format(Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final String hierarchy = currentUser.getOffice().getHierarchy();
|
||||
|
||||
+5
-6
@@ -23,7 +23,6 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -112,8 +111,8 @@ public class FloatingRate extends AbstractPersistableCustom {
|
||||
final LocalDate currentDate = DateUtils.getLocalDateOfTenant();
|
||||
|
||||
return new FloatingRate(name, isBaseLendingRate, isActive, floatingRatePeriods, currentUser, currentUser,
|
||||
Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(currentDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
Date.from(currentDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
|
||||
private static List<FloatingRatePeriod> getRatePeriods(final AppUser currentUser, final JsonCommand command) {
|
||||
@@ -126,7 +125,7 @@ public class FloatingRate extends AbstractPersistableCustom {
|
||||
final JsonObject ratePeriodObject = ratePeriod.getAsJsonObject();
|
||||
final JsonParserHelper helper = new JsonParserHelper();
|
||||
final Date fromDate = Date.from(helper.extractLocalDateNamed("fromDate", ratePeriod, new HashSet<String>())
|
||||
.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
final BigDecimal interestRate = ratePeriodObject.get("interestRate").getAsBigDecimal();
|
||||
final boolean isDifferentialToBaseLendingRate = helper.parameterExists("isDifferentialToBaseLendingRate", ratePeriod)
|
||||
? ratePeriodObject.get("isDifferentialToBaseLendingRate").getAsBoolean()
|
||||
@@ -207,11 +206,11 @@ public class FloatingRate extends AbstractPersistableCustom {
|
||||
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||
if (this.floatingRatePeriods != null) {
|
||||
for (FloatingRatePeriod ratePeriod : this.floatingRatePeriods) {
|
||||
LocalDate fromDate = LocalDate.ofInstant(ratePeriod.getFromDate().toInstant(), ZoneId.systemDefault());
|
||||
LocalDate fromDate = LocalDate.ofInstant(ratePeriod.getFromDate().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
if (fromDate.isAfter(today)) {
|
||||
ratePeriod.setActive(false);
|
||||
ratePeriod.setModifiedBy(appUser);
|
||||
ratePeriod.setModifiedOn(Date.from(today.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
ratePeriod.setModifiedOn(Date.from(today.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-5
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.floatingrates.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
@@ -30,6 +29,7 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.floatingrates.data.FloatingRateDTO;
|
||||
import org.apache.fineract.portfolio.floatingrates.data.FloatingRatePeriodData;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
@@ -137,7 +137,7 @@ public class FloatingRatePeriod extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate fetchFromDate() {
|
||||
return LocalDate.ofInstant(this.fromDate.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.fromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public FloatingRatePeriodData toData(final FloatingRateDTO floatingRateDTO) {
|
||||
@@ -147,9 +147,10 @@ public class FloatingRatePeriod extends AbstractPersistableCustom {
|
||||
interest = interest.add(floatingRateDTO.fetchBaseRate(fetchFromDate()));
|
||||
}
|
||||
|
||||
final LocalDate fromDate = ZonedDateTime.ofInstant(getFromDate().toInstant(), ZoneId.systemDefault()).toLocalDate();
|
||||
final LocalDate createdOn = ZonedDateTime.ofInstant(getCreatedOn().toInstant(), ZoneId.systemDefault()).toLocalDate();
|
||||
final LocalDate modidiedOn = ZonedDateTime.ofInstant(getModifiedOn().toInstant(), ZoneId.systemDefault()).toLocalDate();
|
||||
final LocalDate fromDate = ZonedDateTime.ofInstant(getFromDate().toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDate();
|
||||
final LocalDate createdOn = ZonedDateTime.ofInstant(getCreatedOn().toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDate();
|
||||
final LocalDate modidiedOn = ZonedDateTime.ofInstant(getModifiedOn().toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
.toLocalDate();
|
||||
|
||||
return new FloatingRatePeriodData(getId(), fromDate, interest, isDifferentialToBaseLendingRate(), isActive(),
|
||||
getCreatedBy().getUsername(), createdOn, getModifiedBy().getUsername(), modidiedOn);
|
||||
|
||||
+7
-8
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.group.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@@ -209,7 +208,7 @@ public final class Group extends AbstractPersistableCustom {
|
||||
this.groupMembers.addAll(groupMembers);
|
||||
}
|
||||
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.submittedBy = currentUser;
|
||||
this.staffHistory = null;
|
||||
|
||||
@@ -241,7 +240,7 @@ public final class Group extends AbstractPersistableCustom {
|
||||
validateStatusNotEqualToActiveAndLogError(dataValidationErrors);
|
||||
if (dataValidationErrors.isEmpty()) {
|
||||
this.status = GroupingTypeStatus.ACTIVE.getValue();
|
||||
setActivationDate(Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), currentUser,
|
||||
setActivationDate(Date.from(activationLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), currentUser,
|
||||
dataValidationErrors);
|
||||
}
|
||||
|
||||
@@ -336,7 +335,7 @@ public final class Group extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
|
||||
if (newValue != null) {
|
||||
this.activationDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.activationDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +353,7 @@ public final class Group extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName);
|
||||
if (newValue != null) {
|
||||
this.submittedOnDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,13 +361,13 @@ public final class Group extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.activationDate != null) {
|
||||
activationLocalDate = LocalDate.ofInstant(this.activationDate.toInstant(), ZoneId.systemDefault());
|
||||
activationLocalDate = LocalDate.ofInstant(this.activationDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return activationLocalDate;
|
||||
}
|
||||
@@ -540,7 +539,7 @@ public final class Group extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
this.closureReason = closureReason;
|
||||
this.closureDate = Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closureDate = Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.status = GroupingTypeStatus.CLOSED.getValue();
|
||||
this.closedBy = currentUser;
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.portfolio.group.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.portfolio.group.exception.GroupNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -72,7 +72,7 @@ public class GroupRepositoryWrapper {
|
||||
public LocalDate retrieveSubmittedOndate(final Long groupId) {
|
||||
Date submittedOnDate = this.repository.retrieveGroupTypeSubmitteOndDate(groupId);
|
||||
if (submittedOnDate != null) {
|
||||
return LocalDate.ofInstant(submittedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+6
-5
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.group.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -29,6 +28,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
|
||||
@Entity
|
||||
@@ -52,7 +52,8 @@ public class StaffAssignmentHistory extends AbstractAuditableCustom {
|
||||
private Date endDate;
|
||||
|
||||
public static StaffAssignmentHistory createNew(final Group center, final Staff staff, final LocalDate startDate) {
|
||||
return new StaffAssignmentHistory(center, staff, Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), null);
|
||||
return new StaffAssignmentHistory(center, staff, Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
null);
|
||||
}
|
||||
|
||||
protected StaffAssignmentHistory() {
|
||||
@@ -71,11 +72,11 @@ public class StaffAssignmentHistory extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
public void updateStartDate(final LocalDate startDate) {
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public void updateEndDate(final LocalDate endDate) {
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public boolean matchesStartDateOf(final LocalDate matchingDate) {
|
||||
@@ -83,7 +84,7 @@ public class StaffAssignmentHistory extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return LocalDate.ofInstant(this.startDate.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public boolean isCurrentRecord() {
|
||||
|
||||
+5
-5
@@ -23,7 +23,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -42,6 +41,7 @@ import org.apache.fineract.infrastructure.core.data.PaginationParameters;
|
||||
import org.apache.fineract.infrastructure.core.data.PaginationParametersDataValidator;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
@@ -437,8 +437,8 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
// final boolean clientPendingApprovalAllowed =
|
||||
// this.configurationDomainService.isClientPendingApprovalAllowedEnabled();
|
||||
|
||||
return CenterData.template(officeIdDefaulted, accountNo, LocalDate.now(ZoneId.systemDefault()), officeOptions, staffOptions,
|
||||
groupMembersOptions, totalCollected, totalOverdue, totaldue, installmentDue);
|
||||
return CenterData.template(officeIdDefaulted, accountNo, LocalDate.now(DateUtils.getDateTimeZoneOfTenant()), officeOptions,
|
||||
staffOptions, groupMembersOptions, totalCollected, totalOverdue, totaldue, installmentDue);
|
||||
}
|
||||
|
||||
private Long defaultToUsersOfficeIfNull(final Long officeId) {
|
||||
@@ -514,7 +514,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
@Override
|
||||
public Collection<StaffCenterData> retriveAllCentersByMeetingDate(final Long officeId, final Date meetingDate, final Long staffId) {
|
||||
validateForGenerateCollectionSheet(staffId);
|
||||
LocalDate localDate = LocalDate.ofInstant(meetingDate.toInstant(), ZoneId.systemDefault());
|
||||
LocalDate localDate = LocalDate.ofInstant(meetingDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final CenterCalendarDataMapper centerCalendarMapper = new CenterCalendarDataMapper();
|
||||
String passeddate = formatter.format(localDate);
|
||||
String sql = centerCalendarMapper.schema();
|
||||
@@ -539,7 +539,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
||||
}
|
||||
for (CenterData centerData : centerDataArray) {
|
||||
if (centerData.getCollectionMeetingCalendar().isValidRecurringDate(
|
||||
LocalDate.ofInstant(meetingDate.toInstant(), ZoneId.systemDefault()), isSkipRepaymentOnFirstMonthEnabled,
|
||||
LocalDate.ofInstant(meetingDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), isSkipRepaymentOnFirstMonthEnabled,
|
||||
numberOfDays)) {
|
||||
if (staffCenterDataArray.size() <= 0) {
|
||||
Collection<CenterData> meetingFallCenter = new ArrayList<>();
|
||||
|
||||
+4
-4
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.group.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -44,6 +43,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.EntityTables;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.StatusEnum;
|
||||
import org.apache.fineract.infrastructure.dataqueries.service.EntityDatatableChecksWritePlatformService;
|
||||
@@ -187,7 +187,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
||||
final Set<Group> groupMembers = assembleSetOfChildGroups(officeId, command);
|
||||
|
||||
final boolean active = command.booleanPrimitiveValueOfParameterNamed(GroupingTypesApiConstants.activeParamName);
|
||||
LocalDate submittedOnDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate submittedOnDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
if (active && submittedOnDate.isAfter(activationDate)) {
|
||||
submittedOnDate = activationDate;
|
||||
}
|
||||
@@ -544,7 +544,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
||||
groupForUpdate.updateStaff(staff);
|
||||
|
||||
if (inheritStaffForClientAccounts) {
|
||||
LocalDate loanOfficerReassignmentDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate loanOfficerReassignmentDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
/*
|
||||
* update loan officer for client and update loan officer for clients loans and savings
|
||||
*/
|
||||
@@ -654,7 +654,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
||||
throw new InvalidGroupStateTransitionException(groupOrCenter.getGroupLevel().getLevelName(), "close", "loan.not.closed",
|
||||
errorMessage);
|
||||
} else if (loanStatus.isClosed()
|
||||
&& loan.getClosedOnDate().after(Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant()))) {
|
||||
&& loan.getClosedOnDate().after(Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()))) {
|
||||
final String errorMessage = groupOrCenter.getGroupLevel().getLevelName()
|
||||
+ "closureDate cannot be before the loan closedOnDate.";
|
||||
throw new InvalidGroupStateTransitionException(groupOrCenter.getGroupLevel().getLevelName(), "close",
|
||||
|
||||
+6
-7
@@ -27,7 +27,6 @@ import static org.apache.fineract.portfolio.interestratechart.InterestRateChartA
|
||||
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants.nameParamName;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
@@ -72,8 +71,8 @@ public class InterestRateChartFields {
|
||||
boolean isPrimaryGroupingByAmount) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = (toDate == null) ? null : Date.from(toDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.endDate = (toDate == null) ? null : Date.from(toDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.isPrimaryGroupingByAmount = isPrimaryGroupingByAmount;
|
||||
}
|
||||
|
||||
@@ -100,7 +99,7 @@ public class InterestRateChartFields {
|
||||
actualChanges.put(fromDateParamName, newValueAsString);
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
actualChanges.put(dateFormatParamName, dateFormat);
|
||||
this.fromDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(endDateParamName, getEndDateAsLocalDate())) {
|
||||
@@ -109,7 +108,7 @@ public class InterestRateChartFields {
|
||||
actualChanges.put(endDateParamName, newValueAsString);
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
actualChanges.put(dateFormatParamName, dateFormat);
|
||||
this.endDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (command.isChangeInBooleanParameterNamed(isPrimaryGroupingByAmountParamName, this.isPrimaryGroupingByAmount)) {
|
||||
@@ -138,7 +137,7 @@ public class InterestRateChartFields {
|
||||
public LocalDate getFromDateAsLocalDate() {
|
||||
LocalDate fromDate = null;
|
||||
if (this.fromDate != null) {
|
||||
fromDate = LocalDate.ofInstant(this.fromDate.toInstant(), ZoneId.systemDefault());
|
||||
fromDate = LocalDate.ofInstant(this.fromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return fromDate;
|
||||
}
|
||||
@@ -146,7 +145,7 @@ public class InterestRateChartFields {
|
||||
public LocalDate getEndDateAsLocalDate() {
|
||||
LocalDate endDate = null;
|
||||
if (this.endDate != null) {
|
||||
endDate = LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault());
|
||||
endDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endDate;
|
||||
}
|
||||
|
||||
+5
-3
@@ -20,8 +20,8 @@ package org.apache.fineract.portfolio.interestratechart.incentive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.interestratechart.domain.InterestIncentivesFields;
|
||||
|
||||
@@ -42,8 +42,10 @@ public class ClientAttributeIncentiveCalculation extends AttributeIncentiveCalcu
|
||||
break;
|
||||
case AGE:
|
||||
if (client.dateOfBirth() != null) {
|
||||
final LocalDate dobLacalDate = LocalDate.ofInstant(client.dateOfBirth().toInstant(), ZoneId.systemDefault());
|
||||
final int age = Math.toIntExact(ChronoUnit.YEARS.between(dobLacalDate, LocalDate.now(ZoneId.systemDefault())));
|
||||
final LocalDate dobLacalDate = LocalDate.ofInstant(client.dateOfBirth().toInstant(),
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
final int age = Math
|
||||
.toIntExact(ChronoUnit.YEARS.between(dobLacalDate, LocalDate.now(DateUtils.getDateTimeZoneOfTenant())));
|
||||
applyIncentive = applyIncentive(incentivesFields.conditionType(), Long.valueOf(incentivesFields.attributeValue()),
|
||||
Long.valueOf(age));
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.api;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -40,6 +39,7 @@ import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||
@@ -108,7 +108,7 @@ public class BulkLoansApiResource {
|
||||
}
|
||||
|
||||
final BulkTransferLoanOfficerData loanReassignmentData = BulkTransferLoanOfficerData.templateForBulk(officeId, loanOfficerId,
|
||||
LocalDate.now(ZoneId.systemDefault()), offices, loanOfficers, staffAccountSummaryCollectionData);
|
||||
LocalDate.now(DateUtils.getDateTimeZoneOfTenant()), offices, loanOfficers, staffAccountSummaryCollectionData);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, loanReassignmentData, this.responseDataParameters);
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -142,7 +141,7 @@ public class LoanTransactionsApiResource {
|
||||
transactionDate = DateUtils.getLocalDateOfTenant();
|
||||
} else {
|
||||
transactionDate = LocalDate.ofInstant(transactionDateParam.getDate("transactionDate", dateFormat, locale).toInstant(),
|
||||
ZoneId.systemDefault());
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
transactionData = this.loanReadPlatformService.retrieveLoanPrePaymentTemplate(loanId, transactionDate);
|
||||
} else if (is(commandParam, "refundbycash")) {
|
||||
@@ -155,7 +154,7 @@ public class LoanTransactionsApiResource {
|
||||
transactionDate = DateUtils.getLocalDateOfTenant();
|
||||
} else {
|
||||
transactionDate = LocalDate.ofInstant(transactionDateParam.getDate("transactionDate", dateFormat, locale).toInstant(),
|
||||
ZoneId.systemDefault());
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
transactionData = this.loanReadPlatformService.retrieveLoanForeclosureTemplate(loanId, transactionDate);
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.loanaccount.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class LoanScheduleAccrualData {
|
||||
}
|
||||
|
||||
public Date getDueDate() {
|
||||
return Date.from(this.dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return Date.from(this.dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public LocalDate getDueDateAsLocaldate() {
|
||||
|
||||
+93
-88
@@ -28,7 +28,6 @@ import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
@@ -1033,8 +1032,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
waiveLoanChargeTransaction.getAmount(getCurrency()).getAmount(), loanInstallmentNumber);
|
||||
waiveLoanChargeTransaction.getLoanChargesPaid().add(loanChargePaidBy);
|
||||
addLoanTransaction(waiveLoanChargeTransaction);
|
||||
if (this.repaymentScheduleDetail().isInterestRecalculationEnabled()
|
||||
&& (loanCharge.getDueLocalDate() == null || LocalDate.now(ZoneId.systemDefault()).isAfter(loanCharge.getDueLocalDate()))) {
|
||||
if (this.repaymentScheduleDetail().isInterestRecalculationEnabled() && (loanCharge.getDueLocalDate() == null
|
||||
|| LocalDate.now(DateUtils.getDateTimeZoneOfTenant()).isAfter(loanCharge.getDueLocalDate()))) {
|
||||
regenerateRepaymentScheduleWithInterestRecalculation(scheduleGeneratorDTO, currentUser);
|
||||
}
|
||||
// Waive of charges whose due date falls after latest 'repayment'
|
||||
@@ -1299,8 +1298,9 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public void updateLoanScheduleDependentDerivedFields() {
|
||||
this.expectedMaturityDate = Date.from(determineExpectedMaturityDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.actualMaturityDate = Date.from(determineExpectedMaturityDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.expectedMaturityDate = Date
|
||||
.from(determineExpectedMaturityDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.actualMaturityDate = Date.from(determineExpectedMaturityDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
private void updateLoanSummaryDerivedFields() {
|
||||
@@ -1449,7 +1449,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(submittedOnDateParamName);
|
||||
this.submittedOnDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String expectedDisbursementDateParamName = "expectedDisbursementDate";
|
||||
@@ -1461,7 +1461,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
actualChanges.put("recalculateLoanSchedule", true);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(expectedDisbursementDateParamName);
|
||||
this.expectedDisbursementDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.expectedDisbursementDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
removeFirstDisbursementTransaction();
|
||||
}
|
||||
|
||||
@@ -1475,7 +1475,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(repaymentsStartingFromDateParamName);
|
||||
if (newValue != null) {
|
||||
this.expectedFirstRepaymentOnDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.expectedFirstRepaymentOnDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.expectedFirstRepaymentOnDate = null;
|
||||
}
|
||||
@@ -1498,7 +1498,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(interestChargedFromDateParamName);
|
||||
if (newValue != null) {
|
||||
this.interestChargedFromDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.interestChargedFromDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.interestChargedFromDate = null;
|
||||
}
|
||||
@@ -1731,7 +1731,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
locale);
|
||||
if (date != null) {
|
||||
returnObject.put(LoanApiConstants.disbursementDateParameterName,
|
||||
Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(date.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1862,7 +1862,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
for (LoanTrancheCharge trancheCharge : trancheCharges) {
|
||||
Charge chargeDefinition = trancheCharge.getCharge();
|
||||
final LoanCharge loanCharge = LoanCharge.createNewWithoutLoan(chargeDefinition, principal, null, null, null,
|
||||
LocalDate.ofInstant(expectedDisbursementDate.toInstant(), ZoneId.systemDefault()), null, null);
|
||||
LocalDate.ofInstant(expectedDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null, null);
|
||||
loanCharge.update(this);
|
||||
LoanTrancheDisbursementCharge loanTrancheDisbursementCharge = new LoanTrancheDisbursementCharge(loanCharge,
|
||||
disbursementDetails);
|
||||
@@ -1975,10 +1975,10 @@ public class Loan extends AbstractPersistableCustom {
|
||||
this.externalId = externalId;
|
||||
this.termFrequency = loanApplicationTerms.getLoanTermFrequency();
|
||||
this.termPeriodFrequencyType = loanApplicationTerms.getLoanTermPeriodFrequencyType().getValue();
|
||||
this.submittedOnDate = Date.from(submittedOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = Date.from(submittedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.submittedBy = currentUser;
|
||||
this.expectedDisbursementDate = Date
|
||||
.from(loanApplicationTerms.getExpectedDisbursementDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
.from(loanApplicationTerms.getExpectedDisbursementDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.expectedFirstRepaymentOnDate = loanApplicationTerms.getRepaymentStartFromDate();
|
||||
this.interestChargedFromDate = loanApplicationTerms.getInterestChargedFromDate();
|
||||
|
||||
@@ -2065,9 +2065,9 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final Locale locale = new Locale(command.locale());
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
|
||||
this.rejectedOnDate = Date.from(rejectedOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.rejectedOnDate = Date.from(rejectedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.rejectedBy = currentUser;
|
||||
this.closedOnDate = Date.from(rejectedOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(rejectedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.closedBy = currentUser;
|
||||
|
||||
actualChanges.put("locale", command.locale());
|
||||
@@ -2114,9 +2114,9 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final Locale locale = new Locale(command.locale());
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
|
||||
this.withdrawnOnDate = Date.from(withdrawnOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.withdrawnOnDate = Date.from(withdrawnOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.withdrawnBy = currentUser;
|
||||
this.closedOnDate = Date.from(withdrawnOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(withdrawnOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.closedBy = currentUser;
|
||||
|
||||
actualChanges.put("locale", command.locale());
|
||||
@@ -2226,13 +2226,13 @@ public class Loan extends AbstractPersistableCustom {
|
||||
loanProduct.maxTrancheCount(), disbursementDetails.size());
|
||||
}
|
||||
}
|
||||
this.approvedOnDate = Date.from(approvedOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = Date.from(approvedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.approvedBy = currentUser;
|
||||
actualChanges.put("locale", command.locale());
|
||||
actualChanges.put("dateFormat", command.dateFormat());
|
||||
actualChanges.put("approvedOnDate", approvedOnDateChange);
|
||||
|
||||
final LocalDate submittalDate = LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
final LocalDate submittalDate = LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
if (approvedOn.isBefore(submittalDate)) {
|
||||
final String errorMessage = "The date on which a loan is approved cannot be before its submittal date: "
|
||||
+ submittalDate.toString();
|
||||
@@ -2241,7 +2241,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
if (expecteddisbursementDate != null) {
|
||||
this.expectedDisbursementDate = Date.from(expecteddisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.expectedDisbursementDate = Date
|
||||
.from(expecteddisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
actualChanges.put("expectedDisbursementDate", expectedDisbursementDate);
|
||||
|
||||
if (expecteddisbursementDate.isBefore(approvedOn)) {
|
||||
@@ -2348,7 +2349,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
validateDisbursementDateIsOnHoliday(holidayDetailDTO.isAllowTransactionsOnHoliday(), holidayDetailDTO.getHolidays());
|
||||
|
||||
if (this.repaymentScheduleDetail().isInterestRecalculationEnabled()
|
||||
&& (fetchRepaymentScheduleInstallment(1).getDueDate().isBefore(LocalDate.now(ZoneId.systemDefault()))
|
||||
&& (fetchRepaymentScheduleInstallment(1).getDueDate().isBefore(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()))
|
||||
|| isDisbursementMissed())) {
|
||||
regenerateRepaymentScheduleWithInterestRecalculation(scheduleGeneratorDTO, currentUser);
|
||||
}
|
||||
@@ -2399,9 +2400,10 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final boolean isSpecificToInstallment = false;
|
||||
final Boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled = scheduleGeneratorDTO
|
||||
.isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled();
|
||||
Date effectiveDateFrom = Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date effectiveDateFrom = Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
if (!isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled && actualDisbursementDate.equals(nextPossibleRepaymentDate)) {
|
||||
effectiveDateFrom = Date.from(nextPossibleRepaymentDate.plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
effectiveDateFrom = Date
|
||||
.from(nextPossibleRepaymentDate.plusDays(1).atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
LoanTermVariations loanVariationTerms = new LoanTermVariations(LoanTermVariationType.EMI_AMOUNT.getValue(),
|
||||
effectiveDateFrom, emiAmount, dateValue, isSpecificToInstallment, this, LoanStatus.ACTIVE.getValue());
|
||||
@@ -2414,7 +2416,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (rescheduledRepaymentDate != null && this.loanProduct.isMultiDisburseLoan()) {
|
||||
final boolean isSpecificToInstallment = false;
|
||||
LoanTermVariations loanVariationTerms = new LoanTermVariations(LoanTermVariationType.DUE_DATE.getValue(),
|
||||
Date.from(nextPossibleRepaymentDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), emiAmount,
|
||||
Date.from(nextPossibleRepaymentDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), emiAmount,
|
||||
rescheduledRepaymentDate, isSpecificToInstallment, this, LoanStatus.ACTIVE.getValue());
|
||||
this.loanTermVariations.add(loanVariationTerms);
|
||||
}
|
||||
@@ -2441,10 +2443,10 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (details != null) {
|
||||
lastDusburseDate = details.actualDisbursementDate();
|
||||
}
|
||||
if (Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()).before(lastDusburseDate)) {
|
||||
if (Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()).before(lastDusburseDate)) {
|
||||
final String errorMsg = "Loan can't be disbursed before " + lastDusburseDate;
|
||||
throw new LoanDisbursalException(errorMsg, "actualdisbursementdate.before.lastdusbursedate", lastDusburseDate,
|
||||
Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
isMultiTrancheDisburse = true;
|
||||
}
|
||||
@@ -2455,7 +2457,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
Money disburseAmount = this.loanRepaymentScheduleDetail.getPrincipal().zero();
|
||||
BigDecimal principalDisbursed = command.bigDecimalValueOfParameterNamed(LoanApiConstants.principalDisbursedParameterName);
|
||||
if (this.actualDisbursementDate == null) {
|
||||
this.actualDisbursementDate = Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.actualDisbursementDate = Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
BigDecimal diff = BigDecimal.ZERO;
|
||||
Collection<LoanDisbursementDetails> details = fetchUndisbursedDetail();
|
||||
@@ -2465,7 +2467,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
disburseAmount = disburseAmount.zero();
|
||||
for (LoanDisbursementDetails disbursementDetails : details) {
|
||||
disbursementDetails.updateActualDisbursementDate(
|
||||
Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
disburseAmount = disburseAmount.plus(disbursementDetails.principal());
|
||||
}
|
||||
}
|
||||
@@ -2481,7 +2483,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
} else {
|
||||
for (LoanDisbursementDetails disbursementDetails : details) {
|
||||
disbursementDetails.updateActualDisbursementDate(
|
||||
Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
disbursementDetails.updatePrincipal(principalDisbursed);
|
||||
}
|
||||
}
|
||||
@@ -2571,8 +2573,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
private boolean isDisbursementMissed() {
|
||||
boolean isDisbursementMissed = false;
|
||||
for (LoanDisbursementDetails disbursementDetail : this.disbursementDetails) {
|
||||
if (disbursementDetail.actualDisbursementDate() == null
|
||||
&& LocalDate.now(ZoneId.systemDefault()).isAfter(disbursementDetail.expectedDisbursementDateAsLocalDate())) {
|
||||
if (disbursementDetail.actualDisbursementDate() == null && LocalDate.now(DateUtils.getDateTimeZoneOfTenant())
|
||||
.isAfter(disbursementDetail.expectedDisbursementDateAsLocalDate())) {
|
||||
isDisbursementMissed = true;
|
||||
break;
|
||||
}
|
||||
@@ -2720,10 +2722,11 @@ public class Loan extends AbstractPersistableCustom {
|
||||
for (final LoanCharge charge : charges()) {
|
||||
Date actualDisbursementDate = getActualDisbursementDate(charge);
|
||||
if ((charge.getCharge().getChargeTimeType().equals(ChargeTimeType.DISBURSEMENT.getValue())
|
||||
&& disbursedOn.equals(LocalDate.ofInstant(actualDisbursementDate.toInstant(), ZoneId.systemDefault()))
|
||||
&& disbursedOn.equals(LocalDate.ofInstant(actualDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()))
|
||||
&& (actualDisbursementDate != null) && !charge.isWaived() && !charge.isFullyPaid())
|
||||
|| (charge.getCharge().getChargeTimeType().equals(ChargeTimeType.TRANCHE_DISBURSEMENT.getValue())
|
||||
&& disbursedOn.equals(LocalDate.ofInstant(actualDisbursementDate.toInstant(), ZoneId.systemDefault()))
|
||||
&& disbursedOn
|
||||
.equals(LocalDate.ofInstant(actualDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()))
|
||||
&& (actualDisbursementDate != null) && !charge.isWaived() && !charge.isFullyPaid())) {
|
||||
if (totalFeeChargesDueAtDisbursement.isGreaterThanZero() && !charge.getChargePaymentMode().isPaymentModeAccountTransfer()) {
|
||||
charge.markAsFullyPaid();
|
||||
@@ -2733,7 +2736,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
chargesPayment.getLoanChargesPaid().add(loanChargePaidBy);
|
||||
disbursentMoney = disbursentMoney.plus(charge.amount());
|
||||
}
|
||||
} else if (disbursedOn.equals(LocalDate.ofInstant(this.actualDisbursementDate.toInstant(), ZoneId.systemDefault()))) {
|
||||
} else if (disbursedOn
|
||||
.equals(LocalDate.ofInstant(this.actualDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
/**
|
||||
* create a Charge applied transaction if Up front Accrual, None or Cash based accounting is enabled
|
||||
**/
|
||||
@@ -2761,9 +2765,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (getExpectedFirstRepaymentOnDate() != null
|
||||
&& (disbursedOn.isAfter(this.fetchRepaymentScheduleInstallment(1).getDueDate())
|
||||
|| disbursedOn.isAfter(getExpectedFirstRepaymentOnDate()))
|
||||
&& Date.from(disbursedOn.atStartOfDay(ZoneId.systemDefault()).toInstant()).compareTo(this.actualDisbursementDate) == 0
|
||||
? Boolean.TRUE
|
||||
: Boolean.FALSE) {
|
||||
&& Date.from(disbursedOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())
|
||||
.compareTo(this.actualDisbursementDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
|
||||
final String errorMessage = "submittedOnDate cannot be after the loans expectedFirstRepaymentOnDate: "
|
||||
+ getExpectedFirstRepaymentOnDate().toString();
|
||||
throw new InvalidLoanStateTransitionException("disbursal", "cannot.be.after.expected.first.repayment.date", errorMessage,
|
||||
@@ -3262,8 +3265,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
LoanStatus.fromInt(this.loanStatus));
|
||||
this.loanStatus = statusEnum.getValue();
|
||||
|
||||
this.closedOnDate = Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.actualMaturityDate = Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.actualMaturityDate = Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else if (LoanStatus.fromInt(this.loanStatus).isOverpaid()) {
|
||||
final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_REPAYMENT_OR_WAIVER,
|
||||
LoanStatus.fromInt(this.loanStatus));
|
||||
@@ -3276,7 +3279,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (this.loanInterestRecalculationDetails != null && this.loanInterestRecalculationDetails.isCompoundingToBePostedAsTransaction()
|
||||
&& this.status().isClosedObligationsMet()) {
|
||||
Date closedDate = this.getClosedOnDate();
|
||||
LocalDate closedLocalDate = LocalDate.ofInstant(closedDate.toInstant(), ZoneId.systemDefault());
|
||||
LocalDate closedLocalDate = LocalDate.ofInstant(closedDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
reverseTransactionsOnOrAfter(retreiveListOfIncomePostingTransactions(), closedDate);
|
||||
reverseTransactionsOnOrAfter(retreiveListOfAccrualTransactions(), closedDate);
|
||||
HashMap<String, BigDecimal> cumulativeIncomeFromInstallments = new HashMap<>();
|
||||
@@ -3402,7 +3405,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate possibleNextRepaymentDate() {
|
||||
LocalDate earliestUnpaidInstallmentDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate earliestUnpaidInstallmentDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
|
||||
for (final LoanRepaymentScheduleInstallment installment : installments) {
|
||||
if (installment.isNotFullyPaidOff()) {
|
||||
@@ -3443,7 +3446,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
final Money totalInterestOutstanding = getTotalInterestOutstandingOnLoan();
|
||||
Money possibleInterestToWaive = totalInterestOutstanding.copy();
|
||||
LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate transactionDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
if (totalInterestOutstanding.isGreaterThanZero()) {
|
||||
// find earliest known instance of overdue interest and default to
|
||||
@@ -3452,8 +3455,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
for (final LoanRepaymentScheduleInstallment scheduledRepayment : installments) {
|
||||
|
||||
final Money outstandingForPeriod = scheduledRepayment.getInterestOutstanding(loanCurrency());
|
||||
if (scheduledRepayment.isOverdueOn(LocalDate.now(ZoneId.systemDefault())) && scheduledRepayment.isNotFullyPaidOff()
|
||||
&& outstandingForPeriod.isGreaterThanZero()) {
|
||||
if (scheduledRepayment.isOverdueOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()))
|
||||
&& scheduledRepayment.isNotFullyPaidOff() && outstandingForPeriod.isGreaterThanZero()) {
|
||||
transactionDate = scheduledRepayment.getDueDate();
|
||||
possibleInterestToWaive = outstandingForPeriod;
|
||||
break;
|
||||
@@ -3614,8 +3617,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final LocalDate writtenOffOnLocalDate = command.localDateValueOfParameterNamed("transactionDate");
|
||||
final String txnExternalId = command.stringValueOfParameterNamedAllowingNull("externalId");
|
||||
|
||||
this.closedOnDate = Date.from(writtenOffOnLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.writtenOffOnDate = Date.from(writtenOffOnLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(writtenOffOnLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.writtenOffOnDate = Date.from(writtenOffOnLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.closedBy = currentUser;
|
||||
changes.put("closedOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
changes.put("writtenOffOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
@@ -3702,7 +3705,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final LocalDate closureDate = command.localDateValueOfParameterNamed("transactionDate");
|
||||
final String txnExternalId = command.stringValueOfParameterNamedAllowingNull("externalId");
|
||||
|
||||
this.closedOnDate = Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
changes.put("closedOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
|
||||
validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.REPAID_IN_FULL, closureDate);
|
||||
@@ -3733,7 +3736,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
this.loanStatus = statusEnum.getValue();
|
||||
changes.put("status", LoanEnumerations.status(this.loanStatus));
|
||||
}
|
||||
this.closedOnDate = Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
loanTransaction = LoanTransaction.writeoff(this, getOffice(), closureDate, txnExternalId,
|
||||
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||
final boolean isLastTransaction = isChronologicallyLatestTransaction(loanTransaction, getLoanTransactions());
|
||||
@@ -3767,7 +3770,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
this.loanStatus = statusEnum.getValue();
|
||||
changes.put("status", LoanEnumerations.status(this.loanStatus));
|
||||
}
|
||||
this.closedOnDate = Date.from(closureDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(closureDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else if (totalLoanOverpayment.isGreaterThanZero()) {
|
||||
final String errorMessage = "The loan is marked as 'Overpaid' and cannot be moved to 'Closed (obligations met).";
|
||||
throw new InvalidLoanStateTransitionException("close", "loan.is.overpaid", errorMessage, totalLoanOverpayment.toString());
|
||||
@@ -3796,12 +3799,13 @@ public class Loan extends AbstractPersistableCustom {
|
||||
changes.put("status", LoanEnumerations.status(this.loanStatus));
|
||||
}
|
||||
|
||||
this.closedOnDate = Date.from(rescheduledOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.rescheduledOnDate = Date.from(rescheduledOn.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closedOnDate = Date.from(rescheduledOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.rescheduledOnDate = Date.from(rescheduledOn.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
changes.put("closedOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
changes.put("rescheduledOnDate", command.stringValueOfParameterNamed("transactionDate"));
|
||||
|
||||
final LocalDate rescheduledOnLocalDate = LocalDate.ofInstant(this.rescheduledOnDate.toInstant(), ZoneId.systemDefault());
|
||||
final LocalDate rescheduledOnLocalDate = LocalDate.ofInstant(this.rescheduledOnDate.toInstant(),
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
if (rescheduledOnLocalDate.isBefore(getDisbursementDate())) {
|
||||
final String errorMessage = "The date on which a loan is rescheduled cannot be before the loan disbursement date: "
|
||||
+ getDisbursementDate().toString();
|
||||
@@ -3901,17 +3905,17 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
public boolean isSubmittedOnDateAfter(final LocalDate compareDate) {
|
||||
return this.submittedOnDate == null ? false
|
||||
: LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()).isAfter(compareDate);
|
||||
: LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).isAfter(compareDate);
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public LocalDate getApprovedOnDate() {
|
||||
LocalDate date = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
date = LocalDate.ofInstant(this.approvedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
date = LocalDate.ofInstant(this.approvedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return date;
|
||||
}
|
||||
@@ -3919,7 +3923,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getExpectedDisbursedOnLocalDate() {
|
||||
LocalDate expectedDisbursementDate = null;
|
||||
if (this.expectedDisbursementDate != null) {
|
||||
expectedDisbursementDate = LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), ZoneId.systemDefault());
|
||||
expectedDisbursementDate = LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return expectedDisbursementDate;
|
||||
}
|
||||
@@ -3927,7 +3931,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getDisbursementDate() {
|
||||
LocalDate disbursementDate = getExpectedDisbursedOnLocalDate();
|
||||
if (this.actualDisbursementDate != null) {
|
||||
disbursementDate = LocalDate.ofInstant(this.actualDisbursementDate.toInstant(), ZoneId.systemDefault());
|
||||
disbursementDate = LocalDate.ofInstant(this.actualDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return disbursementDate;
|
||||
}
|
||||
@@ -3939,7 +3943,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getWrittenOffDate() {
|
||||
LocalDate writtenOffDate = null;
|
||||
if (this.writtenOffOnDate != null) {
|
||||
writtenOffDate = LocalDate.ofInstant(this.writtenOffOnDate.toInstant(), ZoneId.systemDefault());
|
||||
writtenOffDate = LocalDate.ofInstant(this.writtenOffOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return writtenOffDate;
|
||||
}
|
||||
@@ -3948,14 +3952,14 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
LocalDate expectedDisbursementDate = null;
|
||||
if (this.expectedDisbursementDate != null) {
|
||||
expectedDisbursementDate = LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), ZoneId.systemDefault());
|
||||
expectedDisbursementDate = LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
Collection<LoanDisbursementDetails> details = fetchUndisbursedDetail();
|
||||
if (!details.isEmpty()) {
|
||||
for (LoanDisbursementDetails disbursementDetails : details) {
|
||||
expectedDisbursementDate = LocalDate.ofInstant(disbursementDetails.expectedDisbursementDate().toInstant(),
|
||||
ZoneId.systemDefault());
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
}
|
||||
return expectedDisbursementDate;
|
||||
@@ -3980,7 +3984,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getExpectedFirstRepaymentOnDate() {
|
||||
LocalDate firstRepaymentDate = null;
|
||||
if (this.expectedFirstRepaymentOnDate != null) {
|
||||
firstRepaymentDate = LocalDate.ofInstant(this.expectedFirstRepaymentOnDate.toInstant(), ZoneId.systemDefault());
|
||||
firstRepaymentDate = LocalDate.ofInstant(this.expectedFirstRepaymentOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return firstRepaymentDate;
|
||||
}
|
||||
@@ -3994,8 +3998,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
isRegenerationRequired = true;
|
||||
}
|
||||
}
|
||||
return !LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), ZoneId.systemDefault()).isEqual(actualDisbursedOnDate)
|
||||
|| isRegenerationRequired;
|
||||
return !LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
.isEqual(actualDisbursedOnDate) || isRegenerationRequired;
|
||||
}
|
||||
|
||||
private boolean isRepaymentScheduleRegenerationRequiredForDisbursement(final LocalDate actualDisbursementDate) {
|
||||
@@ -4043,7 +4047,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
for (final LoanRepaymentScheduleInstallment scheduledRepayment : installments) {
|
||||
|
||||
final Money interestOutstandingForPeriod = scheduledRepayment.getInterestOutstanding(loanCurrency());
|
||||
if (scheduledRepayment.isOverdueOn(LocalDate.now(ZoneId.systemDefault()))) {
|
||||
if (scheduledRepayment.isOverdueOn(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
cumulativeInterestOverdue = cumulativeInterestOverdue.plus(interestOutstandingForPeriod);
|
||||
}
|
||||
}
|
||||
@@ -4074,7 +4078,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getInterestChargedFromDate() {
|
||||
LocalDate interestChargedFrom = null;
|
||||
if (this.interestChargedFromDate != null) {
|
||||
interestChargedFrom = LocalDate.ofInstant(this.interestChargedFromDate.toInstant(), ZoneId.systemDefault());
|
||||
interestChargedFrom = LocalDate.ofInstant(this.interestChargedFromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return interestChargedFrom;
|
||||
}
|
||||
@@ -4421,7 +4425,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
}
|
||||
if (latestRepaymentDate != null) {
|
||||
this.expectedMaturityDate = Date.from(latestRepaymentDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.expectedMaturityDate = Date.from(latestRepaymentDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4475,7 +4479,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
}
|
||||
if (latestRepaymentDate != null) {
|
||||
this.expectedMaturityDate = Date.from(latestRepaymentDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.expectedMaturityDate = Date.from(latestRepaymentDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5021,7 +5025,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
final LocalDate expectedDisbursementDate = command
|
||||
.localDateValueOfParameterNamed(LoanApiConstants.updatedDisbursementDateParameterName);
|
||||
disbursementDetails.updateExpectedDisbursementDateAndAmount(
|
||||
Date.from(expectedDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), principal);
|
||||
Date.from(expectedDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), principal);
|
||||
actualChanges.put(LoanApiConstants.disbursementDateParameterName,
|
||||
command.stringValueOfParameterNamed(LoanApiConstants.disbursementDateParameterName));
|
||||
actualChanges.put(LoanApiConstants.disbursementIdParameterName,
|
||||
@@ -5060,7 +5064,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
public BigDecimal retriveLastEmiAmount() {
|
||||
BigDecimal emiAmount = this.fixedEmiAmount;
|
||||
Date startDate = Date.from(this.getDisbursementDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date startDate = Date.from(this.getDisbursementDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
for (LoanTermVariations loanTermVariations : this.loanTermVariations) {
|
||||
if (loanTermVariations.getTermType().isEMIAmountVariation() && !startDate.after(loanTermVariations.getTermApplicableFrom())) {
|
||||
startDate = loanTermVariations.getTermApplicableFrom();
|
||||
@@ -5111,7 +5115,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getExpectedMaturityDate() {
|
||||
LocalDate expectedMaturityDate = null;
|
||||
if (this.expectedMaturityDate != null) {
|
||||
expectedMaturityDate = LocalDate.ofInstant(this.expectedMaturityDate.toInstant(), ZoneId.systemDefault());
|
||||
expectedMaturityDate = LocalDate.ofInstant(this.expectedMaturityDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return expectedMaturityDate;
|
||||
}
|
||||
@@ -5119,7 +5123,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public LocalDate getMaturityDate() {
|
||||
LocalDate maturityDate = getExpectedMaturityDate();
|
||||
if (this.actualMaturityDate != null) {
|
||||
maturityDate = LocalDate.ofInstant(this.actualMaturityDate.toInstant(), ZoneId.systemDefault());
|
||||
maturityDate = LocalDate.ofInstant(this.actualMaturityDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return maturityDate;
|
||||
}
|
||||
@@ -5252,7 +5256,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
private void reverseTransactionsOnOrAfter(List<LoanTransaction> transactions, Date date) {
|
||||
LocalDate refDate = LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault());
|
||||
LocalDate refDate = LocalDate.ofInstant(date.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
for (LoanTransaction loanTransaction : transactions) {
|
||||
if (!loanTransaction.getTransactionDate().isBefore(refDate)) {
|
||||
loanTransaction.reverse();
|
||||
@@ -5286,13 +5290,13 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
if (existingIncomeTransaction == null) {
|
||||
LoanTransaction transaction = LoanTransaction.incomePosting(this, this.getOffice(),
|
||||
Date.from(compoundingDetail.getEffectiveDate().atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(compoundingDetail.getEffectiveDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
compoundingDetail.getAmount(), interest, fee, penalties, currentUser);
|
||||
addLoanTransaction(transaction);
|
||||
} else if (existingIncomeTransaction.getAmount(getCurrency()).getAmount().compareTo(compoundingDetail.getAmount()) != 0) {
|
||||
existingIncomeTransaction.reverse();
|
||||
LoanTransaction transaction = LoanTransaction.incomePosting(this, this.getOffice(),
|
||||
Date.from(compoundingDetail.getEffectiveDate().atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(compoundingDetail.getEffectiveDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
compoundingDetail.getAmount(), interest, fee, penalties, currentUser);
|
||||
addLoanTransaction(transaction);
|
||||
}
|
||||
@@ -5534,15 +5538,15 @@ public class Loan extends AbstractPersistableCustom {
|
||||
feeCharges = feeCharges.plus(scheduledRepayment.getFeeChargesOutstanding(loanCurrency()));
|
||||
penaltyCharges = penaltyCharges.plus(scheduledRepayment.getPenaltyChargesOutstanding(loanCurrency()));
|
||||
}
|
||||
return new LoanRepaymentScheduleInstallment(null, 0, LocalDate.now(ZoneId.systemDefault()), LocalDate.now(ZoneId.systemDefault()),
|
||||
totalPrincipal.getAmount(), totalInterest.getAmount(), feeCharges.getAmount(), penaltyCharges.getAmount(), false,
|
||||
compoundingDetails);
|
||||
return new LoanRepaymentScheduleInstallment(null, 0, LocalDate.now(DateUtils.getDateTimeZoneOfTenant()),
|
||||
LocalDate.now(DateUtils.getDateTimeZoneOfTenant()), totalPrincipal.getAmount(), totalInterest.getAmount(),
|
||||
feeCharges.getAmount(), penaltyCharges.getAmount(), false, compoundingDetails);
|
||||
}
|
||||
|
||||
public LocalDate getAccruedTill() {
|
||||
LocalDate accruedTill = null;
|
||||
if (this.accruedTill != null) {
|
||||
accruedTill = LocalDate.ofInstant(this.accruedTill.toInstant(), ZoneId.systemDefault());
|
||||
accruedTill = LocalDate.ofInstant(this.accruedTill.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return accruedTill;
|
||||
}
|
||||
@@ -5552,7 +5556,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if (this.interestRecalculatedOn == null) {
|
||||
interestRecalculatedOn = getDisbursementDate();
|
||||
} else {
|
||||
interestRecalculatedOn = LocalDate.ofInstant(this.interestRecalculatedOn.toInstant(), ZoneId.systemDefault());
|
||||
interestRecalculatedOn = LocalDate.ofInstant(this.interestRecalculatedOn.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return interestRecalculatedOn;
|
||||
}
|
||||
@@ -5660,12 +5664,12 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
if (loanDisbursementDetails.expectedDisbursementDate() != null) {
|
||||
expectedDisbursementDate = LocalDate.ofInstant(loanDisbursementDetails.expectedDisbursementDate().toInstant(),
|
||||
ZoneId.systemDefault());
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
if (loanDisbursementDetails.actualDisbursementDate() != null) {
|
||||
actualDisbursementDate = LocalDate.ofInstant(loanDisbursementDetails.actualDisbursementDate().toInstant(),
|
||||
ZoneId.systemDefault());
|
||||
DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
BigDecimal waivedChargeAmount = null;
|
||||
disbursementData.add(new DisbursementData(loanDisbursementDetails.getId(), expectedDisbursementDate, actualDisbursementDate,
|
||||
@@ -5813,7 +5817,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
public void updateRescheduledOnDate(LocalDate rescheduledOnDate) {
|
||||
|
||||
if (rescheduledOnDate != null) {
|
||||
this.rescheduledOnDate = Date.from(rescheduledOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.rescheduledOnDate = Date.from(rescheduledOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5982,7 +5986,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
public LocalDate possibleNextRefundDate() {
|
||||
|
||||
final LocalDate now = LocalDate.now(ZoneId.systemDefault());
|
||||
final LocalDate now = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
|
||||
LocalDate lastTransactionDate = null;
|
||||
for (final LoanTransaction transaction : this.loanTransactions) {
|
||||
@@ -6046,11 +6050,11 @@ public class Loan extends AbstractPersistableCustom {
|
||||
if ((loanTermVariations.getTermType().isDueDateVariation()
|
||||
&& loanTermVariations.fetchDateValue().isAfter(actualDisbursementDate))
|
||||
|| (loanTermVariations.getTermType().isEMIAmountVariation() && loanTermVariations.getTermApplicableFrom()
|
||||
.compareTo(Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant())) == 0
|
||||
.compareTo(Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())) == 0
|
||||
? Boolean.TRUE
|
||||
: Boolean.FALSE)
|
||||
|| loanTermVariations.getTermApplicableFrom()
|
||||
.after(Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()))) {
|
||||
.after(Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@@ -6090,12 +6094,13 @@ public class Loan extends AbstractPersistableCustom {
|
||||
charge.setActive(false);
|
||||
} else if (charge.isTrancheDisbursementCharge() && actualDisbursementDate.equals(LocalDate.ofInstant(
|
||||
charge.getTrancheDisbursementCharge().getloanDisbursementDetails().actualDisbursementDate().toInstant(),
|
||||
ZoneId.systemDefault()))) {
|
||||
DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
charge.resetToOriginal(loanCurrency());
|
||||
}
|
||||
}
|
||||
for (final LoanDisbursementDetails details : this.disbursementDetails) {
|
||||
if (actualDisbursementDate.equals(LocalDate.ofInstant(details.actualDisbursementDate().toInstant(), ZoneId.systemDefault()))) {
|
||||
if (actualDisbursementDate
|
||||
.equals(LocalDate.ofInstant(details.actualDisbursementDate().toInstant(), DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
this.loanRepaymentScheduleDetail.setPrincipal(getDisbursedAmount().subtract(details.principal()));
|
||||
details.updateActualDisbursementDate(null);
|
||||
}
|
||||
@@ -6158,7 +6163,7 @@ public class Loan extends AbstractPersistableCustom {
|
||||
*/
|
||||
public LocalDate getNextPossibleRepaymentDateForRescheduling() {
|
||||
List<LoanDisbursementDetails> loanDisbursementDetails = this.disbursementDetails;
|
||||
LocalDate nextRepaymentDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate nextRepaymentDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
for (LoanDisbursementDetails loanDisbursementDetail : loanDisbursementDetails) {
|
||||
if (loanDisbursementDetail.actualDisbursementDate() == null) {
|
||||
List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
|
||||
|
||||
+9
-7
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -320,7 +319,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
} else {
|
||||
final boolean allowTransactionsOnHoliday = this.configurationDomainService.allowTransactionsOnHolidayEnabled();
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(),
|
||||
Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), HolidayStatusType.ACTIVE.getValue());
|
||||
Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
final boolean allowTransactionsOnNonWorkingDay = this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled();
|
||||
final boolean isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
|
||||
@@ -400,7 +400,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
txnExternalId, DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||
final boolean allowTransactionsOnHoliday = this.configurationDomainService.allowTransactionsOnHolidayEnabled();
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(),
|
||||
Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), HolidayStatusType.ACTIVE.getValue());
|
||||
Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
final boolean allowTransactionsOnNonWorkingDay = this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled();
|
||||
|
||||
@@ -507,8 +508,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
if (installment.getDueDate().isAfter(loan.getMaturityDate())) {
|
||||
accruedTill = DateUtils.getLocalDateOfTenant();
|
||||
}
|
||||
if (!isOrganisationDateEnabled
|
||||
|| LocalDate.ofInstant(organisationStartDate.toInstant(), ZoneId.systemDefault()).isBefore(installment.getDueDate())) {
|
||||
if (!isOrganisationDateEnabled || LocalDate.ofInstant(organisationStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
.isBefore(installment.getDueDate())) {
|
||||
generateLoanScheduleAccrualData(accruedTill, loanScheduleAccrualDatas, loanId, officeId, accrualStartDate,
|
||||
repaymentFrequency, repayEvery, interestCalculatedFrom, loanProductId, currency, currencyData, loanCharges,
|
||||
installment);
|
||||
@@ -593,7 +594,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
transactionDate, txnExternalId, DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||
final boolean allowTransactionsOnHoliday = this.configurationDomainService.allowTransactionsOnHolidayEnabled();
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(),
|
||||
Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), HolidayStatusType.ACTIVE.getValue());
|
||||
Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
final boolean allowTransactionsOnNonWorkingDay = this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled();
|
||||
|
||||
@@ -681,7 +683,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
payment = LoanTransaction.repayment(loan.getOffice(), payPrincipal.plus(interestPayable).plus(feePayable).plus(penaltyPayable),
|
||||
paymentDetail, foreClosureDate, externalId, currentDateTime, appUser);
|
||||
createdDate = createdDate.plusSeconds(1);
|
||||
payment.updateCreatedDate(Date.from(createdDate.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
payment.updateCreatedDate(Date.from(createdDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
payment.updateLoan(loan);
|
||||
newTransactions.add(payment);
|
||||
}
|
||||
|
||||
+6
-6
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -44,6 +43,7 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
|
||||
@@ -194,7 +194,7 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
amountPercentageAppliedTo = BigDecimal.ZERO;
|
||||
for (final LoanDisbursementDetails loanDisbursementDetails : loan.getDisbursementDetails()) {
|
||||
if (!loanDisbursementDetails.expectedDisbursementDate()
|
||||
.after(Date.from(dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant()))) {
|
||||
.after(Date.from(dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()))) {
|
||||
amountPercentageAppliedTo = amountPercentageAppliedTo.add(loanDisbursementDetails.principal());
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
chargeDefinition.getName());
|
||||
}
|
||||
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.dueDate = null;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
public void update(final BigDecimal amount, final LocalDate dueDate, final BigDecimal loanPrincipal, Integer numberOfRepayments,
|
||||
BigDecimal loanCharge) {
|
||||
if (dueDate != null) {
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (amount != null) {
|
||||
@@ -472,7 +472,7 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(dueDateParamName);
|
||||
this.dueDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = Date.from(newValue.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final String amountParamName = "amount";
|
||||
@@ -580,7 +580,7 @@ public class LoanCharge extends AbstractPersistableCustom {
|
||||
public LocalDate getDueLocalDate() {
|
||||
LocalDate dueDate = null;
|
||||
if (this.dueDate != null) {
|
||||
dueDate = LocalDate.ofInstant(this.dueDate.toInstant(), ZoneId.systemDefault());
|
||||
dueDate = LocalDate.ofInstant(this.dueDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return dueDate;
|
||||
}
|
||||
|
||||
+3
-3
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import javax.persistence.Column;
|
||||
@@ -31,6 +30,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.DisbursementData;
|
||||
|
||||
@Entity
|
||||
@@ -98,7 +98,7 @@ public class LoanDisbursementDetails extends AbstractPersistableCustom {
|
||||
public LocalDate expectedDisbursementDateAsLocalDate() {
|
||||
LocalDate expectedDisburseDate = null;
|
||||
if (this.expectedDisbursementDate != null) {
|
||||
expectedDisburseDate = LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), ZoneId.systemDefault());
|
||||
expectedDisburseDate = LocalDate.ofInstant(this.expectedDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return expectedDisburseDate;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class LoanDisbursementDetails extends AbstractPersistableCustom {
|
||||
LocalDate expectedDisburseDate = expectedDisbursementDateAsLocalDate();
|
||||
LocalDate actualDisburseDate = null;
|
||||
if (this.actualDisbursementDate != null) {
|
||||
actualDisburseDate = LocalDate.ofInstant(this.actualDisbursementDate.toInstant(), ZoneId.systemDefault());
|
||||
actualDisburseDate = LocalDate.ofInstant(this.actualDisbursementDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
BigDecimal waivedChargeAmount = null;
|
||||
return new DisbursementData(getId(), expectedDisburseDate, actualDisburseDate, this.principal, null, null, waivedChargeAmount);
|
||||
|
||||
+3
-3
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -28,6 +27,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_loan_interest_recalculation_additional_details")
|
||||
@@ -46,13 +46,13 @@ public class LoanInterestRecalcualtionAdditionalDetails extends AbstractPersista
|
||||
|
||||
public LoanInterestRecalcualtionAdditionalDetails(final LocalDate effectiveDate, final BigDecimal amount) {
|
||||
if (effectiveDate != null) {
|
||||
this.effectiveDate = Date.from(effectiveDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.effectiveDate = Date.from(effectiveDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public LocalDate getEffectiveDate() {
|
||||
return LocalDate.ofInstant(this.effectiveDate.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.effectiveDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
|
||||
+9
-8
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -30,6 +29,7 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
|
||||
@Entity
|
||||
@@ -53,8 +53,8 @@ public class LoanOfficerAssignmentHistory extends AbstractAuditableCustom {
|
||||
private Date endDate;
|
||||
|
||||
public static LoanOfficerAssignmentHistory createNew(final Loan loan, final Staff loanOfficer, final LocalDate startDate) {
|
||||
return new LoanOfficerAssignmentHistory(loan, loanOfficer, Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
null);
|
||||
return new LoanOfficerAssignmentHistory(loan, loanOfficer,
|
||||
Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), null);
|
||||
}
|
||||
|
||||
protected LoanOfficerAssignmentHistory() {
|
||||
@@ -73,11 +73,11 @@ public class LoanOfficerAssignmentHistory extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
public void updateStartDate(final LocalDate startDate) {
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = Date.from(startDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public void updateEndDate(final LocalDate endDate) {
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public boolean matchesStartDateOf(final LocalDate matchingDate) {
|
||||
@@ -85,7 +85,7 @@ public class LoanOfficerAssignmentHistory extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return LocalDate.ofInstant(this.startDate.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public boolean hasStartDateBefore(final LocalDate matchingDate) {
|
||||
@@ -103,11 +103,12 @@ public class LoanOfficerAssignmentHistory extends AbstractAuditableCustom {
|
||||
* @return
|
||||
*/
|
||||
public boolean isEndDateAfter(final LocalDate compareDate) {
|
||||
return this.endDate == null ? false : LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault()).isAfter(compareDate);
|
||||
return this.endDate == null ? false
|
||||
: LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).isAfter(compareDate);
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.endDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
}
|
||||
|
||||
public boolean isSameLoanOfficer(final Staff staff) {
|
||||
|
||||
+13
-13
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@@ -36,6 +35,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
|
||||
@@ -149,8 +149,8 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
final Set<LoanInterestRecalcualtionAdditionalDetails> compoundingDetails, final BigDecimal rescheduleInterestPortion) {
|
||||
this.loan = loan;
|
||||
this.installmentNumber = installmentNumber;
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.principal = defaultToNullIfZero(principal);
|
||||
this.interestCharged = defaultToNullIfZero(interest);
|
||||
this.feeChargesCharged = defaultToNullIfZero(feeCharges);
|
||||
@@ -167,8 +167,8 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
final Set<LoanInterestRecalcualtionAdditionalDetails> compoundingDetails) {
|
||||
this.loan = loan;
|
||||
this.installmentNumber = installmentNumber;
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(fromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.dueDate = Date.from(dueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.principal = defaultToNullIfZero(principal);
|
||||
this.interestCharged = defaultToNullIfZero(interest);
|
||||
this.feeChargesCharged = defaultToNullIfZero(feeCharges);
|
||||
@@ -205,14 +205,14 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
public LocalDate getFromDate() {
|
||||
LocalDate fromLocalDate = null;
|
||||
if (this.fromDate != null) {
|
||||
fromLocalDate = LocalDate.ofInstant(this.fromDate.toInstant(), ZoneId.systemDefault());
|
||||
fromLocalDate = LocalDate.ofInstant(this.fromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
return fromLocalDate;
|
||||
}
|
||||
|
||||
public LocalDate getDueDate() {
|
||||
return LocalDate.ofInstant(this.dueDate.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.dueDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public Money getPrincipal(final MonetaryCurrency currency) {
|
||||
@@ -588,7 +588,7 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
public void updateDerivedFields(final MonetaryCurrency currency, final LocalDate actualDisbursementDate) {
|
||||
if (!this.obligationsMet && getTotalOutstanding(currency).isZero()) {
|
||||
this.obligationsMet = true;
|
||||
this.obligationsMetOnDate = Date.from(actualDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.obligationsMetOnDate = Date.from(actualDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
private void checkIfRepaymentPeriodObligationsAreMet(final LocalDate transactionDate, final MonetaryCurrency currency) {
|
||||
this.obligationsMet = getTotalOutstanding(currency).isZero();
|
||||
if (this.obligationsMet) {
|
||||
this.obligationsMetOnDate = Date.from(transactionDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.obligationsMetOnDate = Date.from(transactionDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
} else {
|
||||
this.obligationsMetOnDate = null;
|
||||
}
|
||||
@@ -624,13 +624,13 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
|
||||
public void updateDueDate(final LocalDate newDueDate) {
|
||||
if (newDueDate != null) {
|
||||
this.dueDate = Date.from(newDueDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dueDate = Date.from(newDueDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFromDate(final LocalDate newFromDate) {
|
||||
if (newFromDate != null) {
|
||||
this.fromDate = Date.from(newFromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.fromDate = Date.from(newFromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
|
||||
public void updateObligationMetOnDate(final LocalDate obligationsMetOnDate) {
|
||||
this.obligationsMetOnDate = (obligationsMetOnDate != null)
|
||||
? Date.from(obligationsMetOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant())
|
||||
? Date.from(obligationsMetOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant())
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ public final class LoanRepaymentScheduleInstallment extends AbstractAuditableCus
|
||||
LocalDate obligationsMetOnDate = null;
|
||||
|
||||
if (this.obligationsMetOnDate != null) {
|
||||
obligationsMetOnDate = LocalDate.ofInstant(this.obligationsMetOnDate.toInstant(), ZoneId.systemDefault());
|
||||
obligationsMetOnDate = LocalDate.ofInstant(this.obligationsMetOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
return obligationsMetOnDate;
|
||||
|
||||
+5
-5
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -33,6 +32,7 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanTermVariationsData;
|
||||
import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
|
||||
|
||||
@@ -120,10 +120,10 @@ public class LoanTermVariations extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LoanTermVariationsData toData() {
|
||||
LocalDate termStartDate = LocalDate.ofInstant(this.termApplicableFrom.toInstant(), ZoneId.systemDefault());
|
||||
LocalDate termStartDate = LocalDate.ofInstant(this.termApplicableFrom.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
LocalDate dateValue = null;
|
||||
if (this.dateValue != null) {
|
||||
dateValue = LocalDate.ofInstant(this.dateValue.toInstant(), ZoneId.systemDefault());
|
||||
dateValue = LocalDate.ofInstant(this.dateValue.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
EnumOptionData type = LoanEnumerations.loanvariationType(this.termType);
|
||||
return new LoanTermVariationsData(getId(), type, termStartDate, this.decimalValue, dateValue, this.isSpecificToInstallment);
|
||||
@@ -134,7 +134,7 @@ public class LoanTermVariations extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate fetchTermApplicaDate() {
|
||||
return LocalDate.ofInstant(this.termApplicableFrom.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.termApplicableFrom.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public BigDecimal getTermValue() {
|
||||
@@ -146,7 +146,7 @@ public class LoanTermVariations extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate fetchDateValue() {
|
||||
return this.dateValue == null ? null : LocalDate.ofInstant(this.dateValue.toInstant(), ZoneId.systemDefault());
|
||||
return this.dateValue == null ? null : LocalDate.ofInstant(this.dateValue.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public void setTermApplicableFrom(Date termApplicableFrom) {
|
||||
|
||||
+28
-29
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
@@ -205,9 +204,9 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
PaymentDetail paymentDetail = null;
|
||||
String externalId = null;
|
||||
return new LoanTransaction(loan, office, LoanTransactionType.ACCRUAL.getValue(),
|
||||
Date.from(interestAppliedDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), interestPortion, principalPortion,
|
||||
interestPortion, feesPortion, penaltiesPortion, overPaymentPortion, reversed, paymentDetail, externalId, createdDate,
|
||||
appUser);
|
||||
Date.from(interestAppliedDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), interestPortion,
|
||||
principalPortion, interestPortion, feesPortion, penaltiesPortion, overPaymentPortion, reversed, paymentDetail, externalId,
|
||||
createdDate, appUser);
|
||||
}
|
||||
|
||||
public static LoanTransaction accrual(final Loan loan, final Office office, final Money amount, final Money interest,
|
||||
@@ -227,35 +226,35 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
String externalId = null;
|
||||
LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant();
|
||||
return new LoanTransaction(loan, office, LoanTransactionType.ACCRUAL.getValue(),
|
||||
Date.from(dateOf.atStartOfDay(ZoneId.systemDefault()).toInstant()), amount, principalPortion, interestPortion,
|
||||
Date.from(dateOf.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()), amount, principalPortion, interestPortion,
|
||||
feeChargesPortion, penaltyChargesPortion, overPaymentPortion, reversed, paymentDetail, externalId, createdDate, appUser);
|
||||
}
|
||||
|
||||
public static LoanTransaction initiateTransfer(final Office office, final Loan loan, final LocalDate transferDate,
|
||||
final LocalDateTime createdDate, final AppUser appUser) {
|
||||
return new LoanTransaction(loan, office, LoanTransactionType.INITIATE_TRANSFER.getValue(),
|
||||
Date.from(transferDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), loan.getSummary().getTotalOutstanding(),
|
||||
loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary().getTotalInterestOutstanding(),
|
||||
loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null,
|
||||
null, createdDate, appUser);
|
||||
Date.from(transferDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(),
|
||||
loan.getSummary().getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(),
|
||||
loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null, null, createdDate, appUser);
|
||||
}
|
||||
|
||||
public static LoanTransaction approveTransfer(final Office office, final Loan loan, final LocalDate transferDate,
|
||||
final LocalDateTime createdDate, final AppUser appUser) {
|
||||
return new LoanTransaction(loan, office, LoanTransactionType.APPROVE_TRANSFER.getValue(),
|
||||
Date.from(transferDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), loan.getSummary().getTotalOutstanding(),
|
||||
loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary().getTotalInterestOutstanding(),
|
||||
loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null,
|
||||
null, createdDate, appUser);
|
||||
Date.from(transferDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(),
|
||||
loan.getSummary().getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(),
|
||||
loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null, null, createdDate, appUser);
|
||||
}
|
||||
|
||||
public static LoanTransaction withdrawTransfer(final Office office, final Loan loan, final LocalDate transferDate,
|
||||
final LocalDateTime createdDate, final AppUser appUser) {
|
||||
return new LoanTransaction(loan, office, LoanTransactionType.WITHDRAW_TRANSFER.getValue(),
|
||||
Date.from(transferDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), loan.getSummary().getTotalOutstanding(),
|
||||
loan.getSummary().getTotalPrincipalOutstanding(), loan.getSummary().getTotalInterestOutstanding(),
|
||||
loan.getSummary().getTotalFeeChargesOutstanding(), loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null,
|
||||
null, createdDate, appUser);
|
||||
Date.from(transferDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
loan.getSummary().getTotalOutstanding(), loan.getSummary().getTotalPrincipalOutstanding(),
|
||||
loan.getSummary().getTotalInterestOutstanding(), loan.getSummary().getTotalFeeChargesOutstanding(),
|
||||
loan.getSummary().getTotalPenaltyChargesOutstanding(), null, false, null, null, createdDate, appUser);
|
||||
}
|
||||
|
||||
public static LoanTransaction refund(final Office office, final Money amount, final PaymentDetail paymentDetail,
|
||||
@@ -269,8 +268,8 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
loanTransaction.amount, loanTransaction.principalPortion, loanTransaction.interestPortion,
|
||||
loanTransaction.feeChargesPortion, loanTransaction.penaltyChargesPortion, loanTransaction.overPaymentPortion,
|
||||
loanTransaction.reversed, loanTransaction.paymentDetail, loanTransaction.externalId,
|
||||
(loanTransaction.createdDate == null) ? LocalDateTime.now(ZoneId.systemDefault())
|
||||
: LocalDateTime.ofInstant(loanTransaction.createdDate.toInstant(), ZoneId.systemDefault()),
|
||||
(loanTransaction.createdDate == null) ? LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant())
|
||||
: LocalDateTime.ofInstant(loanTransaction.createdDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
loanTransaction.appUser);
|
||||
}
|
||||
|
||||
@@ -321,7 +320,7 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
this.office = office;
|
||||
this.externalId = externalId;
|
||||
this.submittedOnDate = DateUtils.getDateOfTenant();
|
||||
this.createdDate = Date.from(createdDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.createdDate = Date.from(createdDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.appUser = appUser;
|
||||
}
|
||||
|
||||
@@ -345,11 +344,11 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
this.loan = loan;
|
||||
this.typeOf = type.getValue();
|
||||
this.amount = amount;
|
||||
this.dateOf = Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dateOf = Date.from(date.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.externalId = externalId;
|
||||
this.office = office;
|
||||
this.submittedOnDate = DateUtils.getDateOfTenant();
|
||||
this.createdDate = Date.from(createdDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.createdDate = Date.from(createdDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.appUser = appUser;
|
||||
}
|
||||
|
||||
@@ -360,11 +359,11 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
this.typeOf = type.getValue();
|
||||
this.paymentDetail = paymentDetail;
|
||||
this.amount = amount;
|
||||
this.dateOf = Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.dateOf = Date.from(date.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.externalId = externalId;
|
||||
this.office = office;
|
||||
this.submittedOnDate = DateUtils.getDateOfTenant();
|
||||
this.createdDate = Date.from(createdDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.createdDate = Date.from(createdDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.appUser = appUser;
|
||||
}
|
||||
|
||||
@@ -476,7 +475,7 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getTransactionDate() {
|
||||
return LocalDate.ofInstant(this.dateOf.toInstant(), ZoneId.systemDefault());
|
||||
return LocalDate.ofInstant(this.dateOf.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public Date getDateOf() {
|
||||
@@ -718,13 +717,13 @@ public class LoanTransaction extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
private LocalDate getCreatedDate() {
|
||||
return (this.createdDate == null) ? LocalDate.now(ZoneId.systemDefault())
|
||||
: LocalDate.ofInstant(this.createdDate.toInstant(), ZoneId.systemDefault());
|
||||
return (this.createdDate == null) ? LocalDate.now(DateUtils.getDateTimeZoneOfTenant())
|
||||
: LocalDate.ofInstant(this.createdDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedDateTime() {
|
||||
return (this.createdDate == null) ? LocalDateTime.now(ZoneId.systemDefault())
|
||||
: LocalDateTime.ofInstant(this.createdDate.toInstant(), ZoneId.systemDefault());
|
||||
return (this.createdDate == null) ? LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant())
|
||||
: LocalDateTime.ofInstant(this.createdDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public boolean isLastTransaction(final LoanTransaction loanTransaction) {
|
||||
|
||||
+2
-2
@@ -20,13 +20,13 @@ package org.apache.fineract.portfolio.loanaccount.guarantor.command;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.GuarantorConstants.GuarantorJSONinputParams;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorType;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GuarantorCommand {
|
||||
}
|
||||
|
||||
public Date getDobAsDate() {
|
||||
return Date.from(this.dob.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return Date.from(this.dob.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
+2
-2
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount.guarantor.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -32,6 +31,7 @@ import javax.annotation.PostConstruct;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
|
||||
import org.apache.fineract.portfolio.account.PortfolioAccountType;
|
||||
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
|
||||
@@ -223,7 +223,7 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService {
|
||||
final List<Guarantor> existGuarantorList = this.guarantorRepository.findByLoan(loan);
|
||||
final boolean isRegularTransaction = true;
|
||||
final boolean isExceptionForBalanceCheck = true;
|
||||
LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
|
||||
LocalDate transactionDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
PortfolioAccountType fromAccountType = PortfolioAccountType.SAVINGS;
|
||||
PortfolioAccountType toAccountType = PortfolioAccountType.LOAN;
|
||||
final Long toAccountId = loan.getId();
|
||||
|
||||
+3
-3
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.guarantor.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -34,6 +33,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.staff.domain.StaffRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.account.domain.AccountAssociationType;
|
||||
import org.apache.fineract.portfolio.account.domain.AccountAssociations;
|
||||
@@ -123,7 +123,7 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
|
||||
guarantorFundingDetails.add(fundingDetails);
|
||||
if (loan.isDisbursed()
|
||||
|| (loan.isApproved() && (loan.getGuaranteeAmount() != null || loan.loanProduct().isHoldGuaranteeFundsEnabled()))) {
|
||||
this.guarantorDomainService.assignGuarantor(fundingDetails, LocalDate.now(ZoneId.systemDefault()));
|
||||
this.guarantorDomainService.assignGuarantor(fundingDetails, LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
loan.updateGuaranteeAmount(fundingDetails.getAmount());
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto
|
||||
GuarantorFundStatusType fundStatusType = GuarantorFundStatusType.DELETED;
|
||||
if (guarantorForDelete.getLoan().isDisbursed() || guarantorForDelete.getLoan().isApproved()) {
|
||||
fundStatusType = GuarantorFundStatusType.WITHDRAWN;
|
||||
this.guarantorDomainService.releaseGuarantor(guarantorFundingDetails, LocalDate.now(ZoneId.systemDefault()));
|
||||
this.guarantorDomainService.releaseGuarantor(guarantorFundingDetails, LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
guarantorForDelete.updateStatus(guarantorFundingDetails, fundStatusType);
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,8 +20,8 @@ package org.apache.fineract.portfolio.loanaccount.loanschedule.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
/**
|
||||
* Immutable data object that represents a period of a loan schedule.
|
||||
@@ -193,7 +193,7 @@ public final class LoanSchedulePeriodData {
|
||||
this.totalOutstandingForPeriod = this.feeChargesOutstanding;
|
||||
this.totalActualCostOfLoanForPeriod = this.feeChargesDue;
|
||||
this.totalInstallmentAmountForPeriod = null;
|
||||
if (dueDate.isBefore(LocalDate.now(ZoneId.systemDefault()))) {
|
||||
if (dueDate.isBefore(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
this.totalOverdue = this.totalOutstandingForPeriod;
|
||||
} else {
|
||||
this.totalOverdue = null;
|
||||
@@ -255,7 +255,7 @@ public final class LoanSchedulePeriodData {
|
||||
this.totalActualCostOfLoanForPeriod = interestDueOnPrincipalOutstanding.add(feeChargesDueForPeriod);
|
||||
this.totalInstallmentAmountForPeriod = totalInstallmentAmountForPeriod;
|
||||
|
||||
if (dueDate.isBefore(LocalDate.now(ZoneId.systemDefault()))) {
|
||||
if (dueDate.isBefore(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
this.totalOverdue = this.totalOutstandingForPeriod;
|
||||
} else {
|
||||
this.totalOverdue = null;
|
||||
@@ -326,7 +326,7 @@ public final class LoanSchedulePeriodData {
|
||||
this.totalActualCostOfLoanForPeriod = totalActualCostOfLoanForPeriod;
|
||||
this.totalInstallmentAmountForPeriod = totalInstallmentAmountForPeriod;
|
||||
|
||||
if (dueDate.isBefore(LocalDate.now(ZoneId.systemDefault()))) {
|
||||
if (dueDate.isBefore(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()))) {
|
||||
this.totalOverdue = this.totalOutstandingForPeriod;
|
||||
} else {
|
||||
this.totalOverdue = null;
|
||||
|
||||
+3
-3
@@ -21,12 +21,12 @@ package org.apache.fineract.portfolio.loanaccount.loanschedule.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
@@ -1369,7 +1369,7 @@ public final class LoanApplicationTerms {
|
||||
public Date getRepaymentStartFromDate() {
|
||||
Date dateValue = null;
|
||||
if (this.repaymentsStartingFromDate != null) {
|
||||
dateValue = Date.from(this.repaymentsStartingFromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
dateValue = Date.from(this.repaymentsStartingFromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
return dateValue;
|
||||
}
|
||||
@@ -1377,7 +1377,7 @@ public final class LoanApplicationTerms {
|
||||
public Date getInterestChargedFromDate() {
|
||||
Date dateValue = null;
|
||||
if (this.interestChargedFromDate != null) {
|
||||
dateValue = Date.from(this.interestChargedFromDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
dateValue = Date.from(this.interestChargedFromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
return dateValue;
|
||||
}
|
||||
|
||||
+10
-9
@@ -25,7 +25,6 @@ import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
@@ -435,7 +434,8 @@ public class LoanScheduleAssembler {
|
||||
}
|
||||
final boolean isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(officeId,
|
||||
Date.from(expectedDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), HolidayStatusType.ACTIVE.getValue());
|
||||
Date.from(expectedDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
HolidayDetailDTO detailDTO = new HolidayDetailDTO(isHolidayEnabled, holidays, workingDays);
|
||||
|
||||
@@ -602,7 +602,8 @@ public class LoanScheduleAssembler {
|
||||
|
||||
final LocalDate expectedDisbursementDate = this.fromApiJsonHelper.extractLocalDateNamed("expectedDisbursementDate", element);
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(officeId,
|
||||
Date.from(expectedDisbursementDate.atStartOfDay(ZoneId.systemDefault()).toInstant()), HolidayStatusType.ACTIVE.getValue());
|
||||
Date.from(expectedDisbursementDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
|
||||
validateDisbursementDateIsOnNonWorkingDay(loanApplicationTerms.getExpectedDisbursementDate(), workingDays);
|
||||
@@ -650,7 +651,7 @@ public class LoanScheduleAssembler {
|
||||
final boolean isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
|
||||
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(officeId,
|
||||
Date.from(loanApplicationTerms.getExpectedDisbursementDate().atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(loanApplicationTerms.getExpectedDisbursementDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
|
||||
@@ -669,7 +670,7 @@ public class LoanScheduleAssembler {
|
||||
|
||||
final boolean isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled();
|
||||
final List<Holiday> holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(officeId,
|
||||
Date.from(loanApplicationTerms.getExpectedDisbursementDate().atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(loanApplicationTerms.getExpectedDisbursementDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
HolidayStatusType.ACTIVE.getValue());
|
||||
final WorkingDays workingDays = this.workingDaysRepository.findOne();
|
||||
HolidayDetailDTO holidayDetailDTO = new HolidayDetailDTO(isHolidayEnabled, holidays, workingDays);
|
||||
@@ -851,8 +852,8 @@ public class LoanScheduleAssembler {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
if (loan.getExpectedFirstRepaymentOnDate() == null) {
|
||||
loan.setExpectedFirstRepaymentOnDate(
|
||||
Date.from(loan.fetchRepaymentScheduleInstallment(1).getDueDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
loan.setExpectedFirstRepaymentOnDate(Date.from(
|
||||
loan.fetchRepaymentScheduleInstallment(1).getDueDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
final LocalDate recalculateFrom = null;
|
||||
ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
||||
@@ -989,13 +990,13 @@ public class LoanScheduleAssembler {
|
||||
|
||||
LocalDate duedateLocalDate = this.fromApiJsonHelper.extractLocalDateNamed(LoanApiConstants.dueDateParamName, arrayElement,
|
||||
dateFormat, locale);
|
||||
Date dueDate = Date.from(duedateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date dueDate = Date.from(duedateLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
|
||||
LocalDate modifiedDuedateLocalDate = this.fromApiJsonHelper.extractLocalDateNamed(LoanApiConstants.modifiedDueDateParamName,
|
||||
arrayElement, dateFormat, locale);
|
||||
Date modifiedDuedate = null;
|
||||
if (modifiedDuedateLocalDate != null) {
|
||||
modifiedDuedate = Date.from(modifiedDuedateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
modifiedDuedate = Date.from(modifiedDuedateLocalDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
boolean isSpecificToInstallment = true;
|
||||
if (isInsertInstallment) {
|
||||
|
||||
+5
-3
@@ -19,10 +19,10 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.loanschedule.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
|
||||
@@ -60,11 +60,13 @@ public class LoanScheduleHistoryWritePlatformServiceImpl implements LoanSchedule
|
||||
Date dueDate = null;
|
||||
|
||||
if (repaymentScheduleInstallment.getFromDate() != null) {
|
||||
fromDate = Date.from(repaymentScheduleInstallment.getFromDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
fromDate = Date
|
||||
.from(repaymentScheduleInstallment.getFromDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
if (repaymentScheduleInstallment.getDueDate() != null) {
|
||||
dueDate = Date.from(repaymentScheduleInstallment.getDueDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
dueDate = Date
|
||||
.from(repaymentScheduleInstallment.getDueDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
|
||||
final BigDecimal principal = repaymentScheduleInstallment.getPrincipal(currency).getAmount();
|
||||
|
||||
+7
-7
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.rescheduleloan.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -36,6 +35,7 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRescheduleRequestToTermVariationMapping;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus;
|
||||
@@ -167,7 +167,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom {
|
||||
LocalDate localDate = null;
|
||||
|
||||
if (this.rescheduleFromDate != null) {
|
||||
localDate = LocalDate.ofInstant(this.rescheduleFromDate.toInstant(), ZoneId.systemDefault());
|
||||
localDate = LocalDate.ofInstant(this.rescheduleFromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
return localDate;
|
||||
@@ -194,7 +194,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom {
|
||||
LocalDate localDate = null;
|
||||
|
||||
if (this.submittedOnDate != null) {
|
||||
localDate = LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
localDate = LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
return localDate;
|
||||
@@ -214,7 +214,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom {
|
||||
LocalDate localDate = null;
|
||||
|
||||
if (this.approvedOnDate != null) {
|
||||
localDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
localDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
return localDate;
|
||||
@@ -234,7 +234,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom {
|
||||
LocalDate localDate = null;
|
||||
|
||||
if (this.rejectedOnDate != null) {
|
||||
localDate = LocalDate.ofInstant(this.rejectedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
localDate = LocalDate.ofInstant(this.rejectedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
return localDate;
|
||||
@@ -274,7 +274,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom {
|
||||
|
||||
if (approvedOnDate != null) {
|
||||
this.approvedByUser = approvedByUser;
|
||||
this.approvedOnDate = Date.from(approvedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = Date.from(approvedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.statusEnum = LoanStatus.APPROVED.getValue();
|
||||
}
|
||||
}
|
||||
@@ -293,7 +293,7 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom {
|
||||
|
||||
if (approvedOnDate != null) {
|
||||
this.rejectedByUser = approvedByUser;
|
||||
this.rejectedOnDate = Date.from(approvedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.rejectedOnDate = Date.from(approvedOnDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.statusEnum = LoanStatus.REJECTED.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,11 +21,11 @@ package org.apache.fineract.portfolio.loanaccount.rescheduleloan.service;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanTermVariationsData;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
||||
@@ -109,8 +109,8 @@ public class LoanReschedulePreviewPlatformServiceImpl implements LoanRescheduleP
|
||||
if (loanRescheduleRequestToTermVariationMapping.getLoanTermVariations().getTermType().isDueDateVariation()
|
||||
&& rescheduleFromDate != null) {
|
||||
adjustedApplicableDate = loanRescheduleRequestToTermVariationMapping.getLoanTermVariations().fetchDateValue();
|
||||
loanRescheduleRequestToTermVariationMapping.getLoanTermVariations()
|
||||
.setTermApplicableFrom(Date.from(rescheduleFromDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
loanRescheduleRequestToTermVariationMapping.getLoanTermVariations().setTermApplicableFrom(
|
||||
Date.from(rescheduleFromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
loanTermVariationsData.add(loanRescheduleRequestToTermVariationMapping.getLoanTermVariations().toData());
|
||||
}
|
||||
|
||||
+14
-13
@@ -22,7 +22,6 @@ import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -42,6 +41,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrencyRepositoryWrapper;
|
||||
@@ -226,7 +226,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
|
||||
if (localDate != null) {
|
||||
// update the value of the "submittedOnDate" variable
|
||||
submittedOnDate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
submittedOnDate = Date.from(localDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
rescheduleFromInstallment = installment.getInstallmentNumber();
|
||||
|
||||
// update the value of the "rescheduleFromDate" variable
|
||||
rescheduleFromDate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
rescheduleFromDate = Date.from(localDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
|
||||
if (localDate != null) {
|
||||
// update the value of the "adjustedDueDate"variable
|
||||
adjustedDueDate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
adjustedDueDate = Date.from(localDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,16 +308,16 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
|
||||
if (rescheduleFromDate != null && endDate != null && emi != null) {
|
||||
LoanTermVariations parent = null;
|
||||
LocalDate rescheduleFromLocDate = LocalDate.ofInstant(rescheduleFromDate.toInstant(), ZoneId.systemDefault());
|
||||
LocalDate endDateLocDate = LocalDate.ofInstant(endDate.toInstant(), ZoneId.systemDefault());
|
||||
LocalDate rescheduleFromLocDate = LocalDate.ofInstant(rescheduleFromDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
LocalDate endDateLocDate = LocalDate.ofInstant(endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final Integer termType = LoanTermVariationType.EMI_AMOUNT.getValue();
|
||||
List<LoanRepaymentScheduleInstallment> installments = loan.getRepaymentScheduleInstallments();
|
||||
for (LoanRepaymentScheduleInstallment installment : installments) {
|
||||
if (installment.getDueDate().isEqual(rescheduleFromLocDate) || installment.getDueDate().isEqual(endDateLocDate)
|
||||
|| (installment.getDueDate().isAfter(rescheduleFromLocDate) && installment.getDueDate().isBefore(endDateLocDate))) {
|
||||
createLoanTermVariations(termType, loan,
|
||||
Date.from(installment.getDueDate().atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(installment.getDueDate().atStartOfDay(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(installment.getDueDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
Date.from(installment.getDueDate().atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()),
|
||||
loanRescheduleRequestToTermVariationMappings, isActive, true, emi, parent);
|
||||
}
|
||||
if (installment.getDueDate().isAfter(endDateLocDate)) {
|
||||
@@ -429,8 +429,8 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
&& activeLoanTermVariation.fetchDateValue().equals(dueDateVariationInCurrentRequest.fetchTermApplicaDate())) {
|
||||
activeLoanTermVariation.markAsInactive();
|
||||
rescheduleFromDate = activeLoanTermVariation.fetchTermApplicaDate();
|
||||
dueDateVariationInCurrentRequest
|
||||
.setTermApplicableFrom(Date.from(rescheduleFromDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
dueDateVariationInCurrentRequest.setTermApplicableFrom(
|
||||
Date.from(rescheduleFromDate.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
} else if (!activeLoanTermVariation.fetchTermApplicaDate().isBefore(fromScheduleDate)) {
|
||||
while (currentScheduleDate.isBefore(activeLoanTermVariation.fetchTermApplicaDate())) {
|
||||
currentScheduleDate = this.scheduledDateGenerator.generateNextRepaymentDate(currentScheduleDate,
|
||||
@@ -440,8 +440,9 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
changeMap.put(currentScheduleDate, modifiedScheduleDate);
|
||||
}
|
||||
if (changeMap.containsKey(activeLoanTermVariation.fetchTermApplicaDate())) {
|
||||
activeLoanTermVariation.setTermApplicableFrom(Date.from(changeMap
|
||||
.get(activeLoanTermVariation.fetchTermApplicaDate()).atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
activeLoanTermVariation
|
||||
.setTermApplicableFrom(Date.from(changeMap.get(activeLoanTermVariation.fetchTermApplicaDate())
|
||||
.atStartOfDay(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -489,7 +490,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche
|
||||
}
|
||||
|
||||
loan.updateRescheduledByUser(appUser);
|
||||
loan.updateRescheduledOnDate(LocalDate.now(ZoneId.systemDefault()));
|
||||
loan.updateRescheduledOnDate(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
|
||||
// update the status of the request
|
||||
loanRescheduleRequest.approve(appUser, approvedOnDate);
|
||||
|
||||
+2
-2
@@ -19,13 +19,13 @@
|
||||
package org.apache.fineract.portfolio.loanaccount.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.exception.MultiException;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
|
||||
import org.apache.fineract.infrastructure.jobs.exception.JobExecutionException;
|
||||
import org.apache.fineract.infrastructure.jobs.service.JobName;
|
||||
@@ -83,7 +83,7 @@ public class LoanAccrualPlatformServiceImpl implements LoanAccrualPlatformServic
|
||||
@CronTarget(jobName = JobName.ADD_PERIODIC_ACCRUAL_ENTRIES)
|
||||
public void addPeriodicAccruals() throws JobExecutionException {
|
||||
try {
|
||||
addPeriodicAccruals(LocalDate.now(ZoneId.systemDefault()));
|
||||
addPeriodicAccruals(LocalDate.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
} catch (MultiException e) {
|
||||
throw new JobExecutionException(e);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user