fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] incubator-fineract git commit: commit for FINERACT-53 (Make the clientId URL parameter optional for 'loan details template' retrieval)
Date Fri, 29 Jul 2016 09:35:55 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop a232d1b1a -> a01d3e1fc


commit for FINERACT-53 (Make the clientId URL parameter optional for 'loan details template'
retrieval)


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/fd3b6323
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/fd3b6323
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/fd3b6323

Branch: refs/heads/develop
Commit: fd3b6323a4c08fdbc8167296492e7bd99d5b34e4
Parents: 5ac0da0
Author: Emmanuel Nnaa <emmanuelnnaa@musoni.eu>
Authored: Tue Jul 19 12:00:20 2016 +0200
Committer: Emmanuel Nnaa <emmanuelnnaa@musoni.eu>
Committed: Tue Jul 19 12:00:20 2016 +0200

----------------------------------------------------------------------
 .../portfolio/loanaccount/api/LoansApiResource.java  | 15 +++++++++------
 .../portfolio/loanaccount/data/LoanAccountData.java  | 12 +++++++++++-
 2 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/fd3b6323/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
index 5e71e03..5f3754c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
@@ -273,12 +273,15 @@ public class LoansApiResource {
             // for JLG loan both client and group details are required
             if (templateType.equals("individual") || templateType.equals("jlg")) {
 
-                final LoanAccountData loanAccountClientDetails = this.loanReadPlatformService.retrieveClientDetailsTemplate(clientId);
-
-                officeId = loanAccountClientDetails.officeId();
-
-                newLoanAccount = newLoanAccount == null ? loanAccountClientDetails : LoanAccountData.populateClientDefaults(newLoanAccount,
-                        loanAccountClientDetails);
+                if(clientId == null) {
+                    newLoanAccount = newLoanAccount == null ? LoanAccountData.emptyTemplate()
: newLoanAccount;
+                } else {
+                    final LoanAccountData loanAccountClientDetails = this.loanReadPlatformService.retrieveClientDetailsTemplate(clientId);
+
+                    officeId = loanAccountClientDetails.officeId();
+                    newLoanAccount = newLoanAccount == null ? loanAccountClientDetails :
LoanAccountData.populateClientDefaults(newLoanAccount,
+                            loanAccountClientDetails);
+                }
 
                 // if it's JLG loan add group details
                 if (templateType.equals("jlg")) {

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/fd3b6323/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java
index fa6881d..0c158ca 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java
@@ -1557,4 +1557,14 @@ public class LoanAccountData {
         return (this.repaymentFrequencyType.getId().intValue() == PeriodFrequencyType.MONTHS.getValue());
     }
 
-}
\ No newline at end of file
+    /**
+     * Used to produce a {@link LoanAccountData} with only collateral options for now.
+     * 
+     * @return {@link LoanAccountData} object
+     */
+    public static LoanAccountData emptyTemplate() {
+        final Collection<CodeValueData> loanCollateralOptions = null;
+        
+        return LoanAccountData.collateralTemplate(loanCollateralOptions);
+    }
+}


Mime
View raw message