From 1b3a9e63983aa4e0ed04ab3c36f9337a15ed6e24 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 23 Feb 2021 09:08:43 +1100 Subject: [PATCH] Fixes for updating products --- app/DataMapper/CompanySettings.php | 4 ++-- app/Http/Controllers/OpenAPI/CompanySettingsSchema.php | 1 - app/Http/Controllers/ProductController.php | 2 +- app/Models/RecurringInvoice.php | 1 - app/Repositories/BaseRepository.php | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 9bfd34f021..8c096364a6 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -136,7 +136,7 @@ class CompanySettings extends BaseSettings public $tax_name3 = ''; //@TODO where do we use this? public $tax_rate3 = 0; //@TODO where do we use this? public $payment_type_id = '0'; //@TODO where do we use this? - public $invoice_fields = ''; //@TODO is this redundant, we store this in the custom_fields on the company? + // public $invoice_fields = ''; //@TODO is this redundant, we store this in the custom_fields on the company? public $show_accept_invoice_terms = false; //@TODO ben to confirm public $show_accept_quote_terms = false; //@TODO ben to confirm @@ -392,7 +392,7 @@ class CompanySettings extends BaseSettings 'invoice_number_pattern' => 'string', 'invoice_number_counter' => 'integer', 'invoice_design_id' => 'string', - 'invoice_fields' => 'string', + // 'invoice_fields' => 'string', 'invoice_taxes' => 'int', //'enabled_item_tax_rates' => 'int', 'invoice_footer' => 'string', diff --git a/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php b/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php index fe19347cc0..db5ef15424 100644 --- a/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php +++ b/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php @@ -78,7 +78,6 @@ * @OA\Property(property="tax_name3", type="string", example="GST", description="The tax name"), * @OA\Property(property="payment_type_id", type="string", example="1", description="The default payment type id"), * @OA\Property(property="custom_fields", type="string", example="{}", description="JSON string of custom fields"), - * @OA\Property(property="invoice_fields", type="string", example="{}", description="JSON string of invoice fields"), * @OA\Property(property="email_footer", type="string", example="A default email footer", description="The default email footer"), * @OA\Property(property="email_sending_method", type="string", example="default", description="The email driver to use to send email, options include default, gmail"), * @OA\Property(property="gmail_sending_user_id", type="string", example="F76sd34D", description="The hashed_id of the user account to send email from"), diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 3ee844e2de..dcc0ef4d57 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -406,7 +406,7 @@ class ProductController extends BaseController */ public function destroy(DestroyProductRequest $request, Product $product) { - $product->delete(); + $product = $this->product_repo->delete($product); return $this->itemResponse($product); } diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 956aa558e9..d824ef420f 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -74,7 +74,6 @@ class RecurringInvoice extends BaseModel 'due_date', 'due_date_days', 'line_items', - 'settings', 'footer', 'public_notes', 'private_notes', diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 937556290f..6b182baf56 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -292,7 +292,7 @@ class BaseRepository $model = $model->service()->applyNumber()->save(); /* Update product details if necessary */ - if ($model->company->update_products !== false) + if ($model->company->update_products) UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company); /* Perform model specific tasks */