From d4b3fe67b9a538de3058ff9a3a6ccfc3a8849c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 19 Mar 2023 10:25:33 +0800 Subject: [PATCH] Removed the originalEntryId parameter from the onOpen method of the JavaScript OriginalEntrySelector class. It can be obtained from the JournalEntryEditor instance, and the parameter is not needed anymore. --- src/accounting/static/js/journal-entry-editor.js | 2 +- src/accounting/static/js/original-entry-selector.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/accounting/static/js/journal-entry-editor.js b/src/accounting/static/js/journal-entry-editor.js index 1f9eb09..18899bd 100644 --- a/src/accounting/static/js/journal-entry-editor.js +++ b/src/accounting/static/js/journal-entry-editor.js @@ -239,7 +239,7 @@ class JournalEntryEditor { this.#summaryEditors = SummaryEditor.getInstances(this); this.#accountSelectors = AccountSelector.getInstances(this); this.originalEntrySelector = new OriginalEntrySelector(this); - this.#originalEntryControl.onclick = () => this.originalEntrySelector.onOpen(this.originalEntryId) + this.#originalEntryControl.onclick = () => this.originalEntrySelector.onOpen() this.#originalEntryDelete.onclick = () => this.clearOriginalEntry(); this.#summaryControl.onclick = () => this.#summaryEditors[this.entryType].onOpen(); this.#accountControl.onclick = () => this.#accountSelectors[this.entryType].onOpen(); diff --git a/src/accounting/static/js/original-entry-selector.js b/src/accounting/static/js/original-entry-selector.js index b006128..79d091b 100644 --- a/src/accounting/static/js/original-entry-selector.js +++ b/src/accounting/static/js/original-entry-selector.js @@ -176,13 +176,12 @@ class OriginalEntrySelector { /** * The callback when the original entry selector is shown. * - * @param originalEntryId {string|null} the ID of the original entry */ - onOpen(originalEntryId = null) { + onOpen() { this.#currencyCode = this.entryEditor.getCurrencyCode(); this.#entryType = this.entryEditor.entryType; for (const option of this.#options) { - option.setActive(option.id === originalEntryId); + option.setActive(option.id === this.entryEditor.originalEntryId); } this.#query.value = ""; this.#updateNetBalances();