diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 840899a917e4..6e6fee2c7f3e 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -416,7 +416,6 @@ class InvoiceController extends BaseController $invoice->service() ->triggeredActions($request) - // ->deletePdf() ->adjustInventory($old_invoice); event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index ed1b81be267c..49aab1475955 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -28,7 +28,7 @@ class ClientContactRepository extends BaseRepository public function save(array $data, Client $client) : void { - //06-09-2022 sometimes users pass a contact object instead of a nested array, this sequence handles this scenario + if (isset($data['contacts']) && (count($data['contacts']) !== count($data['contacts'], COUNT_RECURSIVE))) { $contacts = collect($data['contacts']); } elseif (isset($data['contacts'])) { diff --git a/app/Repositories/VendorContactRepository.php b/app/Repositories/VendorContactRepository.php index b2b1647fcfce..c4ef35da7dc4 100644 --- a/app/Repositories/VendorContactRepository.php +++ b/app/Repositories/VendorContactRepository.php @@ -25,8 +25,12 @@ class VendorContactRepository extends BaseRepository public function save(array $data, Vendor $vendor) : void { - if (isset($data['contacts'])) { + + if (isset($data['contacts']) && (count($data['contacts']) !== count($data['contacts'], COUNT_RECURSIVE))) { $contacts = collect($data['contacts']); + } elseif (isset($data['contacts'])) { + $temp_array[] = $data['contacts']; + $contacts = collect($temp_array); } else { $contacts = collect(); } @@ -80,10 +84,10 @@ class VendorContactRepository extends BaseRepository }); - $vendor->load('contacts'); + $vendor->fresh(); //always made sure we have one blank contact to maintain state - if ($vendor->contacts->count() == 0) { + if ($vendor->contacts()->count() == 0) { $new_contact = new VendorContact; $new_contact->vendor_id = $vendor->id; $new_contact->company_id = $vendor->company_id; diff --git a/openapi/api-docs.yaml b/openapi/api-docs.yaml index ef6b3ef4bcab..dc93a0e0cb96 100644 --- a/openapi/api-docs.yaml +++ b/openapi/api-docs.yaml @@ -17855,18 +17855,22 @@ components: description: 'The hashed if of the contact' type: string example: Opnel5aKBz + readOnly: true user_id: description: 'The hashed id of the user who created the contact' type: string example: Opnel5aKBz + readOnly: true company_id: description: 'The hashed id of the company' type: string example: Opnel5aKBz + readOnly: true client_id: description: 'The hashed id of the client' type: string example: Opnel5aKBz + readOnly: true first_name: description: 'The first name of the contact' type: string @@ -17903,18 +17907,26 @@ components: description: 'The terms of service which the contact has accpeted' type: string example: 'A long set of ToS' + readOnly: true password: description: 'The hashed password of the contact' type: string example: '*****' - confirmation-code: + confirmation_code: description: 'The confirmation code used to authenticate the contacts email address' type: string example: 333-sdjkh34gbasd + readOnly: true token: description: 'A uuid based token.' type: string example: 333-sdjkh34gbasd + readOnly: true + contact_key: + description: 'A unique identifier for the contact' + type: string + example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a + readOnly: true is_primary: description: 'Defines is this contact is the primary contact for the client' type: boolean @@ -17936,31 +17948,37 @@ components: type: number format: integer example: '3' + readOnly: true email_verified_at: description: 'The date which the contact confirmed their email' type: number format: integer example: '134341234234' + readOnly: true last_login: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true created_at: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true updated_at: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true deleted_at: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true type: object ClientContactRequest: properties: @@ -18021,14 +18039,17 @@ components: description: 'The hashed id of the user id' type: string example: Opnel5aKBz + readOnly: true company_id: description: 'The hashed id of the company' type: string example: Opnel5aKBz + readOnly: true vendor_id: description: 'The hashed id of the vendor' type: string example: Opnel5aKBz + readOnly: true first_name: description: 'The first name of the contact' type: string @@ -18037,6 +18058,16 @@ components: description: 'The last name of the contact' type: string example: Windsor + contact_key: + description: 'A unique identifier for the contact' + type: string + example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a + readOnly: true + confirmation_code: + description: 'The confirmation code used to authenticate the contacts email address' + type: string + example: 333-sdjkh34gbasd + readOnly: true phone: description: 'The contacts phone number' type: string @@ -18061,6 +18092,16 @@ components: description: 'The contact email address' type: string example: harry@windsor.com + email_verified_at: + description: 'The date which the contact confirmed their email' + type: number + format: integer + example: '134341234234' + readOnly: true + password: + description: 'The hashed password of the contact' + type: string + example: '*****' is_primary: description: 'Boolean flag determining if the contact is the primary contact for the vendor' type: boolean @@ -19392,10 +19433,6 @@ components: description: 'The hashed id of the company. This is a unique identifier for the company.' type: string example: Opnel5aKBz - client_id: - description: 'The hashed id of the client. This is a unique identifier for the client.' - type: string - example: Opnel5aKBz contacts: type: array items: @@ -19525,8 +19562,6 @@ components: type: string example: 'Bob the vendor' readOnly: true - settings: - $ref: '#/components/schemas/CompanySettings' type: object ClientSettings: required: diff --git a/openapi/components/schemas/client_contact.yaml b/openapi/components/schemas/client_contact.yaml index aaf1c1bef6e3..4127b3448d7a 100644 --- a/openapi/components/schemas/client_contact.yaml +++ b/openapi/components/schemas/client_contact.yaml @@ -4,18 +4,22 @@ description: 'The hashed if of the contact' type: string example: Opnel5aKBz + readOnly: true user_id: description: 'The hashed id of the user who created the contact' type: string example: Opnel5aKBz + readOnly: true company_id: description: 'The hashed id of the company' type: string example: Opnel5aKBz + readOnly: true client_id: description: 'The hashed id of the client' type: string example: Opnel5aKBz + readOnly: true first_name: description: 'The first name of the contact' type: string @@ -52,18 +56,26 @@ description: 'The terms of service which the contact has accpeted' type: string example: 'A long set of ToS' + readOnly: true password: description: 'The hashed password of the contact' type: string example: '*****' - confirmation-code: + confirmation_code: description: 'The confirmation code used to authenticate the contacts email address' type: string example: 333-sdjkh34gbasd + readOnly: true token: description: 'A uuid based token.' type: string example: 333-sdjkh34gbasd + readOnly: true + contact_key: + description: 'A unique identifier for the contact' + type: string + example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a + readOnly: true is_primary: description: 'Defines is this contact is the primary contact for the client' type: boolean @@ -85,29 +97,35 @@ type: number format: integer example: '3' + readOnly: true email_verified_at: description: 'The date which the contact confirmed their email' type: number format: integer example: '134341234234' + readOnly: true last_login: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true created_at: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true updated_at: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true deleted_at: description: Timestamp type: number format: integer example: '134341234234' + readOnly: true type: object \ No newline at end of file diff --git a/openapi/components/schemas/vendor.yaml b/openapi/components/schemas/vendor.yaml index 26d92809f19d..7af19f263ee5 100644 --- a/openapi/components/schemas/vendor.yaml +++ b/openapi/components/schemas/vendor.yaml @@ -17,10 +17,6 @@ description: 'The hashed id of the company. This is a unique identifier for the company.' type: string example: Opnel5aKBz - client_id: - description: 'The hashed id of the client. This is a unique identifier for the client.' - type: string - example: Opnel5aKBz contacts: type: array items: @@ -150,6 +146,4 @@ type: string example: 'Bob the vendor' readOnly: true - settings: - $ref: '#/components/schemas/CompanySettings' type: object \ No newline at end of file diff --git a/openapi/components/schemas/vendor_contact.yaml b/openapi/components/schemas/vendor_contact.yaml index b413a54576ca..f2c57c53cf59 100644 --- a/openapi/components/schemas/vendor_contact.yaml +++ b/openapi/components/schemas/vendor_contact.yaml @@ -9,14 +9,17 @@ description: 'The hashed id of the user id' type: string example: Opnel5aKBz + readOnly: true company_id: description: 'The hashed id of the company' type: string example: Opnel5aKBz + readOnly: true vendor_id: description: 'The hashed id of the vendor' type: string example: Opnel5aKBz + readOnly: true first_name: description: 'The first name of the contact' type: string @@ -25,6 +28,16 @@ description: 'The last name of the contact' type: string example: Windsor + contact_key: + description: 'A unique identifier for the contact' + type: string + example: JD0X52bkfZlJRiroCJ0tcSiAjsJTntZ5uqKdiZ0a + readOnly: true + confirmation_code: + description: 'The confirmation code used to authenticate the contacts email address' + type: string + example: 333-sdjkh34gbasd + readOnly: true phone: description: 'The contacts phone number' type: string @@ -49,6 +62,16 @@ description: 'The contact email address' type: string example: harry@windsor.com + email_verified_at: + description: 'The date which the contact confirmed their email' + type: number + format: integer + example: '134341234234' + readOnly: true + password: + description: 'The hashed password of the contact' + type: string + example: '*****' is_primary: description: 'Boolean flag determining if the contact is the primary contact for the vendor' type: boolean