You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/08/27 13:20:31 UTC

[GitHub] [fineract] francisguchie opened a new pull request #1296: Fineract-1135 error at loan repayment

francisguchie opened a new pull request #1296:
URL: https://github.com/apache/fineract/pull/1296


   ## Description
   https://issues.apache.org/jira/browse/FINERACT-1135
   
   ## Checklist
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Commit message starts with the issue number from https://issues.apache.org/jira/projects/FINERACT/. Ex: FINERACT-646 Pockets API.
   
   - [ ] Coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions have been followed.
   
   - [ ] API documentation at fineract-provider/src/main/resources/static/api-docs/apiLive.htm has been updated with details of any API changes.
   
   - [ ] Integration tests have been created/updated for verifying the changes made.
   
   - [ ] All Integrations tests are passing with the new commits.
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the list.)
   
   Our guidelines for code reviews is at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] francisguchie commented on a change in pull request #1296: Fineract-1135 error at loan repayment

Posted by GitBox <gi...@apache.org>.
francisguchie commented on a change in pull request #1296:
URL: https://github.com/apache/fineract/pull/1296#discussion_r481082652



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
##########
@@ -431,7 +431,7 @@ public LoanTransactionData retrieveLoanTransactionTemplate(final Long loanId) {
         this.context.authenticatedUser();
 
         RepaymentTransactionTemplateMapper mapper = new RepaymentTransactionTemplateMapper();
-        String sql = "select " + mapper.schema() + " where l.id =?";
+        String sql = "select " + mapper.schema();
         LoanTransactionData loanTransactionData = this.jdbcTemplate.queryForObject(sql, mapper, LoanTransactionType.REPAYMENT.getValue(),

Review comment:
       I did not remove the parameter i only put it in its rightful place 
               sqlBuilder.append(" GROUP BY ls.duedate");	            sqlBuilder.append("WHERE l.id = ? ");
   just before the groub by object




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] francisguchie commented on pull request #1296: Fineract-1135 error at loan repayment

Posted by GitBox <gi...@apache.org>.
francisguchie commented on pull request #1296:
URL: https://github.com/apache/fineract/pull/1296#issuecomment-684795804


   > Minor feedback for now and the future, Always use the issue number in all caps when using it in a commit message: `[FINERACT-1135](https://issues.apache.org/jira/browse/FINERACT-1135): Fix Error at Loan Repayment` will be commit message or `Fix Error at Loan Repayment ([FINERACT-1135](https://issues.apache.org/jira/browse/FINERACT-1135)) ` as in upcoming: #1284
   
   thanks @awasum 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] awasum commented on pull request #1296: Fineract-1135 error at loan repayment

Posted by GitBox <gi...@apache.org>.
awasum commented on pull request #1296:
URL: https://github.com/apache/fineract/pull/1296#issuecomment-682184132


   Minor feedback for now and the future, Always use the issue number in all caps when using it in a commit message: `FINERACT-1135: Fix Error at Loan Repayment` will be commit message or `Fix Error at Loan Repayment (FINERACT-1135) ` as in upcoming: #1284 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] ptuomola merged pull request #1296: FINERACT-1135: Fix SQL error at loan repayment template

Posted by GitBox <gi...@apache.org>.
ptuomola merged pull request #1296:
URL: https://github.com/apache/fineract/pull/1296


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] vidakovic commented on pull request #1296: FINERACT-1135: Fix SQL error at loan repayment template

Posted by GitBox <gi...@apache.org>.
vidakovic commented on pull request #1296:
URL: https://github.com/apache/fineract/pull/1296#issuecomment-685002340


   @francisguchie any chance to get this backported to the release branch 1.4.0? The Jira ticket for that is still open... would appreciate if we could do this soon to push the release over the finish line. Thanks.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] francisguchie commented on a change in pull request #1296: Fineract-1135 error at loan repayment

