mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -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)
|
||||
{
|
||||
|
||||
$includes = [
|
||||
'company.tax_rates',
|
||||
'company',
|
||||
'company.groups',
|
||||
'company.company_gateways.gateway',
|
||||
'company.clients.contacts',
|
||||
'company.products',
|
||||
'company.invoices.invitations.contact',
|
||||
'company.invoices.invitations.company',
|
||||
'company.invoices.invitations',
|
||||
'company.invoices.documents',
|
||||
'company.payments.paymentables',
|
||||
'company.quotes.invitations.contact',
|
||||
'company.quotes.invitations.company',
|
||||
'company.quotes.documents',
|
||||
'company.quotes.documents.company',
|
||||
'company.credits.invitations.contact',
|
||||
'company.credits.invitations.company',
|
||||
'company.credits.documents',
|
||||
'company.credits.documents.company',
|
||||
'company.payment_terms.company',
|
||||
'company.credits.invitations.contact',
|
||||
'company.credits.invitations.company',
|
||||
@ -156,8 +154,6 @@ class BaseController extends Controller
|
||||
'company.tasks',
|
||||
'company.projects',
|
||||
'company.designs',
|
||||
'company.webhooks',
|
||||
'company.tokens_hashed'
|
||||
];
|
||||
|
||||
$this->manager->parseIncludes($includes);
|
||||
@ -170,7 +166,7 @@ class BaseController extends Controller
|
||||
$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 = date('Y-m-d H:i:s', $updated_at);
|
||||
@ -178,7 +174,7 @@ class BaseController extends Controller
|
||||
$query->with(
|
||||
[
|
||||
'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){
|
||||
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts');
|
||||
@ -196,7 +192,7 @@ class BaseController extends Controller
|
||||
$query->where('updated_at', '>=', $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){
|
||||
$query->where('updated_at', '>=', $updated_at)->with('paymentables');
|
||||
|
@ -51,7 +51,7 @@ class QueryLogging
|
||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||
|
||||
// if($count > 700)
|
||||
// Log::info($queries);
|
||||
Log::info($queries);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -137,6 +137,11 @@ class Credit extends BaseModel
|
||||
return $this->belongsTo(Client::class)->withTrashed();
|
||||
}
|
||||
|
||||
// public function contacts()
|
||||
// {
|
||||
// return $this->hasManyThrough(ClientContact::class, Client::class);
|
||||
// }
|
||||
|
||||
public function invitations()
|
||||
{
|
||||
return $this->hasMany(CreditInvitation::class);
|
||||
|
@ -34,7 +34,8 @@ class CreditInvitation extends BaseModel
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
// 'company',
|
||||
'company',
|
||||
'contact',
|
||||
];
|
||||
|
||||
protected $touches = ['credit'];
|
||||
|
@ -192,6 +192,11 @@ class Invoice extends BaseModel
|
||||
return $this->belongsTo(Client::class)->withTrashed();
|
||||
}
|
||||
|
||||
// public function contacts()
|
||||
// {
|
||||
// return $this->hasManyThrough(ClientContact::class, Client::class);
|
||||
// }
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
|
@ -33,7 +33,8 @@ class InvoiceInvitation extends BaseModel
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
// 'company',
|
||||
'company',
|
||||
'contact',
|
||||
];
|
||||
|
||||
protected $touches = ['invoice'];
|
||||
|
@ -137,6 +137,11 @@ class Quote extends BaseModel
|
||||
return $this->belongsTo(Client::class)->withTrashed();
|
||||
}
|
||||
|
||||
// public function contacts()
|
||||
// {
|
||||
// return $this->hasManyThrough(ClientContact::class, Client::class);
|
||||
// }
|
||||
|
||||
public function assigned_user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
|
||||
|
@ -33,6 +33,11 @@ class QuoteInvitation extends BaseModel
|
||||
'client_contact_id',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'company',
|
||||
'contact',
|
||||
];
|
||||
|
||||
protected $touches = ['quote'];
|
||||
|
||||
public function getEntityType()
|
||||
|
Loading…
x
Reference in New Issue
Block a user