Revised the parameters of the saveDescriptionWithAccount method of the JavaScript JournalEntryLineItemEditor class to accept an DescriptionEditorAccount instance instead of the individual account values.
This commit is contained in:
		| @@ -264,7 +264,7 @@ class DescriptionEditor { | |||||||
|     #submit() { |     #submit() { | ||||||
|         bootstrap.Modal.getOrCreateInstance(this.#modal).hide(); |         bootstrap.Modal.getOrCreateInstance(this.#modal).hide(); | ||||||
|         if (this.#selectedAccount !== null) { |         if (this.#selectedAccount !== null) { | ||||||
|             this.lineItemEditor.saveDescriptionWithAccount(this.description.value, this.#selectedAccount.code, this.#selectedAccount.text, this.#selectedAccount.isNeedOffset); |             this.lineItemEditor.saveDescriptionWithAccount(this.description.value, this.#selectedAccount); | ||||||
|         } else { |         } else { | ||||||
|             this.lineItemEditor.saveDescription(this.description.value); |             this.lineItemEditor.saveDescription(this.description.value); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -334,14 +334,12 @@ class JournalEntryLineItemEditor { | |||||||
|      * Saves the description with the suggested account from the description editor. |      * Saves the description with the suggested account from the description editor. | ||||||
|      * |      * | ||||||
|      * @param description {string} the description |      * @param description {string} the description | ||||||
|      * @param accountCode {string} the account code |      * @param account {DescriptionEditorAccount} the suggested account | ||||||
|      * @param accountText {string} the account text |  | ||||||
|      * @param isAccountNeedOffset {boolean} true if the line items in the account need offset, or false otherwise |  | ||||||
|      */ |      */ | ||||||
|     saveDescriptionWithAccount(description, accountCode, accountText, isAccountNeedOffset) { |     saveDescriptionWithAccount(description, account) { | ||||||
|         this.#accountControl.classList.add("accounting-not-empty"); |         this.#accountControl.classList.add("accounting-not-empty"); | ||||||
|         this.account = new JournalEntryAccount(accountCode, accountText, isAccountNeedOffset); |         this.account = account.copy(); | ||||||
|         this.#accountText.innerText = accountText; |         this.#accountText.innerText = account.text; | ||||||
|         this.#validateAccount(); |         this.#validateAccount(); | ||||||
|         this.saveDescription(description) |         this.saveDescription(description) | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user