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 2021/10/11 14:35:53 UTC

[GitHub] [fineract] ankita10r opened a new pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

ankita10r opened a new pull request #1890:
URL: https://github.com/apache/fineract/pull/1890


   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   
   - [ ] Create/update unit or integration tests for verifying the changes made.
   
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/api-docs/apiLive.htm with details of any API changes
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are 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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] avikganguly01 merged pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] ankita10r commented on a change in pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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



##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       We are using java 8 synataxes, instead of null check we are using optional.

##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       We are using java 8 syntax, instead of null check we are using optional.

##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       GLAccountNotFoundException is a more accurate exception rather than the one thrown by Optional (NoSuchElementException)




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] ankita10r commented on a change in pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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



##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       GLAccountNotFoundException is a more accurate exception rather than the one thrown by Optional (NoSuchElementException)




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] ankita10r commented on a change in pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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



##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       We are using java 8 syntax, instead of null check we are using optional.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] ankita10r commented on a change in pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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



##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       We are using java 8 synataxes, instead of null check we are using optional.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] awasum commented on pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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


   Good work you all. Please when a PR is merged like this one, remember to close the corresponding issue and also add the fix version so it will show up in the release statement for Fineract 1.6. I am going to close this issue for you all: https://issues.apache.org/jira/browse/FINERACT-1400


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] BLasan commented on a change in pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/chartofaccounts/ChartOfAccountsImportHandler.java
##########
@@ -109,44 +136,137 @@ private GLAccountData readGlAccounts(Row row) {
             tagIdCodeValueData = new CodeValueData(tagId);
         }
         String description = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL, row);
+        if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row) != null) {
+            flagForOpBal = 1;
+        } else {
+            flagForOpBal = 0;
+        }
         return GLAccountData.importInstance(accountName, parentId, glCode, manualEntriesAllowed, accountTypeEnum, usageEnum, description,
                 tagIdCodeValueData, row.getRowNum());
     }
 
