mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 10:54:36 -04: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);
|
$data = $this->createCollection($query, $transformer, $this->entity_type);
|
||||||
|
|
||||||
|
if(request()->include_static)
|
||||||
|
$data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
||||||
|
|
||||||
return $this->response($data);
|
return $this->response($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -210,8 +213,9 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
$data = $this->createItem($item, $transformer, $this->entity_type);
|
$data = $this->createItem($item, $transformer, $this->entity_type);
|
||||||
|
|
||||||
if(request()->include_static)
|
if(request()->include_static)
|
||||||
$data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
$data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
||||||
|
|
||||||
|
|
||||||
return $this->response($data);
|
return $this->response($data);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Activity extends Model
|
class Activity extends StaticModel
|
||||||
{
|
{
|
||||||
|
|
||||||
const CREATE_CLIENT=1;
|
const CREATE_CLIENT=1;
|
||||||
|
@ -11,12 +11,11 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Bank.
|
* Class Bank.
|
||||||
*/
|
*/
|
||||||
class Bank extends Model
|
class Bank extends StaticModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Country extends Model
|
class Country extends StaticModel
|
||||||
{
|
{
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Currency extends Model
|
class Currency extends StaticModel
|
||||||
{
|
{
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Omnipay\Omnipay;
|
use Omnipay\Omnipay;
|
||||||
|
|
||||||
class Gateway extends Model
|
class Gateway extends StaticModel
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@ namespace App\Models;
|
|||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class GatewayType extends Model
|
class GatewayType extends StaticModel
|
||||||
{
|
{
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
@ -21,7 +21,7 @@ use Hashids\Hashids;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class GroupSetting extends Model
|
class GroupSetting extends StaticModel
|
||||||
{
|
{
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Industry extends Model
|
class Industry extends StaticModel
|
||||||
{
|
{
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Language extends Model
|
class Language extends StaticModel
|
||||||
{
|
{
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class PaymentType extends Model
|
class PaymentType extends StaticModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
@ -16,7 +16,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
/**
|
/**
|
||||||
* Class Size.
|
* 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;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Timezone extends Model
|
class Timezone extends StaticModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
@ -59,6 +59,7 @@ class ClientTransformer extends EntityTransformer
|
|||||||
'website' => $client->website ?: '',
|
'website' => $client->website ?: '',
|
||||||
'private_notes' => $client->private_notes ?: '',
|
'private_notes' => $client->private_notes ?: '',
|
||||||
'balance' => $client->balance ?: '',
|
'balance' => $client->balance ?: '',
|
||||||
|
'currency_id' => (string)$client->currency_id ?: '',
|
||||||
'paid_to_date' => $client->paid_to_date ?: '',
|
'paid_to_date' => $client->paid_to_date ?: '',
|
||||||
'last_login' => $client->last_login ?: '',
|
'last_login' => $client->last_login ?: '',
|
||||||
'address1' => $client->address1 ?: '',
|
'address1' => $client->address1 ?: '',
|
||||||
|
@ -72,11 +72,11 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'postal_code' => $company->postal_code,
|
'postal_code' => $company->postal_code,
|
||||||
'work_phone' => $company->work_phone,
|
'work_phone' => $company->work_phone,
|
||||||
'work_email' => $company->work_email,
|
'work_email' => $company->work_email,
|
||||||
'country_id' => (int) $company->country_id,
|
'country_id' => (string) $company->country_id,
|
||||||
'vat_number' => $company->vat_number,
|
'vat_number' => $company->vat_number,
|
||||||
'id_number' => $company->id_number,
|
'id_number' => $company->id_number,
|
||||||
'size_id' => (int) $company->size_id,
|
'size_id' => (string) $company->size_id,
|
||||||
'industry_id' => (int) $company->industry_id,
|
'industry_id' => (string) $company->industry_id,
|
||||||
'settings' => $company->settings,
|
'settings' => $company->settings,
|
||||||
'updated_at' => $company->updated_at,
|
'updated_at' => $company->updated_at,
|
||||||
'deleted_at' => $company->deleted_at,
|
'deleted_at' => $company->deleted_at,
|
||||||
|
@ -28,7 +28,7 @@ class InvoiceItemTransformer extends EntityTransformer
|
|||||||
'tax_rate1' => (float) ($item->tax_rate1 ?: 0.0),
|
'tax_rate1' => (float) ($item->tax_rate1 ?: 0.0),
|
||||||
'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '',
|
'tax_name2' => $item->tax_name2 ? $item->tax_name2 : '',
|
||||||
'tax_rate2' => (float) ($item->tax_rate2 ?: 0.0),
|
'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_value1' => $item->custom_value1 ?: '',
|
||||||
'custom_value2' => $item->custom_value2 ?: '',
|
'custom_value2' => $item->custom_value2 ?: '',
|
||||||
'discount' => (float) $item->discount,
|
'discount' => (float) $item->discount,
|
||||||
|
@ -82,8 +82,8 @@ class InvoiceTransformer extends EntityTransformer
|
|||||||
'id' => $this->encodePrimaryKey($invoice->id),
|
'id' => $this->encodePrimaryKey($invoice->id),
|
||||||
'amount' => (float) $invoice->amount,
|
'amount' => (float) $invoice->amount,
|
||||||
'balance' => (float) $invoice->balance,
|
'balance' => (float) $invoice->balance,
|
||||||
'client_id' => (int) $invoice->client_id,
|
'client_id' => (string) $invoice->client_id,
|
||||||
'status_id' => (int) ($invoice->status_id ?: 1),
|
'status_id' => (string) ($invoice->status_id ?: 1),
|
||||||
'updated_at' => $invoice->updated_at,
|
'updated_at' => $invoice->updated_at,
|
||||||
'archived_at' => $invoice->deleted_at,
|
'archived_at' => $invoice->deleted_at,
|
||||||
'invoice_number' => $invoice->invoice_number,
|
'invoice_number' => $invoice->invoice_number,
|
||||||
|
@ -82,8 +82,8 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
'id' => $this->encodePrimaryKey($quote->id),
|
'id' => $this->encodePrimaryKey($quote->id),
|
||||||
'amount' => (float) $quote->amount,
|
'amount' => (float) $quote->amount,
|
||||||
'balance' => (float) $quote->balance,
|
'balance' => (float) $quote->balance,
|
||||||
'client_id' => (int) $quote->client_id,
|
'client_id' => (string) $quote->client_id,
|
||||||
'status_id' => (int) ($quote->status_id ?: 1),
|
'status_id' => (string) ($quote->status_id ?: 1),
|
||||||
'updated_at' => $quote->updated_at,
|
'updated_at' => $quote->updated_at,
|
||||||
'archived_at' => $quote->deleted_at,
|
'archived_at' => $quote->deleted_at,
|
||||||
'quote_number' => $quote->quote_number,
|
'quote_number' => $quote->quote_number,
|
||||||
@ -95,7 +95,7 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
'public_notes' => $quote->public_notes ?: '',
|
'public_notes' => $quote->public_notes ?: '',
|
||||||
'private_notes' => $quote->private_notes ?: '',
|
'private_notes' => $quote->private_notes ?: '',
|
||||||
'is_deleted' => (bool) $quote->is_deleted,
|
'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_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_name2' => $quote->tax_name2 ? $quote->tax_name2 : '',
|
||||||
|
@ -83,8 +83,8 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
|||||||
'id' => $this->encodePrimaryKey($invoice->id),
|
'id' => $this->encodePrimaryKey($invoice->id),
|
||||||
'amount' => (float) $invoice->amount,
|
'amount' => (float) $invoice->amount,
|
||||||
'balance' => (float) $invoice->balance,
|
'balance' => (float) $invoice->balance,
|
||||||
'client_id' => (int) $invoice->client_id,
|
'client_id' => (string) $invoice->client_id,
|
||||||
'status_id' => (int) ($invoice->status_id ?: 1),
|
'status_id' => (string) ($invoice->status_id ?: 1),
|
||||||
'updated_at' => $invoice->updated_at,
|
'updated_at' => $invoice->updated_at,
|
||||||
'archived_at' => $invoice->deleted_at,
|
'archived_at' => $invoice->deleted_at,
|
||||||
'discount' => (float) $invoice->discount,
|
'discount' => (float) $invoice->discount,
|
||||||
@ -113,7 +113,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
|||||||
'custom_text_value2' => $invoice->custom_text_value2 ?: '',
|
'custom_text_value2' => $invoice->custom_text_value2 ?: '',
|
||||||
'backup' => $invoice->backup ?: '',
|
'backup' => $invoice->backup ?: '',
|
||||||
'settings' => $invoice->settings,
|
'settings' => $invoice->settings,
|
||||||
'frequency_id' => (int) $invoice->frequency_id,
|
'frequency_id' => (string) $invoice->frequency_id,
|
||||||
'start_date' => $invoice->start_date,
|
'start_date' => $invoice->start_date,
|
||||||
'last_sent_date' => $invoice->last_sent_date,
|
'last_sent_date' => $invoice->last_sent_date,
|
||||||
'next_send_date' => $invoice->next_send_date,
|
'next_send_date' => $invoice->next_send_date,
|
||||||
|
@ -83,8 +83,8 @@ class RecurringQuoteTransformer extends EntityTransformer
|
|||||||
'id' => $this->encodePrimaryKey($quote->id),
|
'id' => $this->encodePrimaryKey($quote->id),
|
||||||
'amount' => (float) $quote->amount,
|
'amount' => (float) $quote->amount,
|
||||||
'balance' => (float) $quote->balance,
|
'balance' => (float) $quote->balance,
|
||||||
'client_id' => (int) $quote->client_id,
|
'client_id' => (string) $quote->client_id,
|
||||||
'status_id' => (int) ($quote->status_id ?: 1),
|
'status_id' => (string) ($quote->status_id ?: 1),
|
||||||
'updated_at' => $quote->updated_at,
|
'updated_at' => $quote->updated_at,
|
||||||
'archived_at' => $quote->deleted_at,
|
'archived_at' => $quote->deleted_at,
|
||||||
'discount' => (float) $quote->discount,
|
'discount' => (float) $quote->discount,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user