Fix in Loan Product edition (#1905)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-11-21 10:35:15 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent f6edab0dd5
commit df8c90d9e6
6 changed files with 74 additions and 52 deletions
+13
View File
@@ -41,6 +41,7 @@
"moment": "^2.29.4", "moment": "^2.29.4",
"rxjs": "6.6.2", "rxjs": "6.6.2",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"vkbeautify": "^0.99.2",
"zone.js": "0.11.6" "zone.js": "0.11.6"
}, },
"devDependencies": { "devDependencies": {
@@ -59,6 +60,7 @@
"@types/jasminewd2": "2.0.6", "@types/jasminewd2": "2.0.6",
"@types/lodash": "4.14.132", "@types/lodash": "4.14.132",
"@types/node": "12.11.1", "@types/node": "12.11.1",
"@types/vkbeautify": "^0.99.2",
"codelyzer": "6.0.0", "codelyzer": "6.0.0",
"cypress": "^10.7.0", "cypress": "^10.7.0",
"git-describe": "^4.1.1", "git-describe": "^4.1.1",
@@ -4198,6 +4200,12 @@
"vfile-message": "*" "vfile-message": "*"
} }
}, },
"node_modules/@types/vkbeautify": {
"version": "0.99.4",
"resolved": "https://registry.npmjs.org/@types/vkbeautify/-/vkbeautify-0.99.4.tgz",
"integrity": "sha512-IB/vC9R2BPQJDbKaBwG6B8nnBKeu/RMYKVgVBoSiMjj3CmePsRqHaFNLiYov7sBn+CiGe6eqY9UslPv+TEyjvA==",
"dev": true
},
"node_modules/@types/ws": { "node_modules/@types/ws": {
"version": "8.5.8", "version": "8.5.8",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.8.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.8.tgz",
@@ -21791,6 +21799,11 @@
"unist-util-stringify-position": "^1.1.1" "unist-util-stringify-position": "^1.1.1"
} }
}, },
"node_modules/vkbeautify": {
"version": "0.99.3",
"resolved": "https://registry.npmjs.org/vkbeautify/-/vkbeautify-0.99.3.tgz",
"integrity": "sha512-2ozZEFfmVvQcHWoHLNuiKlUfDKlhh4KGsy54U0UrlLMR1SO+XKAIDqBxtBwHgNrekurlJwE8A9K6L49T78ZQ9Q=="
},
"node_modules/void-elements": { "node_modules/void-elements": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz",
+1 -1
View File
@@ -161,7 +161,7 @@ export class Datatables {
public isValidUrl(urlString: string): boolean { public isValidUrl(urlString: string): boolean {
try { try {
const url = new URL(urlString); const url = new URL(urlString);
return url.protocol.startsWith("http") || url.protocol.startsWith("https"); return url.protocol.startsWith('http') || url.protocol.startsWith('https');
} catch (e) { } catch (e) {
return false; return false;
} }
+1 -1
View File
@@ -10,7 +10,7 @@ export class PrettyPrintPipe implements PipeTransform {
if (value.charAt(0) === '{' && value.charAt(value.length - 1) === '}') { if (value.charAt(0) === '{' && value.charAt(value.length - 1) === '}') {
try { try {
return vkbeautify.json(value); return vkbeautify.json(value);
} catch(error) { } catch (error) {
return value; return value;
} }
} }
@@ -50,59 +50,68 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
this.penaltyToIncomeAccountMappings = this.loanProduct.penaltyToIncomeAccountMappings || []; this.penaltyToIncomeAccountMappings = this.loanProduct.penaltyToIncomeAccountMappings || [];
} else { } else {
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || []; this.accountingMappings = {};
const incomeAccountData = this.loanProductsTemplate.accountingMappingOptions.incomeAccountOptions || []; if ((this.loanProduct.accountingRule && this.loanProduct.accountingRule > 1) || this.loanProductsTemplate.accountingRule.value !== 'NONE') {
const expenseAccountData = this.loanProductsTemplate.accountingMappingOptions.expenseAccountOptions || []; const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || []; const incomeAccountData = this.loanProductsTemplate.accountingMappingOptions.incomeAccountOptions || [];
const assetAndLiabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || []; const expenseAccountData = this.loanProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
const assetAndLiabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];
this.accountingMappings = { this.accountingMappings = {
'fundSourceAccount': this.glAccountLookUp(this.loanProduct.fundSourceAccountId, assetAndLiabilityAccountData), 'fundSourceAccount': this.glAccountLookUp(this.loanProduct.fundSourceAccountId, assetAndLiabilityAccountData),
'loanPortfolioAccount': this.glAccountLookUp(this.loanProduct.loanPortfolioAccountId, assetAccountData), 'loanPortfolioAccount': this.glAccountLookUp(this.loanProduct.loanPortfolioAccountId, assetAccountData),
'receivableInterestAccount': this.glAccountLookUp(this.loanProduct.receivableInterestAccountId, assetAccountData), 'receivableInterestAccount': this.glAccountLookUp(this.loanProduct.receivableInterestAccountId, assetAccountData),
'receivableFeeAccount': this.glAccountLookUp(this.loanProduct.receivableFeeAccountId, assetAccountData), 'receivableFeeAccount': this.glAccountLookUp(this.loanProduct.receivableFeeAccountId, assetAccountData),
'receivablePenaltyAccount': this.glAccountLookUp(this.loanProduct.receivablePenaltyAccountId, assetAccountData), 'receivablePenaltyAccount': this.glAccountLookUp(this.loanProduct.receivablePenaltyAccountId, assetAccountData),
'transfersInSuspenseAccount': this.glAccountLookUp(this.loanProduct.transfersInSuspenseAccountId, assetAccountData), 'transfersInSuspenseAccount': this.glAccountLookUp(this.loanProduct.transfersInSuspenseAccountId, assetAccountData),
'interestOnLoanAccount': this.glAccountLookUp(this.loanProduct.interestOnLoanAccountId, incomeAccountData), 'interestOnLoanAccount': this.glAccountLookUp(this.loanProduct.interestOnLoanAccountId, incomeAccountData),
'incomeFromFeeAccount': this.glAccountLookUp(this.loanProduct.incomeFromFeeAccountId, incomeAccountData), 'incomeFromFeeAccount': this.glAccountLookUp(this.loanProduct.incomeFromFeeAccountId, incomeAccountData),
'incomeFromPenaltyAccount': this.glAccountLookUp(this.loanProduct.incomeFromPenaltyAccountId, incomeAccountData), 'incomeFromPenaltyAccount': this.glAccountLookUp(this.loanProduct.incomeFromPenaltyAccountId, incomeAccountData),
'incomeFromRecoveryAccount': this.glAccountLookUp(this.loanProduct.incomeFromRecoveryAccountId, incomeAccountData), 'incomeFromRecoveryAccount': this.glAccountLookUp(this.loanProduct.incomeFromRecoveryAccountId, incomeAccountData),
'incomeFromChargeOffInterestAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffInterestAccountId, incomeAccountData), 'incomeFromChargeOffInterestAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffInterestAccountId, incomeAccountData),
'incomeFromChargeOffFeesAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffFeesAccountId, incomeAccountData), 'incomeFromChargeOffFeesAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffFeesAccountId, incomeAccountData),
'incomeFromChargeOffPenaltyAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffPenaltyAccountId, incomeAccountData), 'incomeFromChargeOffPenaltyAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffPenaltyAccountId, incomeAccountData),
'writeOffAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData), 'writeOffAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
'goodwillCreditAccount': this.glAccountLookUp(this.loanProduct.goodwillCreditAccountId, expenseAccountData), 'goodwillCreditAccount': this.glAccountLookUp(this.loanProduct.goodwillCreditAccountId, expenseAccountData),
'chargeOffExpenseAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData), 'chargeOffExpenseAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
'chargeOffFraudExpenseAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData), 'chargeOffFraudExpenseAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
'overpaymentLiabilityAccount': this.glAccountLookUp(this.loanProduct.overpaymentLiabilityAccountId, liabilityAccountData), 'overpaymentLiabilityAccount': this.glAccountLookUp(this.loanProduct.overpaymentLiabilityAccountId, liabilityAccountData),
}; };
const paymentTypesData = this.loanProductsTemplate.paymentTypeOptions || [];
this.loanProduct.paymentChannelToFundSourceMappings.forEach((m: any) => { if (this.loanProduct.paymentChannelToFundSourceMappings?.length > 0) {
this.paymentChannelToFundSourceMappings.push({ const paymentTypesData = this.loanProductsTemplate.paymentTypeOptions || [];
fundSourceAccount: this.glAccountLookUp(m.fundSourceAccountId, assetAndLiabilityAccountData), this.loanProduct.paymentChannelToFundSourceMappings.forEach((m: any) => {
paymentType: this.paymentTypeLookUp(m.paymentTypeId, paymentTypesData) this.paymentChannelToFundSourceMappings.push({
}); fundSourceAccount: this.glAccountLookUp(m.fundSourceAccountId, assetAndLiabilityAccountData),
}); paymentType: this.paymentTypeLookUp(m.paymentTypeId, paymentTypesData)
});
});
}
this.feeToIncomeAccountMappings = []; this.feeToIncomeAccountMappings = [];
this.loanProduct.feeToIncomeAccountMappings.forEach((m: any) => { if (this.loanProduct.feeToIncomeAccountMappings?.length > 0) {
this.feeToIncomeAccountMappings.push({ this.loanProduct.feeToIncomeAccountMappings.forEach((m: any) => {
incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData), this.feeToIncomeAccountMappings.push({
charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.chargeOptions) incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData),
}); charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.chargeOptions)
}); });
});
}
this.penaltyToIncomeAccountMappings = []; this.penaltyToIncomeAccountMappings = [];
this.loanProduct.penaltyToIncomeAccountMappings.forEach((m: any) => { if (this.loanProduct.penaltyToIncomeAccountMappings?.length > 0) {
this.penaltyToIncomeAccountMappings.push({ this.loanProduct.penaltyToIncomeAccountMappings.forEach((m: any) => {
incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData), this.penaltyToIncomeAccountMappings.push({
charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.penaltyOptions) incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData),
}); charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.penaltyOptions)
}); });
});
}
}
if (this.loanProduct.isInterestRecalculationEnabled) { if (this.loanProduct.isInterestRecalculationEnabled) {
this.loanProduct.interestRecalculationData = { this.loanProduct.interestRecalculationData = {
@@ -144,7 +144,7 @@ export class DatatableSingleRowComponent implements OnInit {
return columnDisplayType; return columnDisplayType;
} }
case 'TEXT': { case 'TEXT': {
if (columnType == 'JSON') { if (columnType === 'JSON') {
return 'JSON'; return 'JSON';
} else { } else {
return columnDisplayType; return columnDisplayType;
+2 -2
View File
@@ -2,8 +2,8 @@
/* tslint:disable */ /* tslint:disable */
export default { export default {
'mifos_x': { 'mifos_x': {
'version': '0.0.0', 'version': '231121',
'hash': '9b40d307' 'hash': 'f6edab0d'
}, },
'allow_switching_backend_instance': true 'allow_switching_backend_instance': true
}; };