ShruthiRajaram closed pull request #493: FINERACT-632 Make description field 
non mandatory in saving product
URL: https://github.com/apache/fineract/pull/493
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
index 4422fd086..b2baac673 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java
@@ -137,9 +137,6 @@ public void validateForCreate(final String json) {
         final String shortName = 
this.fromApiJsonHelper.extractStringNamed(shortNameParamName, element);
         
baseDataValidator.reset().parameter(shortNameParamName).value(shortName).notBlank().notExceedingLengthOf(4);
 
-        final String description = 
this.fromApiJsonHelper.extractStringNamed(descriptionParamName, element);
-        
baseDataValidator.reset().parameter(descriptionParamName).value(description).notBlank().notExceedingLengthOf(500);
-
         final String currencyCode = 
this.fromApiJsonHelper.extractStringNamed(currencyCodeParamName, element);
         
baseDataValidator.reset().parameter(currencyCodeParamName).value(currencyCode).notBlank();
 
@@ -175,6 +172,11 @@ public void validateForCreate(final String json) {
         
baseDataValidator.reset().parameter(interestCalculationDaysInYearTypeParamName).value(interestCalculationDaysInYearType).notNull()
                 
.isOneOfTheseValues(SavingsInterestCalculationDaysInYearType.integerValues());
 
+        if (this.fromApiJsonHelper.parameterExists(descriptionParamName, 
element)) {
+            final String description = 
this.fromApiJsonHelper.extractStringNamed(descriptionParamName, element);
+            
baseDataValidator.reset().parameter(descriptionParamName).value(description).ignoreIfNull().notExceedingLengthOf(500);
+        }
+
         if 
(this.fromApiJsonHelper.parameterExists(minRequiredOpeningBalanceParamName, 
element)) {
             final BigDecimal minOpeningBalance = 
this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
                     minRequiredOpeningBalanceParamName, element);
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java
index ba4b4f757..c96387720 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java
@@ -107,7 +107,7 @@
     @Column(name = "short_name", nullable = false, unique = true)
     protected String shortName;
 
-    @Column(name = "description", length = 500, nullable = false)
+    @Column(name = "description", length = 500, nullable = true)
     protected String description;
 
     @Embedded
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProductAssembler.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProductAssembler.java
index e52e6dc77..81844a615 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProductAssembler.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProductAssembler.java
@@ -89,7 +89,7 @@ public SavingsProduct assemble(final JsonCommand command) {
 
         final String name = command.stringValueOfParameterNamed(nameParamName);
         final String shortName = 
command.stringValueOfParameterNamed(shortNameParamName);
-        final String description = 
command.stringValueOfParameterNamed(descriptionParamName);
+        final String description = 
command.stringValueOfParameterNamedAllowingNull(descriptionParamName);
 
         final String currencyCode = 
command.stringValueOfParameterNamed(currencyCodeParamName);
         final Integer digitsAfterDecimal = 
command.integerValueOfParameterNamed(digitsAfterDecimalParamName);
diff --git 
a/fineract-provider/src/main/resources/sql/migrations/core_db/V346__nullable_saving_product_description.sql
 
b/fineract-provider/src/main/resources/sql/migrations/core_db/V346__nullable_saving_product_description.sql
new file mode 100644
index 000000000..dea3b4a8e
--- /dev/null
+++ 
b/fineract-provider/src/main/resources/sql/migrations/core_db/V346__nullable_saving_product_description.sql
@@ -0,0 +1,20 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+--
+
+ALTER TABLE `m_savings_product` MODIFY `description` VARCHAR(500) NULL DEFAULT 
NULL;
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to