Added the copy() method to the JavaScript JournalEntryAccount class, and replaced the accountCode and accountText fields with the account field in the OriginalLineItem class.
This commit is contained in:
parent
1cb8a7563e
commit
94391b02a6
@ -279,7 +279,7 @@ class JournalEntryLineItemEditor {
|
|||||||
this.description = originalLineItem.description === ""? null: originalLineItem.description;
|
this.description = originalLineItem.description === ""? null: originalLineItem.description;
|
||||||
this.#descriptionText.innerText = originalLineItem.description;
|
this.#descriptionText.innerText = originalLineItem.description;
|
||||||
this.#accountControl.classList.add("accounting-not-empty");
|
this.#accountControl.classList.add("accounting-not-empty");
|
||||||
this.account = new JournalEntryAccount(originalLineItem.accountCode, originalLineItem.accountText, false);
|
this.account = originalLineItem.account.copy();
|
||||||
this.#accountText.innerText = this.account.text;
|
this.#accountText.innerText = this.account.text;
|
||||||
this.#amountInput.value = String(originalLineItem.netBalance);
|
this.#amountInput.value = String(originalLineItem.netBalance);
|
||||||
this.#amountInput.max = String(originalLineItem.netBalance);
|
this.#amountInput.max = String(originalLineItem.netBalance);
|
||||||
@ -607,4 +607,13 @@ class JournalEntryAccount {
|
|||||||
this.text = text;
|
this.text = text;
|
||||||
this.isNeedOffset = isNeedOffset;
|
this.isNeedOffset = isNeedOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a copy of the account.
|
||||||
|
*
|
||||||
|
* @return {JournalEntryAccount} the copy of the account
|
||||||
|
*/
|
||||||
|
copy() {
|
||||||
|
return new JournalEntryAccount(this.code, this.text, this.isNeedOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,16 +230,10 @@ class OriginalLineItem {
|
|||||||
#currencyCode;
|
#currencyCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The account code
|
* The account
|
||||||
* @type {string}
|
* @type {JournalEntryAccount}
|
||||||
*/
|
*/
|
||||||
accountCode;
|
account;
|
||||||
|
|
||||||
/**
|
|
||||||
* The account text
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
accountText;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The description
|
* The description
|
||||||
@ -290,8 +284,7 @@ class OriginalLineItem {
|
|||||||
this.date = element.dataset.date;
|
this.date = element.dataset.date;
|
||||||
this.#debitCredit = element.dataset.debitCredit;
|
this.#debitCredit = element.dataset.debitCredit;
|
||||||
this.#currencyCode = element.dataset.currencyCode;
|
this.#currencyCode = element.dataset.currencyCode;
|
||||||
this.accountCode = element.dataset.accountCode;
|
this.account = new JournalEntryAccount(element.dataset.accountCode, element.dataset.accountText, false);
|
||||||
this.accountText = element.dataset.accountText;
|
|
||||||
this.description = element.dataset.description;
|
this.description = element.dataset.description;
|
||||||
this.bareNetBalance = new Decimal(element.dataset.netBalance);
|
this.bareNetBalance = new Decimal(element.dataset.netBalance);
|
||||||
this.netBalance = this.bareNetBalance;
|
this.netBalance = this.bareNetBalance;
|
||||||
|
Loading…
Reference in New Issue
Block a user