Revised the saveDescription method of the JournalEntryLineItemEditor editor to also save the isAccountConfirmed status of the DescriptionEditor editor, so that when the user selected any suggested account other than the confirmed account, the confirmed account is released from the next edit.
This commit is contained in:
parent
f3d43a66cc
commit
562bc47be7
@ -116,7 +116,7 @@ class DescriptionEditor {
|
|||||||
* Whether the user has confirmed the account
|
* Whether the user has confirmed the account
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
#isAccountConfirmed = false;
|
isAccountConfirmed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The selected account.
|
* The selected account.
|
||||||
@ -247,7 +247,7 @@ class DescriptionEditor {
|
|||||||
* @param code {string} the code of the most-frequent suggested account
|
* @param code {string} the code of the most-frequent suggested account
|
||||||
*/
|
*/
|
||||||
#selectSuggestedAccount(code) {
|
#selectSuggestedAccount(code) {
|
||||||
if (this.#isAccountConfirmed) {
|
if (this.isAccountConfirmed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const account of this.#currentAccountOptions) {
|
for (const account of this.#currentAccountOptions) {
|
||||||
@ -284,7 +284,7 @@ class DescriptionEditor {
|
|||||||
}
|
}
|
||||||
this.selectedAccount = selectedAccount;
|
this.selectedAccount = selectedAccount;
|
||||||
if (this.selectedAccount !== null) {
|
if (this.selectedAccount !== null) {
|
||||||
this.#isAccountConfirmed &&= this.selectedAccount.isConfirmedAccount;
|
this.isAccountConfirmed &&= this.selectedAccount.isConfirmedAccount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ class DescriptionEditor {
|
|||||||
this.description = this.lineItemEditor.description === null? "": this.lineItemEditor.description;
|
this.description = this.lineItemEditor.description === null? "": this.lineItemEditor.description;
|
||||||
this.#setConfirmedAccount();
|
this.#setConfirmedAccount();
|
||||||
this.#onDescriptionChange();
|
this.#onDescriptionChange();
|
||||||
if (this.#isAccountConfirmed) {
|
if (this.isAccountConfirmed) {
|
||||||
this.selectAccount(this.#confirmedAccount);
|
this.selectAccount(this.#confirmedAccount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,9 +315,9 @@ class DescriptionEditor {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#setConfirmedAccount() {
|
#setConfirmedAccount() {
|
||||||
this.#isAccountConfirmed = this.lineItemEditor.isAccountConfirmed;
|
this.isAccountConfirmed = this.lineItemEditor.isAccountConfirmed;
|
||||||
this.#confirmedAccountPlaceholder.setShown(this.#isAccountConfirmed);
|
this.#confirmedAccountPlaceholder.setShown(this.isAccountConfirmed);
|
||||||
if (this.#isAccountConfirmed) {
|
if (this.isAccountConfirmed) {
|
||||||
this.#confirmedAccountPlaceholder.initializeFrom(this.lineItemEditor.account);
|
this.#confirmedAccountPlaceholder.initializeFrom(this.lineItemEditor.account);
|
||||||
this.#confirmedAccount = this.#confirmedAccountPlaceholder;
|
this.#confirmedAccount = this.#confirmedAccountPlaceholder;
|
||||||
} else {
|
} else {
|
||||||
|
@ -323,6 +323,7 @@ class JournalEntryLineItemEditor {
|
|||||||
this.#accountControl.classList.add("accounting-not-empty");
|
this.#accountControl.classList.add("accounting-not-empty");
|
||||||
this.account = editor.selectedAccount.copy();
|
this.account = editor.selectedAccount.copy();
|
||||||
this.#accountText.innerText = editor.selectedAccount.text;
|
this.#accountText.innerText = editor.selectedAccount.text;
|
||||||
|
this.isAccountConfirmed = editor.isAccountConfirmed;
|
||||||
this.#validateAccount();
|
this.#validateAccount();
|
||||||
}
|
}
|
||||||
if (editor.description === "") {
|
if (editor.description === "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user