From 72456b7a55179c1b814f584d87a978f0876cb705 Mon Sep 17 00:00:00 2001 From: ankita10r <92036361+ankita10r@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:45:46 +0530 Subject: [PATCH] Fineract-1410 Allow Payment types to map to all types of Ledgers (#3429) --- app/global-translations/locale-en.json | 2 + .../EditConfigurationController.js | 2 +- .../product/CreateSavingProductController.js | 24 +++++++- .../product/EditSavingProductController.js | 30 +++++++-- .../editGlobalConfiguration.html | 61 +++++++++++-------- 5 files changed, 84 insertions(+), 35 deletions(-) diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 51cc80d5..bcf8388f 100644 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -1467,6 +1467,7 @@ "label.input.interestchargedfrom": "Interest charged from", "label.input.firstrepaymenton": "First repayment on", "label.input.value": "Value", + "label.input.stringValue": "String Value", "label.input.existingclient": "Existing client", "label.input.approvedondate": "Approved on", "label.input.rejectedondate": "Rejected on", @@ -2896,6 +2897,7 @@ "label.tooltip.global.rounding-mode": "Enabling this entity causes the rounding of amounts to be performed. Possible values: 0 - UP, 1 - DOWN, 2 - CEILING, 3 - FLOOR, 4 - HALF_UP, 5 - HALF_DOWN, 6 - HALF_EVEN", "label.tooltip.global.savings-interest-posting-current-period-end": "This entity is recommended to be changed only once during the start of production. When set as false (default), the interest will be posted on the first date of the next period. If set as true, the interest will be posted on the last date of the current period. There is no difference in the interest amount posted.", "label.tooltip.global.skip-repayment-on-first-day-of-month": "Determines whether a repayment landing on the first day of a month will be skipped.", + "label.tooltip.global.account-mapping-for-payment-type":"String value: Asset as default for asset, Or use comma seperated values for Liability, Asset and Expense accounts", "#----------------": "------------", "#Admin-Products": "....", "#Headings": "..", diff --git a/app/scripts/controllers/configurations/EditConfigurationController.js b/app/scripts/controllers/configurations/EditConfigurationController.js index df72aaa3..78b30a21 100755 --- a/app/scripts/controllers/configurations/EditConfigurationController.js +++ b/app/scripts/controllers/configurations/EditConfigurationController.js @@ -4,7 +4,7 @@ scope.configId = routeParams.configId; resourceFactory.configurationResource.get({id: scope.configId}, function (data) { - scope.formData = {value: data.value}; + scope.formData = {value: data.value, stringValue: data.stringValue}; }); scope.cancel = function () { location.path('/global'); diff --git a/app/scripts/controllers/product/CreateSavingProductController.js b/app/scripts/controllers/product/CreateSavingProductController.js index bf17c351..0304d450 100644 --- a/app/scripts/controllers/product/CreateSavingProductController.js +++ b/app/scripts/controllers/product/CreateSavingProductController.js @@ -18,6 +18,24 @@ scope.liabilityAccountOptions = scope.product.accountingMappingOptions.liabilityAccountOptions || []; scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; + scope.paymentOptions = []; + // + scope.accountMappingForPayment = scope.product.accountMappingForPayment.toLowerCase(); + var accountMappingForPaymentVar = scope.accountMappingForPayment; + if(accountMappingForPaymentVar.indexOf("asset") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.assetAccountOptions); + } + if(accountMappingForPaymentVar.indexOf("liability") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.liabilityAccountOptions); + } + if(accountMappingForPaymentVar.indexOf("expense") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.expenseAccountOptions); + } + if(accountMappingForPaymentVar.indexOf("income") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.incomeAccountOptions); + } + + scope.formData.currencyCode = data.currencyOptions[0].code; scope.formData.digitsAfterDecimal = data.currencyOptions[0].decimalPlaces; @@ -78,12 +96,12 @@ scope.addConfigureFundSource = function () { if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && - scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { + scope.paymentOptions && scope.paymentOptions.length > 0) { scope.configureFundOptions.push({ paymentTypeId: scope.product.paymentTypeOptions[0].id, - fundSourceAccountId: scope.assetAccountOptions[0].id, + fundSourceAccountId: scope.paymentOptions[0].id, paymentTypeOptions: scope.product.paymentTypeOptions, - assetAccountOptions: scope.assetAccountOptions + assetAccountOptions: scope.paymentOptions }); } ; diff --git a/app/scripts/controllers/product/EditSavingProductController.js b/app/scripts/controllers/product/EditSavingProductController.js index 4d9e70ac..59b39ec4 100755 --- a/app/scripts/controllers/product/EditSavingProductController.js +++ b/app/scripts/controllers/product/EditSavingProductController.js @@ -45,6 +45,23 @@ daysToDormancy: data.daysToDormancy, daysToEscheat: data.daysToEscheat } + scope.paymentOptions = []; + // + scope.accountMappingForPayment = scope.product.accountMappingForPayment.toLowerCase(); + var accountMappingForPaymentVar = scope.accountMappingForPayment; + if(accountMappingForPaymentVar.indexOf("asset") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.assetAccountOptions); + } + if(accountMappingForPaymentVar.indexOf("liability") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.liabilityAccountOptions); + } + if(accountMappingForPaymentVar.indexOf("expense") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.expenseAccountOptions); + } + if(accountMappingForPaymentVar.indexOf("income") > -1){ + scope.paymentOptions = scope.paymentOptions.concat(scope.incomeAccountOptions); + } + if(data.withHoldTax){ scope.formData.taxGroupId = data.taxGroup.id; @@ -65,6 +82,8 @@ scope.formData.overdraftPortfolioControlId = data.accountingMappings.overdraftPortfolioControl.id; scope.formData.incomeFromInterestId = data.accountingMappings.incomeFromInterest.id; + + _.each(scope.product.paymentChannelToFundSourceMappings, function (fundSource) { scope.configureFundOptions.push({ paymentTypeId: fundSource.paymentType.id, @@ -73,7 +92,7 @@ assetAccountOptions: scope.assetAccountOptions }) }); - + _.each(scope.product.feeToIncomeAccountMappings, function (fees) { scope.specificIncomeaccounts.push({ chargeId: fees.charge.id, @@ -120,16 +139,17 @@ scope.charges.splice(index, 1); } - scope.addConfigureFundSource = function () { + scope.addConfigureFundSource = function () { if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && - scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { + scope.paymentOptions && scope.paymentOptions.length > 0) { scope.configureFundOptions.push({ paymentTypeId: scope.product.paymentTypeOptions[0].id, - fundSourceAccountId: scope.assetAccountOptions[0].id, + fundSourceAccountId: scope.paymentOptions[0].id, paymentTypeOptions: scope.product.paymentTypeOptions, - assetAccountOptions: scope.assetAccountOptions + assetAccountOptions: scope.paymentOptions }); } + ; } scope.mapFees = function () { diff --git a/app/views/administration/editGlobalConfiguration.html b/app/views/administration/editGlobalConfiguration.html index 9cacd9d0..7ab2a0df 100755 --- a/app/views/administration/editGlobalConfiguration.html +++ b/app/views/administration/editGlobalConfiguration.html @@ -1,31 +1,40 @@
- -
- -
- {{ 'label.anchor.editconfiguration' | translate }} -
- + + + +
+ {{ 'label.anchor.editconfiguration' | translate }} +
+ -
- - +
+ + +
+
+ +
+ +
+ + +
-
+ -
- - -
-
- +
+ + +
+
+
\ No newline at end of file