-    public Count importEntity() {
+    public Count importEntity(String dateFormat) {

Review comment:
       Are we reassigning the parameter?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       What's the exact use of `Optional` here since we're throwing a `GLAccountNotFoundException` exception in `findOneByGlCode` ?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/chartofaccounts/ChartOfAccountsWorkbook.java
##########
@@ -108,38 +129,48 @@ private void setRules(Sheet chartOfAccountsSheet) {
         DataValidationConstraint parentConstraint = validationHelper
                 .createFormulaListConstraint("INDIRECT(CONCATENATE(\"AccountName_\",$A1))");
         DataValidationConstraint tagConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Tags_\",$A1))");
+        DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
+        DataValidationConstraint currencyCodeConstraint = validationHelper.createExplicitListConstraint(getCurrency());
 
         DataValidation accountTypeValidation = validationHelper.createValidation(accountTypeConstraint, accountTypeRange);
         DataValidation accountUsageValidation = validationHelper.createValidation(accountUsageConstraint, accountUsageRange);
         DataValidation manualEntriesValidation = validationHelper.createValidation(booleanConstraint, manualEntriesAllowedRange);
         DataValidation parentValidation = validationHelper.createValidation(parentConstraint, parentRange);
         DataValidation tagValidation = validationHelper.createValidation(tagConstraint, tagRange);
+        DataValidation officeNameValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
+        DataValidation currencyCodeValidation = validationHelper.createValidation(currencyCodeConstraint, currencyCodeRange);
 
         chartOfAccountsSheet.addValidationData(accountTypeValidation);
         chartOfAccountsSheet.addValidationData(accountUsageValidation);
         chartOfAccountsSheet.addValidationData(manualEntriesValidation);
         chartOfAccountsSheet.addValidationData(parentValidation);
         chartOfAccountsSheet.addValidationData(tagValidation);
+        chartOfAccountsSheet.addValidationData(officeNameValidation);
+        chartOfAccountsSheet.addValidationData(currencyCodeValidation);
     }
 
-    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList) {
+    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList, List<OfficeData> offices) {

Review comment:
       Make parameters `final` if not reassigning

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/chartofaccounts/ChartOfAccountsImportHandler.java
##########
@@ -53,24 +63,40 @@
     private static final Logger LOG = LoggerFactory.getLogger(ChartOfAccountsImportHandler.class);
     private List<GLAccountData> glAccounts;
     private Workbook workbook;
+    private LocalDate transactionDate;
+
+    // for opening bal
+    int flagForOpBal = 0;
+    private List<JournalEntryData> gltransaction;
+    List<CreditDebit> credits = new ArrayList<>();
+    List<CreditDebit> debits = new ArrayList<>();
+    String locale;
 
     private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+    private final GLAccountRepositoryWrapper glAccountRepository;
 
     @Autowired
-    public ChartOfAccountsImportHandler(final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
+    public ChartOfAccountsImportHandler(final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
+            GLAccountRepositoryWrapper glAccountRepository) {
         this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
+        this.glAccountRepository = glAccountRepository;
     }
 
     @Override
     public Count process(Workbook workbook, String locale, String dateFormat) {

Review comment:
       `final String dateFormat` ?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/chartofaccounts/ChartOfAccountsWorkbook.java
##########
@@ -108,38 +129,48 @@ private void setRules(Sheet chartOfAccountsSheet) {
         DataValidationConstraint parentConstraint = validationHelper
                 .createFormulaListConstraint("INDIRECT(CONCATENATE(\"AccountName_\",$A1))");
         DataValidationConstraint tagConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Tags_\",$A1))");
+        DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
+        DataValidationConstraint currencyCodeConstraint = validationHelper.createExplicitListConstraint(getCurrency());
 
         DataValidation accountTypeValidation = validationHelper.createValidation(accountTypeConstraint, accountTypeRange);
         DataValidation accountUsageValidation = validationHelper.createValidation(accountUsageConstraint, accountUsageRange);
         DataValidation manualEntriesValidation = validationHelper.createValidation(booleanConstraint, manualEntriesAllowedRange);
         DataValidation parentValidation = validationHelper.createValidation(parentConstraint, parentRange);
         DataValidation tagValidation = validationHelper.createValidation(tagConstraint, tagRange);
+        DataValidation officeNameValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
+        DataValidation currencyCodeValidation = validationHelper.createValidation(currencyCodeConstraint, currencyCodeRange);
 
         chartOfAccountsSheet.addValidationData(accountTypeValidation);
         chartOfAccountsSheet.addValidationData(accountUsageValidation);
         chartOfAccountsSheet.addValidationData(manualEntriesValidation);
         chartOfAccountsSheet.addValidationData(parentValidation);
         chartOfAccountsSheet.addValidationData(tagValidation);
+        chartOfAccountsSheet.addValidationData(officeNameValidation);
+        chartOfAccountsSheet.addValidationData(currencyCodeValidation);
     }
 
-    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList) {
+    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList, List<OfficeData> offices) {
         Workbook chartOfAccountsWorkbook = chartOfAccountsSheet.getWorkbook();
         for (Integer i = 0; i < accountTypesNoDuplicatesList.size(); i++) {
             Name tags = chartOfAccountsWorkbook.createName();
             Integer[] tagValueBeginEndIndexes = accountTypeToBeginEndIndexesofAccountNames.get(i);
             if (accountTypeToBeginEndIndexesofAccountNames != null) {
                 setSanitized(tags, "Tags_" + accountTypesNoDuplicatesList.get(i));
-                tags.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$S$" + tagValueBeginEndIndexes[0]
-                        + ":$S$" + tagValueBeginEndIndexes[1]);
+                tags.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$V$" + tagValueBeginEndIndexes[0]
+                        + ":$V$" + tagValueBeginEndIndexes[1]);
             }
             Name accountNames = chartOfAccountsWorkbook.createName();
             Integer[] accountNamesBeginEndIndexes = accountTypeToBeginEndIndexesofAccountNames.get(i);
             if (accountNamesBeginEndIndexes != null) {
                 setSanitized(accountNames, "AccountName_" + accountTypesNoDuplicatesList.get(i));
-                accountNames.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$Q$"
-                        + accountNamesBeginEndIndexes[0] + ":$Q$" + accountNamesBeginEndIndexes[1]);
+                accountNames.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$T$"
+                        + accountNamesBeginEndIndexes[0] + ":$T$" + accountNamesBeginEndIndexes[1]);
             }
         }
+        Name officeGroup = chartOfAccountsWorkbook.createName();
+        officeGroup.setNameName("Office");
+        officeGroup.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$X$2:$X$" + (offices.size() + 1));
+
     }
 
     private void setDefaults(Sheet worksheet) {

Review comment:
       Same as above

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/chartofaccounts/ChartOfAccountsImportHandler.java
##########
@@ -109,44 +136,137 @@ private GLAccountData readGlAccounts(Row row) {
             tagIdCodeValueData = new CodeValueData(tagId);
         }
         String description = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL, row);