Posted by GitBox <gi...@apache.org>.
francisguchie commented on a change in pull request #1296:
URL: https://github.com/apache/fineract/pull/1296#discussion_r481082652



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
##########
@@ -431,7 +431,7 @@ public LoanTransactionData retrieveLoanTransactionTemplate(final Long loanId) {
         this.context.authenticatedUser();
 
         RepaymentTransactionTemplateMapper mapper = new RepaymentTransactionTemplateMapper();
-        String sql = "select " + mapper.schema() + " where l.id =?";
+        String sql = "select " + mapper.schema();
         LoanTransactionData loanTransactionData = this.jdbcTemplate.queryForObject(sql, mapper, LoanTransactionType.REPAYMENT.getValue(),

Review comment:
       I did not remove the parameter i only put it in its rightful place 
               sqlBuilder.append(" GROUP BY ls.duedate");	            sqlBuilder.append("WHERE l.id = ? ");
   just before the groub by object
   
   look at line 2200  
   
   But still the sql runs even without this paramater is it is already called in other places like line 2198, line 2200 is just a "fail safe" parameter just in case there could be more than one result generated by the SQL script ( you never know)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [fineract] ptuomola commented on a change in pull request #1296: Fineract-1135 error at loan repayment

Posted by GitBox <gi...@apache.org>.
ptuomola commented on a change in pull request #1296:
URL: https://github.com/apache/fineract/pull/1296#discussion_r479594561



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
##########
@@ -431,7 +431,7 @@ public LoanTransactionData retrieveLoanTransactionTemplate(final Long loanId) {
         this.context.authenticatedUser();
 
         RepaymentTransactionTemplateMapper mapper = new RepaymentTransactionTemplateMapper();
-        String sql = "select " + mapper.schema() + " where l.id =?";
+        String sql = "select " + mapper.schema();
         LoanTransactionData loanTransactionData = this.jdbcTemplate.queryForObject(sql, mapper, LoanTransactionType.REPAYMENT.getValue(),

Review comment:
       If we are removing one parameter from the query, should we not also pass one less parameter when we execute the query?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
##########
@@ -2176,35 +2176,36 @@ public CurrencyData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum)
         public String schema() {
             StringBuilder sqlBuilder = new StringBuilder();
 
-            sqlBuilder.append("if(max(tr.transaction_date)>ls.dueDate,max(tr.transaction_date),ls.dueDate) as transactionDate,");
+            sqlBuilder.append("if(max(tr.transaction_date)>ls.dueDate,max(tr.transaction_date),ls.dueDate) as transactionDate, ");
             sqlBuilder.append(
-                    "ls.principal_amount - IFNULL(ls.principal_writtenoff_derived,0) - IFNULL(ls.principal_completed_derived,0) as principalDue,");
+                    "ls.principal_amount - IFNULL(ls.principal_writtenoff_derived,0) - IFNULL(ls.principal_completed_derived,0) as principalDue, ");
             sqlBuilder.append(
-                    "ls.interest_amount - IFNULL(ls.interest_completed_derived,0) - IFNULL(ls.interest_waived_derived,0) - IFNULL(ls.interest_writtenoff_derived,0) as interestDue,");
+                    "ls.interest_amount - IFNULL(ls.interest_completed_derived,0) - IFNULL(ls.interest_waived_derived,0) - IFNULL(ls.interest_writtenoff_derived,0) as interestDue, ");
             sqlBuilder.append(
-                    "ls.fee_charges_amount - IFNULL(ls.fee_charges_completed_derived,0) - IFNULL(ls.fee_charges_writtenoff_derived,0) - IFNULL(ls.fee_charges_waived_derived,0) as feeDue,");
+                    "ls.fee_charges_amount - IFNULL(ls.fee_charges_completed_derived,0) - IFNULL(ls.fee_charges_writtenoff_derived,0) - IFNULL(ls.fee_charges_waived_derived,0) as feeDue, ");
             sqlBuilder.append(
-                    "ls.penalty_charges_amount - IFNULL(ls.penalty_charges_completed_derived,0) - IFNULL(ls.penalty_charges_writtenoff_derived,0) - IFNULL(ls.penalty_charges_waived_derived,0) as penaltyDue,");
+                    "ls.penalty_charges_amount - IFNULL(ls.penalty_charges_completed_derived,0) - IFNULL(ls.penalty_charges_writtenoff_derived,0) - IFNULL(ls.penalty_charges_waived_derived,0) as penaltyDue, ");
             sqlBuilder.append(
-                    " l.currency_code as currencyCode, l.currency_digits as currencyDigits, l.currency_multiplesof as inMultiplesOf, rc.`name` as currencyName, ");
-            sqlBuilder.append(" rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode ");
-            sqlBuilder.append(" FROM m_loan l");

Review comment:
       Is there a reason for removing all these spaces from beginning of the strings? The reason for them, as far as I can see, is avoiding a situation where someone adds before a string that doesn't have a space at the end, and causes the next string to therefore generate broken SQL. I don't think they are harmful and can save us from some accidental illegal SQL...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org