mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Set all ID's to strings for consistency
This commit is contained in:
parent
6544ca2977
commit
b7920a072a
@ -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);
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Activity extends Model
|
||||
class Activity extends StaticModel
|
||||
{
|
||||
|
||||
const CREATE_CLIENT=1;
|
||||
|
@ -11,12 +11,11 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Bank.
|
||||
*/
|
||||
class Bank extends Model
|
||||
class Bank extends StaticModel
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Country extends Model
|
||||
class Country extends StaticModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Currency extends Model
|
||||
class Currency extends StaticModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Omnipay\Omnipay;
|
||||
|
||||
class Gateway extends Model
|
||||
class Gateway extends StaticModel
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Industry extends Model
|
||||
class Industry extends StaticModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Language extends Model
|
||||
class Language extends StaticModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PaymentType extends Model
|
||||
class PaymentType extends StaticModel
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Class Size.
|
||||
*/
|
||||
class Size extends Model
|
||||
class Size extends StaticModel
|
||||
{
|
||||
|
||||
/**
|
||||
|
24
app/Models/StaticModel.php
Normal file
24
app/Models/StaticModel.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StaticModel extends Model
|
||||
{
|
||||
|
||||
public function getIdAttribute()
|
||||
{
|
||||
return (string)$this->attributes['id'];
|
||||
}
|
||||
|
||||
}
|
@ -13,7 +13,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Timezone extends Model
|
||||
class Timezone extends StaticModel
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -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 ?: '',
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 : '',
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user