mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 06:04:35 -04:00
Fixes for refresh route
This commit is contained in:
parent
34575554af
commit
3c38fd2cf6
@ -132,22 +132,20 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
protected function refreshResponse($query)
|
protected function refreshResponse($query)
|
||||||
{
|
{
|
||||||
|
|
||||||
$includes = [
|
$includes = [
|
||||||
'company.tax_rates',
|
'company',
|
||||||
'company.groups',
|
'company.groups',
|
||||||
'company.company_gateways.gateway',
|
'company.company_gateways.gateway',
|
||||||
'company.clients.contacts',
|
'company.clients.contacts',
|
||||||
'company.products',
|
'company.products',
|
||||||
'company.invoices.invitations.contact',
|
'company.invoices.invitations',
|
||||||
'company.invoices.invitations.company',
|
|
||||||
'company.invoices.documents',
|
'company.invoices.documents',
|
||||||
'company.payments.paymentables',
|
'company.payments.paymentables',
|
||||||
'company.quotes.invitations.contact',
|
'company.quotes.invitations.contact',
|
||||||
'company.quotes.invitations.company',
|
'company.quotes.documents.company',
|
||||||
'company.quotes.documents',
|
|
||||||
'company.credits.invitations.contact',
|
'company.credits.invitations.contact',
|
||||||
'company.credits.invitations.company',
|
'company.credits.documents.company',
|
||||||
'company.credits.documents',
|
|
||||||
'company.payment_terms.company',
|
'company.payment_terms.company',
|
||||||
'company.credits.invitations.contact',
|
'company.credits.invitations.contact',
|
||||||
'company.credits.invitations.company',
|
'company.credits.invitations.company',
|
||||||
@ -156,8 +154,6 @@ class BaseController extends Controller
|
|||||||
'company.tasks',
|
'company.tasks',
|
||||||
'company.projects',
|
'company.projects',
|
||||||
'company.designs',
|
'company.designs',
|
||||||
'company.webhooks',
|
|
||||||
'company.tokens_hashed'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->manager->parseIncludes($includes);
|
$this->manager->parseIncludes($includes);
|
||||||
@ -170,7 +166,7 @@ class BaseController extends Controller
|
|||||||
$this->manager->setSerializer(new ArraySerializer());
|
$this->manager->setSerializer(new ArraySerializer());
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformer = new $this->entity_transformer(Input::get('serializer'));
|
$transformer = new $this->entity_transformer($this->serializer);
|
||||||
|
|
||||||
$updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0;
|
$updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0;
|
||||||
$updated_at = date('Y-m-d H:i:s', $updated_at);
|
$updated_at = date('Y-m-d H:i:s', $updated_at);
|
||||||
@ -178,7 +174,7 @@ class BaseController extends Controller
|
|||||||
$query->with(
|
$query->with(
|
||||||
[
|
[
|
||||||
'company' => function ($query) use($updated_at){
|
'company' => function ($query) use($updated_at){
|
||||||
$query->where('updated_at', '>=', date('Y-m-d H:i:s', 0));
|
$query->whereNotNull('updated_at');
|
||||||
},
|
},
|
||||||
'company.clients'=>function ($query) use($updated_at){
|
'company.clients'=>function ($query) use($updated_at){
|
||||||
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts');
|
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts');
|
||||||
@ -196,7 +192,7 @@ class BaseController extends Controller
|
|||||||
$query->where('updated_at', '>=', $updated_at);
|
$query->where('updated_at', '>=', $updated_at);
|
||||||
},
|
},
|
||||||
'company.invoices'=>function ($query) use($updated_at){
|
'company.invoices'=>function ($query) use($updated_at){
|
||||||
$query->where('updated_at', '>=', $updated_at)->with('invitations','documents');
|
$query->where('updated_at', '>=', $updated_at)->with('invitations','company','documents');
|
||||||
},
|
},
|
||||||
'company.payments'=>function ($query) use($updated_at){
|
'company.payments'=>function ($query) use($updated_at){
|
||||||
$query->where('updated_at', '>=', $updated_at)->with('paymentables');
|
$query->where('updated_at', '>=', $updated_at)->with('paymentables');
|
||||||
|
@ -51,7 +51,7 @@ class QueryLogging
|
|||||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||||
|
|
||||||
// if($count > 700)
|
// if($count > 700)
|
||||||
// Log::info($queries);
|
Log::info($queries);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,11 @@ class Credit extends BaseModel
|
|||||||
return $this->belongsTo(Client::class)->withTrashed();
|
return $this->belongsTo(Client::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function contacts()
|
||||||
|
// {
|
||||||
|
// return $this->hasManyThrough(ClientContact::class, Client::class);
|
||||||
|
// }
|
||||||
|
|
||||||
public function invitations()
|
public function invitations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(CreditInvitation::class);
|
return $this->hasMany(CreditInvitation::class);
|
||||||
|
@ -34,7 +34,8 @@ class CreditInvitation extends BaseModel
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $with = [
|
protected $with = [
|
||||||
// 'company',
|
'company',
|
||||||
|
'contact',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $touches = ['credit'];
|
protected $touches = ['credit'];
|
||||||
|
@ -192,6 +192,11 @@ class Invoice extends BaseModel
|
|||||||
return $this->belongsTo(Client::class)->withTrashed();
|
return $this->belongsTo(Client::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function contacts()
|
||||||
|
// {
|
||||||
|
// return $this->hasManyThrough(ClientContact::class, Client::class);
|
||||||
|
// }
|
||||||
|
|
||||||
public function documents()
|
public function documents()
|
||||||
{
|
{
|
||||||
return $this->morphMany(Document::class, 'documentable');
|
return $this->morphMany(Document::class, 'documentable');
|
||||||
|
@ -33,7 +33,8 @@ class InvoiceInvitation extends BaseModel
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected $with = [
|
protected $with = [
|
||||||
// 'company',
|
'company',
|
||||||
|
'contact',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $touches = ['invoice'];
|
protected $touches = ['invoice'];
|
||||||
|
@ -137,6 +137,11 @@ class Quote extends BaseModel
|
|||||||
return $this->belongsTo(Client::class)->withTrashed();
|
return $this->belongsTo(Client::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function contacts()
|
||||||
|
// {
|
||||||
|
// return $this->hasManyThrough(ClientContact::class, Client::class);
|
||||||
|
// }
|
||||||
|
|
||||||
public function assigned_user()
|
public function assigned_user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
|
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
|
||||||
|
@ -33,6 +33,11 @@ class QuoteInvitation extends BaseModel
|
|||||||
'client_contact_id',
|
'client_contact_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $with = [
|
||||||
|
'company',
|
||||||
|
'contact',
|
||||||
|
];
|
||||||
|
|
||||||
protected $touches = ['quote'];
|
protected $touches = ['quote'];
|
||||||
|
|
||||||
public function getEntityType()
|
public function getEntityType()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user