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

This commit is contained in:
2023-04-03 09:32:08 +08:00
parent 2f9d2e36cb
commit 4adc464d3d
2 changed files with 9 additions and 20 deletions

View File

@ -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.
*