1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #3937 from turbo124/v2

Formatting for refresh query
This commit is contained in:
David Bomba 2020-07-28 07:45:11 +10:00 committed by GitHub
commit 0b20bef518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 53 deletions

View File

@ -185,61 +185,60 @@ class BaseController extends Controller
}
$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);
$query->with(
[
'company' => function ($query) use($updated_at){
$query->whereNotNull('updated_at');
},
'company.clients'=>function ($query) use($updated_at){
[
'company' => function ($query) use($updated_at){
$query->whereNotNull('updated_at');
},
'company.clients' => function ($query) use($updated_at){
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts');
},
'company.tax_rates'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.groups'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.company_gateways'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('gateway');
},
'company.products'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.invoices'=>function ($query) use($updated_at){
$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');
},
'company.quotes'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('invitations','documents');
},
'company.credits'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('invitations','documents');
},
'company.payment_terms'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.vendors'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('contacts');
},
'company.expenses'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.tasks'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.projects'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.designs'=>function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
]
},
'company.tax_rates' => function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.groups' => function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.company_gateways' => function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('gateway');
},
'company.products' => function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.invoices'=> function ($query) use($updated_at){
$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');
},
'company.quotes'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('invitations','documents');
},
'company.credits'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('invitations','documents');
},
'company.payment_terms'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.vendors'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at)->with('contacts');
},
'company.expenses'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.tasks'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.projects'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
'company.designs'=> function ($query) use($updated_at){
$query->where('updated_at', '>=', $updated_at);
},
]
);

View File

@ -51,7 +51,7 @@ class QueryLogging
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
// if($count > 700)
Log::info($queries);
// Log::info($queries);
}
}

View File

@ -312,7 +312,7 @@ class BaseRepository
$model = $model->calc()->getInvoice();
$state['finished_amount'] = $model->amount;
$model = $model->service()->applyNumber()->save();
if ($model->company->update_products !== false) {

View File

@ -35,7 +35,7 @@ class InvoiceRepository extends BaseRepository
*/
public function getClassName()
{
return Invoice::class ;
return Invoice::class;
}
/**