Merged the saveDescriptionWithAccount into the saveDescription method in the JavaScript JournalEntryLineItemEditor class.

This commit is contained in:
imacat committed 2023-04-03 19:12:06 +08:00
1 parent 2f9d2e36cb
commit 4adc464d3d
2 files changed
+9 -20

No files matched your search

@@ -317,8 +317,15 @@ class JournalEntryLineItemEditor {
* Saves the description from the description editor.
*
* @param description {string} the description
* @param account {DescriptionEditorAccount|null} the suggested account
*/
saveDescription(description) {
saveDescription(description, account = null) {
if (account !== null) {
this.#accountControl.classList.add("accounting-not-empty");
this.account = account.copy();
this.#accountText.innerText = account.text;
this.#validateAccount();
}
if (description === "") {
this.#descriptionControl.classList.remove("accounting-not-empty");
} else {
@@ -330,20 +337,6 @@ class JournalEntryLineItemEditor {
bootstrap.Modal.getOrCreateInstance(this.modal).show();
}
/**
* Saves the description with the suggested account from the description editor.
*
* @param description {string} the description
* @param account {DescriptionEditorAccount} the suggested account
*/
saveDescriptionWithAccount(description, account) {
this.#accountControl.classList.add("accounting-not-empty");
this.account = account.copy();
this.#accountText.innerText = account.text;
this.#validateAccount();
this.saveDescription(description)
}
/**
* Clears the account.
*