+        if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row) != null) {
+            flagForOpBal = 1;
+        } else {
+            flagForOpBal = 0;
+        }
         return GLAccountData.importInstance(accountName, parentId, glCode, manualEntriesAllowed, accountTypeEnum, usageEnum, description,
                 tagIdCodeValueData, row.getRowNum());
     }
 
-    public Count importEntity() {
+    public Count importEntity(String dateFormat) {
         Sheet chartOfAccountsSheet = workbook.getSheet(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME);
 
         GsonBuilder gsonBuilder = new GsonBuilder();
         gsonBuilder.registerTypeAdapter(EnumOptionData.class, new EnumOptionDataIdSerializer());
         gsonBuilder.registerTypeAdapter(CodeValueData.class, new CodeValueDataIdSerializer());
+        gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat));
+        gsonBuilder.registerTypeAdapter(CurrencyData.class, new CurrencyDateCodeSerializer());
         int successCount = 0;
         int errorCount = 0;
         String errorMessage = "";
-        for (GLAccountData glAccount : glAccounts) {
-            try {
-                String payload = gsonBuilder.create().toJson(glAccount);
-                final CommandWrapper commandRequest = new CommandWrapperBuilder() //
-                        .createGLAccount() //
-                        .withJson(payload) //
-                        .build(); //
-                final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
-                successCount++;
-                Cell statusCell = chartOfAccountsSheet.getRow(glAccount.getRowIndex()).createCell(ChartOfAcountsConstants.STATUS_COL);
-                statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
-                statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
-            } catch (RuntimeException ex) {
-                errorCount++;
-                LOG.error("Problem occurred in importEntity function", ex);
-                errorMessage = ImportHandlerUtils.getErrorMessage(ex);
-                ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, glAccount.getRowIndex(), errorMessage,
-                        ChartOfAcountsConstants.STATUS_COL);
+
+        if (glAccounts != null) {
+            for (GLAccountData glAccount : glAccounts) {
+                try {
+                    String payload = gsonBuilder.create().toJson(glAccount);
+                    final CommandWrapper commandRequest = new CommandWrapperBuilder() //
+                            .createGLAccount() //
+                            .withJson(payload) //
+                            .build(); //
+                    final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
+                    successCount++;
+                    Cell statusCell = chartOfAccountsSheet.getRow(glAccount.getRowIndex()).createCell(ChartOfAcountsConstants.STATUS_COL);
+                    statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
+                    statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
+                } catch (RuntimeException ex) {
+                    errorCount++;
+                    LOG.error("Problem occurred in importEntity function", ex);
+                    errorMessage = ImportHandlerUtils.getErrorMessage(ex);
+                    ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, glAccount.getRowIndex(), errorMessage,
+                            ChartOfAcountsConstants.STATUS_COL);
+                }
+            }
+            if (flagForOpBal > 0) {
+
+                try {
+                    readExcelFileForOpBal(locale, dateFormat);
+                    JournalEntryData transaction = gltransaction.get(gltransaction.size() - 1);
+                    String payload = gsonBuilder.create().toJson(transaction);
+
+                    final CommandWrapper commandRequest = new CommandWrapperBuilder().defineOpeningBalanceForJournalEntry()
+                            .withJson(payload).build();
+                    final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
+                    successCount++;
+                    Cell statusCell = chartOfAccountsSheet.getRow(1).createCell(ChartOfAcountsConstants.STATUS_COL);
+                    statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
+                    statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
+                } catch (RuntimeException ex) {
+                    errorCount++;
+                    LOG.error("Problem occurred in importEntity function", ex);
+                    errorMessage = ImportHandlerUtils.getErrorMessage(ex);
+                    ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, 1, errorMessage, ChartOfAcountsConstants.STATUS_COL);
+                }
             }
+            chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
+            ImportHandlerUtils.writeString(ChartOfAcountsConstants.STATUS_COL,
+                    chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX),
+                    TemplatePopulateImportConstants.STATUS_COLUMN_HEADER);
+            return Count.instance(successCount, errorCount);
         }
