Revised the saveDescription method of the JavaScript JournalEntryLineItemEditor to accept the description editor instead of the separated description and account values.

This commit is contained in:
2023-04-03 10:25:47 +08:00
parent f2a2fcdd32
commit e1a0380628
2 changed files with 14 additions and 15 deletions

View File

@ -316,23 +316,22 @@ class JournalEntryLineItemEditor {
/**
* Saves the description from the description editor.
*
* @param description {string} the description
* @param account {DescriptionEditorAccount|null} the suggested account
* @param editor {DescriptionEditor} the description editor
*/
saveDescription(description, account = null) {
if (account !== null) {
saveDescription(editor) {
if (editor.selectedAccount !== null) {
this.#accountControl.classList.add("accounting-not-empty");
this.account = account.copy();
this.#accountText.innerText = account.text;
this.account = editor.selectedAccount.copy();
this.#accountText.innerText = editor.selectedAccount.text;
this.#validateAccount();
}
if (description === "") {
if (editor.description === "") {
this.#descriptionControl.classList.remove("accounting-not-empty");
} else {
this.#descriptionControl.classList.add("accounting-not-empty");
}
this.description = description === ""? null: description;
this.#descriptionText.innerText = description;
this.description = editor.description === ""? null: editor.description;
this.#descriptionText.innerText = editor.description;
this.#validateDescription();
bootstrap.Modal.getOrCreateInstance(this.modal).show();
}