fix: subtitle issue with sales transaction number.

This commit is contained in:
Ahmed Bouhuolia
2020-11-24 11:33:29 +02:00
parent 218d90c571
commit 9779591029
24 changed files with 218 additions and 76 deletions

View File

@@ -1,5 +1,5 @@
import { Inject, Service } from 'typedi';
import { omit, difference } from 'lodash';
import { omit, difference, defaultTo } from 'lodash';
import {
EventDispatcher,
EventDispatcherInterface,
@@ -51,8 +51,7 @@ export default class CustomersService {
return {
...omit(customerDTO, ['customerType']),
contactType: customerDTO.customerType,
active: (typeof customerDTO.active === 'undefined') ?
true : customerDTO.active,
active: defaultTo(customerDTO.active, true),
};
}

View File

@@ -1,5 +1,5 @@
import { Inject, Service } from 'typedi';
import { difference, rest } from 'lodash';
import { difference, defaultTo } from 'lodash';
import {
EventDispatcher,
EventDispatcherInterface,
@@ -45,8 +45,7 @@ export default class VendorsService {
private vendorToContactDTO(vendorDTO: IVendorNewDTO|IVendorEditDTO) {
return {
...vendorDTO,
active: (typeof vendorDTO.active === 'undefined') ?
true : vendorDTO.active,
active: defaultTo(vendorDTO.active, true),
};
}
@@ -62,6 +61,7 @@ export default class VendorsService {
const contactDTO = this.vendorToContactDTO(vendorDTO);
const vendor = await this.contactService.newContact(tenantId, contactDTO, 'vendor');
// Triggers `onVendorCreated` event.
await this.eventDispatcher.dispatch(events.vendors.onCreated, {
tenantId, vendorId: vendor.id, vendor,
});