+
         chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
         ImportHandlerUtils.writeString(ChartOfAcountsConstants.STATUS_COL,
                 chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX),
                 TemplatePopulateImportConstants.STATUS_COLUMN_HEADER);
         return Count.instance(successCount, errorCount);
+
     }
 
+    // for opening balance
+    public void readExcelFileForOpBal(final String locale, final String dateFormat) {
+
+        Sheet chartOfAccountsSheet = workbook.getSheet(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME);
+        Integer noOfEntries = ImportHandlerUtils.getNumberOfRows(chartOfAccountsSheet, TemplatePopulateImportConstants.FIRST_COLUMN_INDEX);
+        for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
+            Row row;
+            row = chartOfAccountsSheet.getRow(rowIndex);
+
+            //
+            JournalEntryData journalEntry = null;
+            journalEntry = readAddJournalEntries(row, locale, dateFormat);
+            gltransaction.add(journalEntry);
+        }
+
+    }
+
+    // for opening balance
+    private JournalEntryData readAddJournalEntries(Row row, String locale, String dateFormat) {
+        LocalDate transactionDateCheck = LocalDate.now(ZoneId.systemDefault());
+        if (transactionDateCheck != null) {
+            transactionDate = transactionDateCheck;
+        }
+
+        String officeName = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row);
+        Long officeId = ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.OFFICE_COL_ID, row);
+
+        String currencyCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.CURRENCY_CODE, row);
+        String accountToBeDebitedCredited = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.ACCOUNT_NAME_COL, row);
+        String glCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.GL_CODE_COL, row);
+        GLAccount glAccount = this.glAccountRepository.findOneByGlCodeWithNotFoundDetection(glCode);
+        Long glAccountIdToDebitedCredited = glAccount.getId();
+        if (glAccountIdToDebitedCredited == null) {
+            throw new RuntimeException("Account does not exist");
+        }
+
+        // String credit =

Review comment:
       Is this needed?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryData.java
##########
@@ -98,6 +140,11 @@ public static JournalEntryData importInstance(Long officeId, LocalDate transacti
                 checkNumber, routingCode, receiptNumber, bankNumber, comments, locale, dateFormat);
     }
 
+    public static JournalEntryData importInstance1(Long officeId, LocalDate transactionDate, String currencyCode, List<CreditDebit> credits,

Review comment:
       Make parameters final




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] avikganguly01 merged pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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



[GitHub] [fineract] BLasan commented on a change in pull request #1890: FINERACT-1400 Bulkimport to import opening balances for Ledgers

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



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/chartofaccounts/ChartOfAccountsImportHandler.java
##########
@@ -109,44 +136,137 @@ private GLAccountData readGlAccounts(Row row) {
             tagIdCodeValueData = new CodeValueData(tagId);
         }
         String description = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL, row);
+        if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row) != null) {
+            flagForOpBal = 1;
+        } else {
+            flagForOpBal = 0;
+        }
         return GLAccountData.importInstance(accountName, parentId, glCode, manualEntriesAllowed, accountTypeEnum, usageEnum, description,
                 tagIdCodeValueData, row.getRowNum());
     }
 
