Repository: fineract Updated Branches: refs/heads/develop b56cc4354 -> d6accae34
Issue in survey creation Project: http://git-wip-us.apache.org/repos/asf/fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/fineract/commit/d6accae3 Tree: http://git-wip-us.apache.org/repos/asf/fineract/tree/d6accae3 Diff: http://git-wip-us.apache.org/repos/asf/fineract/diff/d6accae3 Branch: refs/heads/develop Commit: d6accae3481f3f39026380a84697701501efd9d8 Parents: b56cc43 Author: Nazeer Hussain Shaik <[email protected]> Authored: Fri Sep 22 19:34:25 2017 +0530 Committer: Nazeer Hussain Shaik <[email protected]> Committed: Fri Sep 22 19:34:25 2017 +0530 ---------------------------------------------------------------------- .../org/apache/fineract/spm/service/SpmService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/fineract/blob/d6accae3/fineract-provider/src/main/java/org/apache/fineract/spm/service/SpmService.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/service/SpmService.java b/fineract-provider/src/main/java/org/apache/fineract/spm/service/SpmService.java index 52c159d..8d6f0fa 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/spm/service/SpmService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/spm/service/SpmService.java @@ -19,6 +19,7 @@ package org.apache.fineract.spm.service; 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.spm.domain.Survey; import org.apache.fineract.spm.domain.SurveyValidator; @@ -26,11 +27,13 @@ import org.apache.fineract.spm.exception.SurveyNotFoundException; import org.apache.fineract.spm.repository.SurveyRepository; import org.apache.openjpa.persistence.EntityExistsException; import org.joda.time.DateTime; +import org.joda.time.LocalDate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.orm.jpa.JpaSystemException; import org.springframework.stereotype.Service; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -77,13 +80,13 @@ public class SpmService { this.deactivateSurvey(previousSurvey.getId()); } // set valid from to start of today - final DateTime validFrom = getStartOfToday(); + LocalDate validFrom = DateUtils.getLocalDateOfTenant() ; + // set valid to for 100 years + Calendar cal = Calendar.getInstance() ; + cal.setTime(validFrom.toDate()); + cal.add(Calendar.YEAR, 100); survey.setValidFrom(validFrom.toDate()); - // set valid from to end in 100 years - final DateTime validTo = validFrom.withDayOfMonth(31).withMonthOfYear(12).withHourOfDay(23).withMinuteOfHour(59) - .withSecondOfMinute(59).withMillisOfSecond(999).plusYears(100); - - survey.setValidTo(validTo.toDate()); + survey.setValidTo(cal.getTime()); try { this.surveyRepository.saveAndFlush(survey); } catch (final EntityExistsException dve) {
