diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index eaa53d22b936..65b930950b67 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -147,6 +147,9 @@ class BaseController extends Controller $data = $this->createCollection($query, $transformer, $this->entity_type); + if(request()->include_static) + $data['static'] = Statics::company(auth()->user()->getCompany()->getLocale()); + return $this->response($data); } @@ -210,8 +213,9 @@ class BaseController extends Controller $data = $this->createItem($item, $transformer, $this->entity_type); - if(request()->include_static) + if(request()->include_static) $data['static'] = Statics::company(auth()->user()->getCompany()->getLocale()); + return $this->response($data); diff --git a/app/Models/Activity.php b/app/Models/Activity.php index ffebfcf6fd87..002a2ae6ddc8 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class Activity extends Model +class Activity extends StaticModel { const CREATE_CLIENT=1; diff --git a/app/Models/Bank.php b/app/Models/Bank.php index adbb64040caf..544cf2a532ab 100644 --- a/app/Models/Bank.php +++ b/app/Models/Bank.php @@ -11,12 +11,11 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Model; /** * Class Bank. */ -class Bank extends Model +class Bank extends StaticModel { /** * @var bool diff --git a/app/Models/Country.php b/app/Models/Country.php index bbd494a6f751..79556d5f6c24 100644 --- a/app/Models/Country.php +++ b/app/Models/Country.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class Country extends Model +class Country extends StaticModel { public $timestamps = false; diff --git a/app/Models/Currency.php b/app/Models/Currency.php index 8b529768f99e..d45727de7332 100644 --- a/app/Models/Currency.php +++ b/app/Models/Currency.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class Currency extends Model +class Currency extends StaticModel { public $timestamps = false; diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index d7d9f4248355..b1ae677caac6 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -14,7 +14,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use Omnipay\Omnipay; -class Gateway extends Model +class Gateway extends StaticModel { /** diff --git a/app/Models/GatewayType.php b/app/Models/GatewayType.php index 3902b9a17acf..49a4a4c646a3 100644 --- a/app/Models/GatewayType.php +++ b/app/Models/GatewayType.php @@ -14,7 +14,7 @@ namespace App\Models; use App\Models\Gateway; use Illuminate\Database\Eloquent\Model; -class GatewayType extends Model +class GatewayType extends StaticModel { public $timestamps = false; diff --git a/app/Models/GroupSetting.php b/app/Models/GroupSetting.php index 3c86df78a215..7714b5bccee3 100644 --- a/app/Models/GroupSetting.php +++ b/app/Models/GroupSetting.php @@ -21,7 +21,7 @@ use Hashids\Hashids; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Model; -class GroupSetting extends Model +class GroupSetting extends StaticModel { public $timestamps = false; diff --git a/app/Models/Industry.php b/app/Models/Industry.php index f1b42949b965..6c67b4209e13 100644 --- a/app/Models/Industry.php +++ b/app/Models/Industry.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class Industry extends Model +class Industry extends StaticModel { public $timestamps = false; } diff --git a/app/Models/Language.php b/app/Models/Language.php index 788d78e9289a..6a53f340eb8d 100644 --- a/app/Models/Language.php +++ b/app/Models/Language.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class Language extends Model +class Language extends StaticModel { public $timestamps = false; diff --git a/app/Models/PaymentType.php b/app/Models/PaymentType.php index 21e4166df076..d1384d665b21 100644 --- a/app/Models/PaymentType.php +++ b/app/Models/PaymentType.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class PaymentType extends Model +class PaymentType extends StaticModel { /** * @var bool diff --git a/app/Models/Size.php b/app/Models/Size.php index 73e3d2aea100..ded59032338d 100644 --- a/app/Models/Size.php +++ b/app/Models/Size.php @@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model; /** * Class Size. */ -class Size extends Model +class Size extends StaticModel { /** diff --git a/app/Models/StaticModel.php b/app/Models/StaticModel.php new file mode 100644 index 000000000000..54d2d6bf32c2 --- /dev/null +++ b/app/Models/StaticModel.php @@ -0,0 +1,24 @@ +attributes['id']; + } + +} diff --git a/app/Models/Timezone.php b/app/Models/Timezone.php index e3bc34f6fc64..5c6b772d1cd7 100644 --- a/app/Models/Timezone.php +++ b/app/Models/Timezone.php @@ -13,7 +13,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class Timezone extends Model +class Timezone extends StaticModel { /** * @var bool diff --git a/app/Transformers/ClientTransformer.php b/app/Transformers/ClientTransformer.php index 28b140ca1b7b..07537bf24073 100644 --- a/app/Transformers/ClientTransformer.php +++ b/app/Transformers/ClientTransformer.php @@ -59,6 +59,7 @@ class ClientTransformer extends EntityTransformer 'website' => $client->website ?: '', 'private_notes' => $client->private_notes ?: '', 'balance' => $client->balance ?: '', + 'currency_id' => (string)$client->currency_id ?: '', 'paid_to_date' => $client->paid_to_date ?: '', 'last_login' => $client->last_login ?: '', 'address1' => $client->address1 ?: '', diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index 19f41a57ac48..d8dddafbf928 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -72,11 +72,11 @@ class CompanyTransformer extends EntityTransformer 'postal_code' => $company->postal_code, 'work_phone' => $company->work_phone, 'work_email' => $company->work_email, - 'country_id' => (int) $company->country_id, + 'country_id' => (string) $company->country_id, 'vat_number' => $company->vat_number, 'id_number' => $company->id_number, - 'size_id' => (int) $company->size_id, - 'industry_id' => (int) $company->industry_id, + 'size_id' => (string) $company->size_id, + 'industry_id' => (string) $company->industry_id, 'settings' => $company->settings, 'updated_at' => $company->updated_at, 'deleted_at' => $company->deleted_at, diff --git a/app/Transformers/InvoiceItemTransformer.php b/app/Transformers/InvoiceItemTransformer.php index f4642f218568..7bae8540a93f 100644 --- a/app/Transformers/InvoiceItemTransformer.php +++ b/app/Transformers/InvoiceItemTransformer.php @@ -28,7 +28,7 @@ class InvoiceItemTransformer extends EntityTransformer 'tax_rate1' => (float) ($item->tax_rate1 ?: 0.0), 'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '', 'tax_rate2' => (float) ($item->tax_rate2 ?: 0.0), - 'invoice_item_type_id' => (int) $item->invoice_item_type_id, + 'invoice_item_type_id' => (string) $item->invoice_item_type_id, 'custom_value1' => $item->custom_value1 ?: '', 'custom_value2' => $item->custom_value2 ?: '', 'discount' => (float) $item->discount, diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index 3487b5b32802..14ba888581d6 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -82,8 +82,8 @@ class InvoiceTransformer extends EntityTransformer 'id' => $this->encodePrimaryKey($invoice->id), 'amount' => (float) $invoice->amount, 'balance' => (float) $invoice->balance, - 'client_id' => (int) $invoice->client_id, - 'status_id' => (int) ($invoice->status_id ?: 1), + 'client_id' => (string) $invoice->client_id, + 'status_id' => (string) ($invoice->status_id ?: 1), 'updated_at' => $invoice->updated_at, 'archived_at' => $invoice->deleted_at, 'invoice_number' => $invoice->invoice_number, diff --git a/app/Transformers/QuoteTransformer.php b/app/Transformers/QuoteTransformer.php index 93fb9efafb03..6f16d93bdf71 100644 --- a/app/Transformers/QuoteTransformer.php +++ b/app/Transformers/QuoteTransformer.php @@ -82,8 +82,8 @@ class QuoteTransformer extends EntityTransformer 'id' => $this->encodePrimaryKey($quote->id), 'amount' => (float) $quote->amount, 'balance' => (float) $quote->balance, - 'client_id' => (int) $quote->client_id, - 'status_id' => (int) ($quote->status_id ?: 1), + 'client_id' => (string) $quote->client_id, + 'status_id' => (string) ($quote->status_id ?: 1), 'updated_at' => $quote->updated_at, 'archived_at' => $quote->deleted_at, 'quote_number' => $quote->quote_number, @@ -95,7 +95,7 @@ class QuoteTransformer extends EntityTransformer 'public_notes' => $quote->public_notes ?: '', 'private_notes' => $quote->private_notes ?: '', 'is_deleted' => (bool) $quote->is_deleted, - 'quote_type_id' => (int) $quote->quote_type_id, + 'quote_type_id' => (string) $quote->quote_type_id, 'tax_name1' => $quote->tax_name1 ? $quote->tax_name1 : '', 'tax_rate1' => (float) $quote->tax_rate1, 'tax_name2' => $quote->tax_name2 ? $quote->tax_name2 : '', diff --git a/app/Transformers/RecurringInvoiceTransformer.php b/app/Transformers/RecurringInvoiceTransformer.php index a45abe86b1d9..7c189598c320 100644 --- a/app/Transformers/RecurringInvoiceTransformer.php +++ b/app/Transformers/RecurringInvoiceTransformer.php @@ -83,8 +83,8 @@ class RecurringInvoiceTransformer extends EntityTransformer 'id' => $this->encodePrimaryKey($invoice->id), 'amount' => (float) $invoice->amount, 'balance' => (float) $invoice->balance, - 'client_id' => (int) $invoice->client_id, - 'status_id' => (int) ($invoice->status_id ?: 1), + 'client_id' => (string) $invoice->client_id, + 'status_id' => (string) ($invoice->status_id ?: 1), 'updated_at' => $invoice->updated_at, 'archived_at' => $invoice->deleted_at, 'discount' => (float) $invoice->discount, @@ -113,7 +113,7 @@ class RecurringInvoiceTransformer extends EntityTransformer 'custom_text_value2' => $invoice->custom_text_value2 ?: '', 'backup' => $invoice->backup ?: '', 'settings' => $invoice->settings, - 'frequency_id' => (int) $invoice->frequency_id, + 'frequency_id' => (string) $invoice->frequency_id, 'start_date' => $invoice->start_date, 'last_sent_date' => $invoice->last_sent_date, 'next_send_date' => $invoice->next_send_date, diff --git a/app/Transformers/RecurringQuoteTransformer.php b/app/Transformers/RecurringQuoteTransformer.php index 5739146241cd..b20cd42608bb 100644 --- a/app/Transformers/RecurringQuoteTransformer.php +++ b/app/Transformers/RecurringQuoteTransformer.php @@ -83,8 +83,8 @@ class RecurringQuoteTransformer extends EntityTransformer 'id' => $this->encodePrimaryKey($quote->id), 'amount' => (float) $quote->amount, 'balance' => (float) $quote->balance, - 'client_id' => (int) $quote->client_id, - 'status_id' => (int) ($quote->status_id ?: 1), + 'client_id' => (string) $quote->client_id, + 'status_id' => (string) ($quote->status_id ?: 1), 'updated_at' => $quote->updated_at, 'archived_at' => $quote->deleted_at, 'discount' => (float) $quote->discount,