-    public Count importEntity() {
+    public Count importEntity(String dateFormat) {

Review comment:
       Are we reassigning the parameter?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountRepository.java
##########
@@ -18,9 +18,12 @@
  */
 package org.apache.fineract.accounting.glaccount.domain;
 
+import java.util.Optional;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 
 public interface GLAccountRepository extends JpaRepository<GLAccount, Long>, JpaSpecificationExecutor<GLAccount> {
     // no added behaviour
+    //adding behaviour to fetch id by glcode for opening balance bulk import
+    Optional<GLAccount> findOneByGlCode(String glCode);

Review comment:
       What's the exact use of `Optional` here since we're throwing a `GLAccountNotFoundException` exception in `findOneByGlCode` ?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/chartofaccounts/ChartOfAccountsWorkbook.java
##########
@@ -108,38 +129,48 @@ private void setRules(Sheet chartOfAccountsSheet) {
         DataValidationConstraint parentConstraint = validationHelper
                 .createFormulaListConstraint("INDIRECT(CONCATENATE(\"AccountName_\",$A1))");
         DataValidationConstraint tagConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Tags_\",$A1))");
+        DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
+        DataValidationConstraint currencyCodeConstraint = validationHelper.createExplicitListConstraint(getCurrency());
 
         DataValidation accountTypeValidation = validationHelper.createValidation(accountTypeConstraint, accountTypeRange);
         DataValidation accountUsageValidation = validationHelper.createValidation(accountUsageConstraint, accountUsageRange);
         DataValidation manualEntriesValidation = validationHelper.createValidation(booleanConstraint, manualEntriesAllowedRange);
         DataValidation parentValidation = validationHelper.createValidation(parentConstraint, parentRange);
         DataValidation tagValidation = validationHelper.createValidation(tagConstraint, tagRange);
+        DataValidation officeNameValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
+        DataValidation currencyCodeValidation = validationHelper.createValidation(currencyCodeConstraint, currencyCodeRange);
 
         chartOfAccountsSheet.addValidationData(accountTypeValidation);
         chartOfAccountsSheet.addValidationData(accountUsageValidation);
         chartOfAccountsSheet.addValidationData(manualEntriesValidation);
         chartOfAccountsSheet.addValidationData(parentValidation);
         chartOfAccountsSheet.addValidationData(tagValidation);
+        chartOfAccountsSheet.addValidationData(officeNameValidation);
+        chartOfAccountsSheet.addValidationData(currencyCodeValidation);
     }
 
-    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList) {
+    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList, List<OfficeData> offices) {

Review comment:
       Make parameters `final` if not reassigning

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/chartofaccounts/ChartOfAccountsImportHandler.java
##########
@@ -53,24 +63,40 @@
     private static final Logger LOG = LoggerFactory.getLogger(ChartOfAccountsImportHandler.class);
     private List<GLAccountData> glAccounts;
     private Workbook workbook;
+    private LocalDate transactionDate;
+
+    // for opening bal
+    int flagForOpBal = 0;
+    private List<JournalEntryData> gltransaction;
+    List<CreditDebit> credits = new ArrayList<>();
+    List<CreditDebit> debits = new ArrayList<>();
+    String locale;
 
     private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+    private final GLAccountRepositoryWrapper glAccountRepository;
 
     @Autowired
-    public ChartOfAccountsImportHandler(final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
+    public ChartOfAccountsImportHandler(final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
+            GLAccountRepositoryWrapper glAccountRepository) {
         this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
+        this.glAccountRepository = glAccountRepository;
     }
 
     @Override
     public Count process(Workbook workbook, String locale, String dateFormat) {

Review comment:
       `final String dateFormat` ?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/chartofaccounts/ChartOfAccountsWorkbook.java
##########
@@ -108,38 +129,48 @@ private void setRules(Sheet chartOfAccountsSheet) {
         DataValidationConstraint parentConstraint = validationHelper
                 .createFormulaListConstraint("INDIRECT(CONCATENATE(\"AccountName_\",$A1))");
         DataValidationConstraint tagConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Tags_\",$A1))");
+        DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
+        DataValidationConstraint currencyCodeConstraint = validationHelper.createExplicitListConstraint(getCurrency());
 
         DataValidation accountTypeValidation = validationHelper.createValidation(accountTypeConstraint, accountTypeRange);
         DataValidation accountUsageValidation = validationHelper.createValidation(accountUsageConstraint, accountUsageRange);
         DataValidation manualEntriesValidation = validationHelper.createValidation(booleanConstraint, manualEntriesAllowedRange);
         DataValidation parentValidation = validationHelper.createValidation(parentConstraint, parentRange);
         DataValidation tagValidation = validationHelper.createValidation(tagConstraint, tagRange);
+        DataValidation officeNameValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
+        DataValidation currencyCodeValidation = validationHelper.createValidation(currencyCodeConstraint, currencyCodeRange);
 
         chartOfAccountsSheet.addValidationData(accountTypeValidation);
         chartOfAccountsSheet.addValidationData(accountUsageValidation);
         chartOfAccountsSheet.addValidationData(manualEntriesValidation);
         chartOfAccountsSheet.addValidationData(parentValidation);
         chartOfAccountsSheet.addValidationData(tagValidation);
+        chartOfAccountsSheet.addValidationData(officeNameValidation);
+        chartOfAccountsSheet.addValidationData(currencyCodeValidation);
     }
 
-    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList) {
+    private void setNames(Sheet chartOfAccountsSheet, List<String> accountTypesNoDuplicatesList, List<OfficeData> offices) {
         Workbook chartOfAccountsWorkbook = chartOfAccountsSheet.getWorkbook();
         for (Integer i = 0; i < accountTypesNoDuplicatesList.size(); i++) {
             Name tags = chartOfAccountsWorkbook.createName();
             Integer[] tagValueBeginEndIndexes = accountTypeToBeginEndIndexesofAccountNames.get(i);
             if (accountTypeToBeginEndIndexesofAccountNames != null) {
                 setSanitized(tags, "Tags_" + accountTypesNoDuplicatesList.get(i));
-                tags.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$S$" + tagValueBeginEndIndexes[0]
-                        + ":$S$" + tagValueBeginEndIndexes[1]);
+                tags.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$V$" + tagValueBeginEndIndexes[0]
+                        + ":$V$" + tagValueBeginEndIndexes[1]);
             }
             Name accountNames = chartOfAccountsWorkbook.createName();
             Integer[] accountNamesBeginEndIndexes = accountTypeToBeginEndIndexesofAccountNames.get(i);
             if (accountNamesBeginEndIndexes != null) {
                 setSanitized(accountNames, "AccountName_" + accountTypesNoDuplicatesList.get(i));
-                accountNames.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$Q$"
-                        + accountNamesBeginEndIndexes[0] + ":$Q$" + accountNamesBeginEndIndexes[1]);
+                accountNames.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$T$"
+                        + accountNamesBeginEndIndexes[0] + ":$T$" + accountNamesBeginEndIndexes[1]);
             }
         }
