mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: record authorized user id for customer/vendor opening balance.
This commit is contained in:
@@ -19,8 +19,12 @@ export default class CustomersSubscriber {
|
||||
* Handles the writing opening balance journal entries once the customer created.
|
||||
*/
|
||||
@On(events.customers.onCreated)
|
||||
async handleWriteOpenBalanceEntries({ tenantId, customerId, customer }) {
|
||||
|
||||
async handleWriteOpenBalanceEntries({
|
||||
tenantId,
|
||||
customerId,
|
||||
customer,
|
||||
authorizedUser,
|
||||
}) {
|
||||
// Writes the customer opening balance journal entries.
|
||||
if (customer.openingBalance) {
|
||||
await this.customersService.writeCustomerOpeningBalanceJournal(
|
||||
@@ -28,6 +32,7 @@ export default class CustomersSubscriber {
|
||||
customer.id,
|
||||
customer.openingBalance,
|
||||
customer.openingBalanceAt,
|
||||
authorizedUser.id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,10 +41,14 @@ export default class CustomersSubscriber {
|
||||
* Handles the deleting opeing balance journal entrise once the customer deleted.
|
||||
*/
|
||||
@On(events.customers.onDeleted)
|
||||
async handleRevertOpeningBalanceEntries({ tenantId, customerId }) {
|
||||
|
||||
async handleRevertOpeningBalanceEntries({
|
||||
tenantId,
|
||||
customerId,
|
||||
authorizedUser,
|
||||
}) {
|
||||
await this.customersService.revertOpeningBalanceEntries(
|
||||
tenantId, customerId,
|
||||
tenantId,
|
||||
customerId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,10 +57,14 @@ export default class CustomersSubscriber {
|
||||
* customers deleted.
|
||||
*/
|
||||
@On(events.customers.onBulkDeleted)
|
||||
async handleBulkRevertOpeningBalanceEntries({ tenantId, customersIds }) {
|
||||
|
||||
async handleBulkRevertOpeningBalanceEntries({
|
||||
tenantId,
|
||||
customersIds,
|
||||
authorizedUser,
|
||||
}) {
|
||||
await this.customersService.revertOpeningBalanceEntries(
|
||||
tenantId, customersIds,
|
||||
tenantId,
|
||||
customersIds
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,15 @@ export default class VendorsSubscriber {
|
||||
* Writes the open balance journal entries once the vendor created.
|
||||
*/
|
||||
@On(events.vendors.onCreated)
|
||||
async handleWriteOpeningBalanceEntries({ tenantId, vendorId, vendor }) {
|
||||
async handleWriteOpeningBalanceEntries({ tenantId, vendorId, vendor, authorizedUser }) {
|
||||
// Writes the vendor opening balance journal entries.
|
||||
if (vendor.openingBalance) {
|
||||
await this.vendorsService.writeVendorOpeningBalanceJournal(
|
||||
tenantId,
|
||||
vendor.id,
|
||||
vendor.openingBalance,
|
||||
vendor.openingBalanceAt,
|
||||
authorizedUser.id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +39,7 @@ export default class VendorsSubscriber {
|
||||
* Revert the opening balance journal entries once the vendor deleted.
|
||||
*/
|
||||
@On(events.vendors.onDeleted)
|
||||
async handleRevertOpeningBalanceEntries({ tenantId, vendorId }) {
|
||||
async handleRevertOpeningBalanceEntries({ tenantId, vendorId, authorizedUser }) {
|
||||
await this.vendorsService.revertOpeningBalanceEntries(
|
||||
tenantId, vendorId,
|
||||
);
|
||||
@@ -47,7 +49,7 @@ export default class VendorsSubscriber {
|
||||
* Revert the opening balance journal entries once the vendors deleted in bulk.
|
||||
*/
|
||||
@On(events.vendors.onBulkDeleted)
|
||||
async handleBulkRevertOpeningBalanceEntries({ tenantId, vendorsIds }) {
|
||||
async handleBulkRevertOpeningBalanceEntries({ tenantId, vendorsIds, authorizedUser }) {
|
||||
await this.vendorsService.revertOpeningBalanceEntries(
|
||||
tenantId, vendorsIds,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user