Added the TransactionForm instance to the constructor of the JournalEntryEditor instance, so that the journal entry editor holds an instance of the transaction form, too. It does not need to find the transaction form all the way from the side property that may not be available. Retired the redundant getTransactionForm method from the JournalEntryEditor class.
This commit is contained in:
@ -28,6 +28,12 @@
|
||||
*/
|
||||
class JournalEntryEditor {
|
||||
|
||||
/**
|
||||
* The transaction form
|
||||
* @type {TransactionForm}
|
||||
*/
|
||||
form;
|
||||
|
||||
/**
|
||||
* The journal entry editor
|
||||
* @type {HTMLFormElement}
|
||||
@ -193,8 +199,10 @@ class JournalEntryEditor {
|
||||
/**
|
||||
* Constructs a new journal entry editor.
|
||||
*
|
||||
* @param form {TransactionForm} the transaction form
|
||||
*/
|
||||
constructor() {
|
||||
constructor(form) {
|
||||
this.form = form;
|
||||
this.#element = document.getElementById(this.#prefix);
|
||||
this.#modal = document.getElementById(this.#prefix + "-modal");
|
||||
this.#originalEntryContainer = document.getElementById(this.#prefix + "-original-entry-container");
|
||||
@ -288,15 +296,6 @@ class JournalEntryEditor {
|
||||
return this.#side.currency.getCurrencyCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the transaction form.
|
||||
*
|
||||
* @return {TransactionForm} the transaction form
|
||||
*/
|
||||
getTransactionForm() {
|
||||
return this.#side.currency.form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the summary from the summary editor.
|
||||
*
|
||||
@ -554,7 +553,7 @@ class JournalEntryEditor {
|
||||
if (this.originalEntryId === null) {
|
||||
return null;
|
||||
}
|
||||
return OriginalEntrySelector.getNetBalance(this.entry, this.getTransactionForm(), this.originalEntryId);
|
||||
return OriginalEntrySelector.getNetBalance(this.entry, this.form, this.originalEntryId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user