Revised so that when the account selector finds the codes from the form, the journal entry editor is used to find the form instead of messing-up with the TransactionForm class and its static method that was a shortcut to the private instance method of the same name.
This commit is contained in:
		@@ -150,7 +150,7 @@ class AccountSelector {
 | 
				
			|||||||
     * @return {string[]} the account codes that are used in the form
 | 
					     * @return {string[]} the account codes that are used in the form
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    #getCodesUsedInForm() {
 | 
					    #getCodesUsedInForm() {
 | 
				
			||||||
        const inUse = TransactionForm.getAccountCodesUsed(this.#entryType);
 | 
					        const inUse = this.#entryEditor.getTransactionForm().getAccountCodesUsed(this.#entryType);
 | 
				
			||||||
        if (this.#entryEditor.getAccountCode() !== null) {
 | 
					        if (this.#entryEditor.getAccountCode() !== null) {
 | 
				
			||||||
            inUse.push(this.#entryEditor.getAccountCode());
 | 
					            inUse.push(this.#entryEditor.getAccountCode());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,6 +150,15 @@ class JournalEntryEditor {
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Returns the transaction form.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return {TransactionForm} the transaction form
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    getTransactionForm() {
 | 
				
			||||||
 | 
					        return this.#side.currency.form;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Saves the summary from the summary editor.
 | 
					     * Saves the summary from the summary editor.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -184,7 +184,7 @@ class TransactionForm {
 | 
				
			|||||||
     * @param entryType {string} the entry type, either "debit" or "credit"
 | 
					     * @param entryType {string} the entry type, either "debit" or "credit"
 | 
				
			||||||
     * @return {string[]} the account codes used in the form
 | 
					     * @return {string[]} the account codes used in the form
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    #getAccountCodesUsed(entryType) {
 | 
					    getAccountCodesUsed(entryType) {
 | 
				
			||||||
        let inUse = [];
 | 
					        let inUse = [];
 | 
				
			||||||
        for (const currency of this.#currencies) {
 | 
					        for (const currency of this.#currencies) {
 | 
				
			||||||
            inUse = inUse.concat(currency.getAccountCodesUsed(entryType));
 | 
					            inUse = inUse.concat(currency.getAccountCodesUsed(entryType));
 | 
				
			||||||
@@ -280,16 +280,6 @@ class TransactionForm {
 | 
				
			|||||||
    static initialize() {
 | 
					    static initialize() {
 | 
				
			||||||
        this.#form = new TransactionForm()
 | 
					        this.#form = new TransactionForm()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Returns the account codes used in the form.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param entryType {string} the entry type, either "debit" or "credit"
 | 
					 | 
				
			||||||
     * @return {string[]} the account codes used in the form
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    static getAccountCodesUsed(entryType) {
 | 
					 | 
				
			||||||
        return this.#form.#getAccountCodesUsed(entryType);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user