From 3792524022748ef40ed9beac9c549d4f64b705b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 5 Dec 2022 19:32:43 +0800 Subject: [PATCH] Replaced the deprecated JavaScript String.substr with String.substring. --- src/accounting/static/accounting/js/account-form.js | 4 ++-- src/accounting/static/accounting/js/summary-helper.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/accounting/static/accounting/js/account-form.js b/src/accounting/static/accounting/js/account-form.js index fe7e976..c13e73a 100644 --- a/src/accounting/static/accounting/js/account-form.js +++ b/src/accounting/static/accounting/js/account-form.js @@ -75,7 +75,7 @@ function updateParent(code) { parent.text(gettext("Topmost")); return; } - const parentCode = code.value.substr(0, code.value.length - 1); + const parentCode = code.value.substring(0, code.value.length - 1); if (parentCode in accounts) { parent.text(parentCode + " " + accounts[parentCode]); return; @@ -136,7 +136,7 @@ function validateCode() { return false; } } - const parentCode = code.value.substr(0, code.value.length - 1); + const parentCode = code.value.substring(0, code.value.length - 1); if (!(parentCode in accounts)) { code.classList.add("is-invalid"); errorMessage.text(gettext("The parent account of this code does not exist.")); diff --git a/src/accounting/static/accounting/js/summary-helper.js b/src/accounting/static/accounting/js/summary-helper.js index 510bc40..73fcbe2 100644 --- a/src/accounting/static/accounting/js/summary-helper.js +++ b/src/accounting/static/accounting/js/summary-helper.js @@ -298,7 +298,7 @@ function parseSummaryForHelper(summary) { const pos = summary.lastIndexOf("×"); let count = 1; if (pos !== -1) { - count = parseInt(summary.substr(pos + 1)); + count = parseInt(summary.substring(pos + 1)); } if (count === 0) { count = 1;