+        Name officeGroup = chartOfAccountsWorkbook.createName();
+        officeGroup.setNameName("Office");
+        officeGroup.setRefersToFormula(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME + "!$X$2:$X$" + (offices.size() + 1));
+
     }
 
     private void setDefaults(Sheet worksheet) {

Review comment:
       Same as above

##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/chartofaccounts/ChartOfAccountsImportHandler.java
##########
@@ -109,44 +136,137 @@ private GLAccountData readGlAccounts(Row row) {
             tagIdCodeValueData = new CodeValueData(tagId);
         }
         String description = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL, row);
+        if (ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row) != null) {
+            flagForOpBal = 1;
+        } else {
+            flagForOpBal = 0;
+        }
         return GLAccountData.importInstance(accountName, parentId, glCode, manualEntriesAllowed, accountTypeEnum, usageEnum, description,
                 tagIdCodeValueData, row.getRowNum());
     }
 
-    public Count importEntity() {
+    public Count importEntity(String dateFormat) {
         Sheet chartOfAccountsSheet = workbook.getSheet(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME);
 
         GsonBuilder gsonBuilder = new GsonBuilder();
         gsonBuilder.registerTypeAdapter(EnumOptionData.class, new EnumOptionDataIdSerializer());
         gsonBuilder.registerTypeAdapter(CodeValueData.class, new CodeValueDataIdSerializer());
+        gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat));
+        gsonBuilder.registerTypeAdapter(CurrencyData.class, new CurrencyDateCodeSerializer());
         int successCount = 0;
         int errorCount = 0;
         String errorMessage = "";
-        for (GLAccountData glAccount : glAccounts) {
-            try {
-                String payload = gsonBuilder.create().toJson(glAccount);
-                final CommandWrapper commandRequest = new CommandWrapperBuilder() //
-                        .createGLAccount() //
-                        .withJson(payload) //
-                        .build(); //
-                final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
-                successCount++;
-                Cell statusCell = chartOfAccountsSheet.getRow(glAccount.getRowIndex()).createCell(ChartOfAcountsConstants.STATUS_COL);
-                statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
-                statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
-            } catch (RuntimeException ex) {
-                errorCount++;
-                LOG.error("Problem occurred in importEntity function", ex);
-                errorMessage = ImportHandlerUtils.getErrorMessage(ex);
-                ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, glAccount.getRowIndex(), errorMessage,
-                        ChartOfAcountsConstants.STATUS_COL);
+
+        if (glAccounts != null) {
+            for (GLAccountData glAccount : glAccounts) {
+                try {
+                    String payload = gsonBuilder.create().toJson(glAccount);
+                    final CommandWrapper commandRequest = new CommandWrapperBuilder() //
+                            .createGLAccount() //
+                            .withJson(payload) //
+                            .build(); //
+                    final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
+                    successCount++;
+                    Cell statusCell = chartOfAccountsSheet.getRow(glAccount.getRowIndex()).createCell(ChartOfAcountsConstants.STATUS_COL);
+                    statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
+                    statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
+                } catch (RuntimeException ex) {
+                    errorCount++;
+                    LOG.error("Problem occurred in importEntity function", ex);
+                    errorMessage = ImportHandlerUtils.getErrorMessage(ex);
+                    ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, glAccount.getRowIndex(), errorMessage,
+                            ChartOfAcountsConstants.STATUS_COL);
+                }
+            }
+            if (flagForOpBal > 0) {
+
+                try {
+                    readExcelFileForOpBal(locale, dateFormat);
+                    JournalEntryData transaction = gltransaction.get(gltransaction.size() - 1);
+                    String payload = gsonBuilder.create().toJson(transaction);
+
+                    final CommandWrapper commandRequest = new CommandWrapperBuilder().defineOpeningBalanceForJournalEntry()
+                            .withJson(payload).build();
+                    final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
+                    successCount++;
+                    Cell statusCell = chartOfAccountsSheet.getRow(1).createCell(ChartOfAcountsConstants.STATUS_COL);
+                    statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
+                    statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
+                } catch (RuntimeException ex) {
+                    errorCount++;
+                    LOG.error("Problem occurred in importEntity function", ex);
+                    errorMessage = ImportHandlerUtils.getErrorMessage(ex);
+                    ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet, 1, errorMessage, ChartOfAcountsConstants.STATUS_COL);
+                }
             }
