This is an automated email from the ASF dual-hosted git repository.

vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 520ee5b  FINERACT-976 : Client date of birth can not be greater than 
the client submitted on date
520ee5b is described below

commit 520ee5b82d92498a17e57c4f9d2ec084e20ad007
Author: kiran-vsm <[email protected]>
AuthorDate: Sat May 16 16:42:41 2020 +0530

    FINERACT-976 : Client date of birth can not be greater than the client 
submitted on date
---
 .../portfolio/client/data/ClientDataValidator.java | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
index 1e49879..870d9a7 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java
@@ -187,16 +187,16 @@ public final class ClientDataValidator {
             
baseDataValidator.reset().parameter(ClientApiConstants.activeParamName).value(active).trueOrFalseRequired(false);
         }
 
+        LocalDate submittedOnDate = null;
         if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.submittedOnDateParamName,
 element)) {
-            final LocalDate submittedOnDate = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.submittedOnDateParamName,
-                    element);
+            submittedOnDate = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.submittedOnDateParamName,
 element);
             
baseDataValidator.reset().parameter(ClientApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull();
         }
 
         if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.dateOfBirthParamName,
 element)) {
             final LocalDate dateOfBirth = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.dateOfBirthParamName,
 element);
             
baseDataValidator.reset().parameter(ClientApiConstants.dateOfBirthParamName).value(dateOfBirth).notNull()
-                    .validateDateBefore(DateUtils.getLocalDateOfTenant());
+                    
.validateDateBefore(DateUtils.getLocalDateOfTenant()).validateDateBefore(submittedOnDate);
         }
 
         if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.genderIdParamName, 
element)) {
@@ -475,13 +475,6 @@ public final class ClientDataValidator {
                     .longGreaterThanZero();
         }
 
-        if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.dateOfBirthParamName,
 element)) {
-            atLeastOneParameterPassedForUpdate = true;
-            final LocalDate dateOfBirth = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.dateOfBirthParamName,
 element);
-            
baseDataValidator.reset().parameter(ClientApiConstants.dateOfBirthParamName).value(dateOfBirth).notNull()
-                    .validateDateBefore(DateUtils.getLocalDateOfTenant());
-        }
-
         if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.genderIdParamName, 
element)) {
             atLeastOneParameterPassedForUpdate = true;
             final Integer genderId = 
this.fromApiJsonHelper.extractIntegerSansLocaleNamed(ClientApiConstants.genderIdParamName,
 element);
@@ -502,12 +495,19 @@ public final class ClientDataValidator {
             
baseDataValidator.reset().parameter(ClientApiConstants.clientClassificationIdParamName).value(clientClassification)
                     .integerGreaterThanZero();
         }
+
+        LocalDate submittedDate = null;
         if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.submittedOnDateParamName,
 element)) {
             atLeastOneParameterPassedForUpdate = true;
-            final LocalDate submittedDate = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.submittedOnDateParamName,
-                    element);
+            submittedDate = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.submittedOnDateParamName,
 element);
             
baseDataValidator.reset().parameter(ClientApiConstants.submittedOnDateParamName).value(submittedDate).notNull();
+        }
 
+        if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.dateOfBirthParamName,
 element)) {
+            atLeastOneParameterPassedForUpdate = true;
+            final LocalDate dateOfBirth = 
this.fromApiJsonHelper.extractLocalDateNamed(ClientApiConstants.dateOfBirthParamName,
 element);
+            
baseDataValidator.reset().parameter(ClientApiConstants.dateOfBirthParamName).value(dateOfBirth).notNull()
+                    
.validateDateBefore(DateUtils.getLocalDateOfTenant()).validateDateBefore(submittedDate);
         }
 
         if 
(this.fromApiJsonHelper.parameterExists(ClientApiConstants.legalFormIdParamName,
 element)) {

Reply via email to