diff --git a/app/Http/Requests/Account/CreateAccountRequest.php b/app/Http/Requests/Account/CreateAccountRequest.php index e1b51a8d12c6..4c6f8d2478d9 100644 --- a/app/Http/Requests/Account/CreateAccountRequest.php +++ b/app/Http/Requests/Account/CreateAccountRequest.php @@ -35,7 +35,6 @@ class CreateAccountRequest extends Request */ public function rules() { - $this->sanitize(); return [ //'email' => 'required|string|email|max:100', @@ -49,15 +48,15 @@ class CreateAccountRequest extends Request ]; } - public function sanitize() + protected function prepareForValidation() { + $input = $this->all(); $input['user_agent'] = request()->server('HTTP_USER_AGENT'); $this->replace($input); - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/Client/EditClientRequest.php b/app/Http/Requests/Client/EditClientRequest.php index 2d915595301c..65d5e6e496fc 100644 --- a/app/Http/Requests/Client/EditClientRequest.php +++ b/app/Http/Requests/Client/EditClientRequest.php @@ -27,15 +27,14 @@ class EditClientRequest extends Request return auth()->user()->can('edit', $this->client); } - public function sanitize() - { - $input = $this->all(); + // public function prepareForValidation() + // { + // $input = $this->all(); - //$input['id'] = $this->encodePrimaryKey($input['id']); + // //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); + // $this->replace($input); - return $this->all(); - } + // } } \ No newline at end of file diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 09717f23a751..b31d850a12bb 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -38,7 +38,6 @@ class StoreClientRequest extends Request public function rules() { - $this->sanitize(); /* Ensure we have a client name, and that all emails are unique*/ //$rules['name'] = 'required|min:1'; @@ -63,7 +62,7 @@ class StoreClientRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -74,9 +73,6 @@ class StoreClientRequest extends Request $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); $this->replace($input); - - return $this->all(); - } public function messages() diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 0ecc38206e3a..bdec9aa649e5 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -34,7 +34,6 @@ class UpdateClientRequest extends Request public function rules() { /* Ensure we have a client name, and that all emails are unique*/ - $this->sanitize(); $rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; $rules['industry_id'] = 'integer|nullable'; @@ -70,7 +69,7 @@ class UpdateClientRequest extends Request ]; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -80,7 +79,6 @@ class UpdateClientRequest extends Request $this->replace($input); - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/Company/EditCompanyRequest.php b/app/Http/Requests/Company/EditCompanyRequest.php index 12bb2ce8b293..2d4f39bfb619 100644 --- a/app/Http/Requests/Company/EditCompanyRequest.php +++ b/app/Http/Requests/Company/EditCompanyRequest.php @@ -35,15 +35,13 @@ class EditCompanyRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); - - return $this->all(); + $this->replace($input); } } \ No newline at end of file diff --git a/app/Http/Requests/Company/StoreCompanyRequest.php b/app/Http/Requests/Company/StoreCompanyRequest.php index a9999a0045f5..148e5a50424a 100644 --- a/app/Http/Requests/Company/StoreCompanyRequest.php +++ b/app/Http/Requests/Company/StoreCompanyRequest.php @@ -31,9 +31,7 @@ class StoreCompanyRequest extends Request public function rules() { - //$this->sanitize(); $rules = []; - $input = $this->all(); //$rules['name'] = 'required'; $rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb diff --git a/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php index 1749fad98e9d..3e209eb6073c 100644 --- a/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php @@ -35,15 +35,14 @@ class DestroyCompanyGatewayRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); + $this->replace($input); - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php index c66f13ad51b5..f961092cca1f 100644 --- a/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php @@ -35,15 +35,13 @@ class EditCompanyGatewayRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); - - return $this->all(); + $this->replace($input); } } \ No newline at end of file diff --git a/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php index 7ec9c97470a6..6d345143e270 100644 --- a/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php @@ -35,15 +35,13 @@ class ShowCompanyGatewayRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); - - return $this->all(); + $this->replace($input); } } \ No newline at end of file diff --git a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php index f75550266c8c..a1902944175e 100644 --- a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php @@ -34,8 +34,6 @@ class StoreCompanyGatewayRequest extends Request public function rules() { - $this->sanitize(); - $rules = [ 'gateway_key' => 'required', 'fees_and_limits' => new ValidCompanyGatewayFeesAndLimitsRule(), @@ -44,7 +42,7 @@ class StoreCompanyGatewayRequest extends Request return $rules; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -56,7 +54,6 @@ class StoreCompanyGatewayRequest extends Request $this->replace($input); - return $this->all(); } } diff --git a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php index 0dbf6fbd3673..4bd1f51dccb3 100644 --- a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php @@ -34,8 +34,6 @@ class UpdateCompanyGatewayRequest extends Request public function rules() { - $this->sanitize(); - $rules = [ 'fees_and_limits' => new ValidCompanyGatewayFeesAndLimitsRule(), ]; @@ -43,7 +41,7 @@ class UpdateCompanyGatewayRequest extends Request return $rules; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -53,8 +51,6 @@ class UpdateCompanyGatewayRequest extends Request $input['fees_and_limits'] = $this->cleanFeesAndLimits($input['fees_and_limits']); $this->replace($input); - - return $this->all(); } } diff --git a/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php b/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php index 988506546df9..5ce73e99dbf3 100644 --- a/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php @@ -27,15 +27,5 @@ class EditGroupSettingRequest extends Request return auth()->user()->can('edit', $this->group_setting); } - public function sanitize() - { - $input = $this->all(); - - //$input['id'] = $this->encodePrimaryKey($input['id']); - - //$this->replace($input); - - return $this->all(); - } } \ No newline at end of file diff --git a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php index 9e78078ba634..daf09f94a91d 100644 --- a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php @@ -34,7 +34,6 @@ class StoreGroupSettingRequest extends Request public function rules() { - $this->sanitize(); $rules['name'] = 'required'; $rules['settings'] = new ValidClientGroupSettingsRule(); @@ -42,7 +41,7 @@ class StoreGroupSettingRequest extends Request return $rules; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php b/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php index dd3008219df8..ba57f7cda404 100644 --- a/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php @@ -31,7 +31,6 @@ class UpdateGroupSettingRequest extends Request public function rules() { - $this->sanitize(); $rules['settings'] = new ValidClientGroupSettingsRule(); @@ -39,14 +38,12 @@ class UpdateGroupSettingRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); $this->replace($input); - return $this->all(); - } diff --git a/app/Http/Requests/Invoice/EditInvoiceRequest.php b/app/Http/Requests/Invoice/EditInvoiceRequest.php index 168d6b0623d2..298119fac236 100644 --- a/app/Http/Requests/Invoice/EditInvoiceRequest.php +++ b/app/Http/Requests/Invoice/EditInvoiceRequest.php @@ -34,16 +34,4 @@ class EditInvoiceRequest extends Request return $rules; } - - public function sanitize() - { - $input = $this->all(); - - //$input['id'] = $this->encodePrimaryKey($input['id']); - - //$this->replace($input); - - return $this->all(); - } - } \ No newline at end of file diff --git a/app/Http/Requests/Invoice/StoreInvoiceRequest.php b/app/Http/Requests/Invoice/StoreInvoiceRequest.php index 0fb25feeb6cf..4de673df18c9 100644 --- a/app/Http/Requests/Invoice/StoreInvoiceRequest.php +++ b/app/Http/Requests/Invoice/StoreInvoiceRequest.php @@ -35,8 +35,6 @@ class StoreInvoiceRequest extends Request public function rules() { - $this->sanitize(); - return [ 'client_id' => 'required', // 'invoice_type_id' => 'integer', @@ -44,7 +42,7 @@ class StoreInvoiceRequest extends Request ]; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -52,8 +50,6 @@ class StoreInvoiceRequest extends Request $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); $this->replace($input); - - return $this->all(); } } diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index 1d2cb4cd71e6..afd8cd66e188 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -38,8 +38,6 @@ class UpdateInvoiceRequest extends Request public function rules() { - $this->sanitize(); - return [ 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', //'client_id' => 'required|integer', @@ -47,7 +45,7 @@ class UpdateInvoiceRequest extends Request ]; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -57,7 +55,5 @@ class UpdateInvoiceRequest extends Request $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; $this->replace($input); - - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/Payment/EditPaymentRequest.php b/app/Http/Requests/Payment/EditPaymentRequest.php index 340091acc07d..0bebf8005f1d 100644 --- a/app/Http/Requests/Payment/EditPaymentRequest.php +++ b/app/Http/Requests/Payment/EditPaymentRequest.php @@ -35,15 +35,13 @@ class EditPaymentRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); - - return $this->all(); + $this->replace($input); } } \ No newline at end of file diff --git a/app/Http/Requests/Product/StoreProductRequest.php b/app/Http/Requests/Product/StoreProductRequest.php index 4baf5afc44b9..8ad944ec6400 100644 --- a/app/Http/Requests/Product/StoreProductRequest.php +++ b/app/Http/Requests/Product/StoreProductRequest.php @@ -29,7 +29,6 @@ class StoreProductRequest extends Request public function rules() { - $this->sanitize(); return [ 'product_key' => 'required|unique:products,product_key,null,null,company_id,'.auth()->user()->companyId(), @@ -39,7 +38,7 @@ class StoreProductRequest extends Request ]; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -48,7 +47,6 @@ class StoreProductRequest extends Request $this->replace($input); - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/Product/UpdateProductRequest.php b/app/Http/Requests/Product/UpdateProductRequest.php index 1e155fa89fb4..18c460f53656 100644 --- a/app/Http/Requests/Product/UpdateProductRequest.php +++ b/app/Http/Requests/Product/UpdateProductRequest.php @@ -32,9 +32,6 @@ class UpdateProductRequest extends Request public function rules() { - //when updating you need to ignore the column ID - $this->sanitize(); - return [ //'product_key' => 'unique:products,product_key,'.$this->product->id.',id,company_id,'.auth()->user()->companyId(), 'cost' => 'numeric', @@ -44,7 +41,7 @@ class UpdateProductRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -53,7 +50,6 @@ class UpdateProductRequest extends Request $this->replace($input); - return $this->all(); } } diff --git a/app/Http/Requests/Quote/EditQuoteRequest.php b/app/Http/Requests/Quote/EditQuoteRequest.php index 0ae76c743d22..2ee4253f525b 100644 --- a/app/Http/Requests/Quote/EditQuoteRequest.php +++ b/app/Http/Requests/Quote/EditQuoteRequest.php @@ -35,15 +35,14 @@ class EditQuoteRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); + $this->replace($input); - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/Quote/UpdateQuoteRequest.php b/app/Http/Requests/Quote/UpdateQuoteRequest.php index 288dbae40cbf..dbe32bf9517f 100644 --- a/app/Http/Requests/Quote/UpdateQuoteRequest.php +++ b/app/Http/Requests/Quote/UpdateQuoteRequest.php @@ -38,14 +38,12 @@ class UpdateQuoteRequest extends Request public function rules() { - $this->sanitize(); - return [ 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', ]; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -56,8 +54,6 @@ class UpdateQuoteRequest extends Request $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; $this->replace($input); - - return $this->all(); } } \ No newline at end of file diff --git a/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php index a8e403dad9e3..4e447a5e1235 100644 --- a/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php @@ -35,15 +35,13 @@ class EditRecurringInvoiceRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); - - return $this->all(); + $this->replace($input); } } \ No newline at end of file diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index 54e86add6277..b7fb12f9a00e 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -36,7 +36,7 @@ class StoreRecurringInvoiceRequest extends Request } - public function sanitize() + protected function prepareForValidation() { //do post processing of RecurringInvoice request here, ie. RecurringInvoice_items } diff --git a/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php index 7e14ea65f928..0ee5e0684081 100644 --- a/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php @@ -35,15 +35,13 @@ class EditRecurringQuoteRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); //$input['id'] = $this->encodePrimaryKey($input['id']); - //$this->replace($input); - - return $this->all(); + $this->replace($input); } } \ No newline at end of file diff --git a/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php index 25c8e344bb66..06f469541a7e 100644 --- a/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php @@ -37,16 +37,5 @@ class StoreRecurringQuoteRequest extends Request } - public function sanitize() - { - //do post processing of RecurringQuote request here, ie. RecurringQuote_items - } - - public function messages() - { - - } - - } diff --git a/app/Http/Requests/User/EditUserRequest.php b/app/Http/Requests/User/EditUserRequest.php index f2b050627793..9bd5d24892e8 100644 --- a/app/Http/Requests/User/EditUserRequest.php +++ b/app/Http/Requests/User/EditUserRequest.php @@ -35,15 +35,5 @@ class EditUserRequest extends Request } - public function sanitize() - { - $input = $this->all(); - - //$input['id'] = $this->encodePrimaryKey($input['id']); - - //$this->replace($input); - - return $this->all(); - } } \ No newline at end of file diff --git a/app/Http/Requests/User/StoreUserRequest.php b/app/Http/Requests/User/StoreUserRequest.php index 073f9b0c92cd..1871248c4ead 100644 --- a/app/Http/Requests/User/StoreUserRequest.php +++ b/app/Http/Requests/User/StoreUserRequest.php @@ -37,8 +37,6 @@ class StoreUserRequest extends Request public function rules() { - $this->sanitize(); - $rules = []; $rules['first_name'] = 'required|string|max:100'; @@ -53,7 +51,7 @@ class StoreUserRequest extends Request } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -78,8 +76,6 @@ class StoreUserRequest extends Request $this->replace($input); - return $this->all(); - } diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index d9b9e4974324..5677b13788e7 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -31,7 +31,6 @@ class UpdateUserRequest extends Request public function rules() { - $this->sanitize(); $input = $this->all(); $rules = []; @@ -42,7 +41,7 @@ class UpdateUserRequest extends Request return $rules; } - public function sanitize() + protected function prepareForValidation() { $input = $this->all(); @@ -50,8 +49,6 @@ class UpdateUserRequest extends Request unset($input['company_user']); $this->replace($input); - - return $this->all(); } diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index b0b3a9dab830..e6fea3679f8f 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -128,8 +128,6 @@ class InvoiceTransformer extends EntityTransformer 'custom_surcharge_taxes' => (bool) $invoice->custom_surcharge_taxes, 'line_items' => $invoice->line_items ?: (array)[], 'backup' => $invoice->backup ?: '', - 'settings' => $invoice->settings ?: '', - ]; } } \ No newline at end of file diff --git a/app/Transformers/QuoteInvitationTransformer.php b/app/Transformers/QuoteInvitationTransformer.php new file mode 100644 index 000000000000..71446447fe86 --- /dev/null +++ b/app/Transformers/QuoteInvitationTransformer.php @@ -0,0 +1,35 @@ + $this->encodePrimaryKey($invitation->id), + 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), + 'key' => $invitation->key, + 'link' => $invitation->getLink() ?: '', + 'sent_date' => $invitation->sent_date ?: '', + 'viewed_date' => $invitation->viewed_date ?: '', + 'opened_date' => $invitation->opened_date ?: '', + ]; + } +} diff --git a/app/Transformers/QuoteTransformer.php b/app/Transformers/QuoteTransformer.php index 2f369c226fd9..74ef0e94de4a 100644 --- a/app/Transformers/QuoteTransformer.php +++ b/app/Transformers/QuoteTransformer.php @@ -12,38 +12,30 @@ namespace App\Transformers; use App\Models\Quote; +use App\Models\QuoteInvitation; +use App\Transformers\QuoteInvitationTransformer; use App\Utils\Traits\MakesHash; class QuoteTransformer extends EntityTransformer { use MakesHash; - protected $defaultIncludes = [ - // 'quote_items', - ]; + protected $defaultIncludes = []; protected $availableIncludes = [ - // 'invitations', + 'invitations', // 'payments', // 'client', // 'documents', ]; + public function includeInvitations(Quote $quote) + { + $transformer = new QuoteInvitationTransformer($this->serializer); + + return $this->includeCollection($quote->invitations, $transformer, QuoteInvitation::class); + } /* - public function includequoteItems(quote $quote) - { - $transformer = new quoteItemTransformer($this->serializer); - - return $this->includeCollection($quote->quote_items, $transformer, ENTITY_quote_ITEM); - } - - public function includeInvitations(quote $quote) - { - $transformer = new InvitationTransformer($this->account, $this->serializer); - - return $this->includeCollection($quote->invitations, $transformer, ENTITY_INVITATION); - } - public function includePayments(quote $quote) { $transformer = new PaymentTransformer($this->account, $this->serializer, $quote); @@ -82,44 +74,49 @@ class QuoteTransformer extends EntityTransformer 'id' => $this->encodePrimaryKey($quote->id), 'user_id' => $this->encodePrimaryKey($quote->user_id), 'assigned_user_id' => $this->encodePrimaryKey($quote->assigned_user_id), - 'amount' => (float) $quote->amount ?: '', - 'balance' => (float) $quote->balance ?: '', - 'client_id' => (string) $quote->client_id, + 'amount' => (float) $quote->amount, + 'balance' => (float) $quote->balance, + 'client_id' => (string) $this->encodePrimaryKey($quote->client_id), 'status_id' => (string) ($quote->status_id ?: 1), 'design_id' => (string) ($quote->design_id ?: 1), 'updated_at' => $quote->updated_at, 'archived_at' => $quote->deleted_at, - 'quote_number' => $quote->quote_number ?: '', - 'discount' => (float) $quote->discount ?: '', + 'number' => $quote->number ?: '', + 'discount' => (float) $quote->discount, 'po_number' => $quote->po_number ?: '', - 'quote_date' => $quote->quote_date ?: '', + 'date' => $quote->date ?: '', 'next_send_date' => $quote->date ?: '', - 'valid_until' => $quote->valid_until ?: '', + 'due_date' => $quote->due_date ?: '', 'terms' => $quote->terms ?: '', 'public_notes' => $quote->public_notes ?: '', 'private_notes' => $quote->private_notes ?: '', 'is_deleted' => (bool) $quote->is_deleted, - 'quote_type_id' => (string) $quote->quote_type_id, + 'uses_inclusive_taxes' => (bool) $quote->uses_inclusive_taxes, + 'invoice_type_id' => (string) $quote->invoice_type_id ?: '', 'tax_name1' => $quote->tax_name1 ? $quote->tax_name1 : '', - 'tax_rate1' => (float) $quote->tax_rate1 ?: '', + 'tax_rate1' => (float) $quote->tax_rate1, 'tax_name2' => $quote->tax_name2 ? $quote->tax_name2 : '', - 'tax_rate2' => (float) $quote->tax_rate2 ?: '', + 'tax_rate2' => (float) $quote->tax_rate2, 'tax_name3' => $quote->tax_name3 ? $quote->tax_name3 : '', - 'tax_rate3' => (float) $quote->tax_rate3 ?: '', + 'tax_rate3' => (float) $quote->tax_rate3, + 'total_taxes' => (float) $quote->total_taxes, 'is_amount_discount' => (bool) ($quote->is_amount_discount ?: false), - 'quote_footer' => $quote->quote_footer ?: '', + 'footer' => $quote->footer ?: '', 'partial' => (float) ($quote->partial ?: 0.0), 'partial_due_date' => $quote->partial_due_date ?: '', - 'custom_value1' => (float) $quote->custom_value1 ?: '', - 'custom_value2' => (float) $quote->custom_value2 ?: '', - 'custom_taxes1' => (bool) $quote->custom_taxes1 ?: '', - 'custom_taxes2' => (bool) $quote->custom_taxes2 ?: '', + 'custom_value1' => (string) $quote->custom_value1 ?: '', + 'custom_value2' => (string) $quote->custom_value2 ?: '', + 'custom_value3' => (string) $quote->custom_value3 ?: '', + 'custom_value4' => (string) $quote->custom_value4 ?: '', 'has_tasks' => (bool) $quote->has_tasks, 'has_expenses' => (bool) $quote->has_expenses, - 'custom_text_value1' => $quote->custom_text_value1 ?: '', - 'custom_text_value2' => $quote->custom_text_value2 ?: '', + 'custom_surcharge1' => (float)$quote->custom_surcharge1, + 'custom_surcharge2' => (float)$quote->custom_surcharge2, + 'custom_surcharge3' => (float)$quote->custom_surcharge3, + 'custom_surcharge4' => (float)$quote->custom_surcharge4, + 'custom_surcharge_taxes' => (bool) $quote->custom_surcharge_taxes, + 'line_items' => $quote->line_items ?: (array)[], 'backup' => $quote->backup ?: '', - 'settings' => $quote->settings ?: '', ]; } } \ No newline at end of file diff --git a/database/seeds/ConstantsSeeder.php b/database/seeds/ConstantsSeeder.php index 70596af3d0c0..9cb5ebe2c8cb 100644 --- a/database/seeds/ConstantsSeeder.php +++ b/database/seeds/ConstantsSeeder.php @@ -84,7 +84,6 @@ class ConstantsSeeder extends Seeder $timezones[] = ['name'=>'Africa/Cairo', 'location' => '(GMT+02:00) Cairo', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Africa/Harare', 'location' => '(GMT+02:00) Harare', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Europe/Helsinki', 'location' => '(GMT+02:00) Helsinki', 'utc_offset' => 7200]; - $timezones[] = ['name'=>'Europe/Istanbul', 'location' => '(GMT+02:00) Istanbul', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Asia/Jerusalem', 'location' => '(GMT+02:00) Jerusalem', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Europe/Kiev', 'location' => '(GMT+02:00) Kyiv', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Europe/Minsk', 'location' => '(GMT+02:00) Minsk', 'utc_offset' => 7200]; @@ -92,6 +91,7 @@ class ConstantsSeeder extends Seeder $timezones[] = ['name'=>'Europe/Sofia', 'location' => '(GMT+02:00) Sofia', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Europe/Tallinn', 'location' => '(GMT+02:00) Tallinn', 'utc_offset' => 7200]; $timezones[] = ['name'=>'Europe/Vilnius', 'location' => '(GMT+02:00) Vilnius', 'utc_offset' => 7200]; + $timezones[] = ['name'=>'Europe/Istanbul', 'location' => '(GMT+03:00) Istanbul', 'utc_offset' => 10800]; $timezones[] = ['name'=>'Asia/Baghdad', 'location' => '(GMT+03:00) Baghdad', 'utc_offset' => 10800]; $timezones[] = ['name'=>'Asia/Kuwait', 'location' => '(GMT+03:00) Kuwait', 'utc_offset' => 10800]; $timezones[] = ['name'=>'Africa/Nairobi', 'location' => '(GMT+03:00) Nairobi', 'utc_offset' => 10800]; diff --git a/phpunit.xml b/phpunit.xml index 8c949a4ab873..e0efb4ff5a55 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,7 +7,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="true"> + stopOnFailure="false"> ./tests/Unit