+            chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
+            ImportHandlerUtils.writeString(ChartOfAcountsConstants.STATUS_COL,
+                    chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX),
+                    TemplatePopulateImportConstants.STATUS_COLUMN_HEADER);
+            return Count.instance(successCount, errorCount);
         }
+
         chartOfAccountsSheet.setColumnWidth(ChartOfAcountsConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
         ImportHandlerUtils.writeString(ChartOfAcountsConstants.STATUS_COL,
                 chartOfAccountsSheet.getRow(TemplatePopulateImportConstants.ROWHEADER_INDEX),
                 TemplatePopulateImportConstants.STATUS_COLUMN_HEADER);
         return Count.instance(successCount, errorCount);
+
     }
 
+    // for opening balance
+    public void readExcelFileForOpBal(final String locale, final String dateFormat) {
+
+        Sheet chartOfAccountsSheet = workbook.getSheet(TemplatePopulateImportConstants.CHART_OF_ACCOUNTS_SHEET_NAME);
+        Integer noOfEntries = ImportHandlerUtils.getNumberOfRows(chartOfAccountsSheet, TemplatePopulateImportConstants.FIRST_COLUMN_INDEX);
+        for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
+            Row row;
+            row = chartOfAccountsSheet.getRow(rowIndex);
+
+            //
+            JournalEntryData journalEntry = null;
+            journalEntry = readAddJournalEntries(row, locale, dateFormat);
+            gltransaction.add(journalEntry);
+        }
+
+    }
+
+    // for opening balance
+    private JournalEntryData readAddJournalEntries(Row row, String locale, String dateFormat) {
+        LocalDate transactionDateCheck = LocalDate.now(ZoneId.systemDefault());
+        if (transactionDateCheck != null) {
+            transactionDate = transactionDateCheck;
+        }
+
+        String officeName = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.OFFICE_COL, row);
+        Long officeId = ImportHandlerUtils.readAsLong(ChartOfAcountsConstants.OFFICE_COL_ID, row);
+
+        String currencyCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.CURRENCY_CODE, row);
+        String accountToBeDebitedCredited = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.ACCOUNT_NAME_COL, row);
+        String glCode = ImportHandlerUtils.readAsString(ChartOfAcountsConstants.GL_CODE_COL, row);
+        GLAccount glAccount = this.glAccountRepository.findOneByGlCodeWithNotFoundDetection(glCode);
+        Long glAccountIdToDebitedCredited = glAccount.getId();
+        if (glAccountIdToDebitedCredited == null) {
+            throw new RuntimeException("Account does not exist");
+        }
+
+        // String credit =

Review comment:
       Is this needed?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryData.java
##########
@@ -98,6 +140,11 @@ public static JournalEntryData importInstance(Long officeId, LocalDate transacti
                 checkNumber, routingCode, receiptNumber, bankNumber, comments, locale, dateFormat);
     }
 
+    public static JournalEntryData importInstance1(Long officeId, LocalDate transactionDate, String currencyCode, List<CreditDebit> credits,

Review comment:
       Make parameters final




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

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