1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
* Implement first_load query parameter which checks client size and returns an truncated response if client count is greater than 1000

* Fixes for listeners
This commit is contained in:
David Bomba 2019-12-28 06:30:22 +11:00 committed by GitHub
parent 54fc78a88b
commit e406020ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 12 deletions

View File

@ -335,7 +335,7 @@ class CreateTestData extends Command
$payment->invoices()->save($invoice); $payment->invoices()->save($invoice);
event(new PaymentWasCreated($payment)); event(new PaymentWasCreated($payment, $payment->company));
UpdateInvoicePayment::dispatchNow($payment, $payment->company); UpdateInvoicePayment::dispatchNow($payment, $payment->company);
} }

View File

@ -61,7 +61,7 @@ class CompanySettings extends BaseSettings
public $custom_message_paid_invoice = ''; public $custom_message_paid_invoice = '';
public $custom_message_unapproved_quote = ''; public $custom_message_unapproved_quote = '';
public $auto_archive_quote = false; public $auto_archive_quote = false;
public $auto_convert_quote = false; public $auto_convert_quote = true;
public $auto_email_invoice = true; public $auto_email_invoice = true;
public $inclusive_taxes = false; public $inclusive_taxes = false;

View File

@ -69,7 +69,52 @@ class BaseController extends Controller
{ {
$include = ''; $include = '';
if(request()->input('include') !== null) if(request()->has('first_load') && request()->input('first_load') == 'true')
{
if(auth()->user()->getCompany()->clients->count() > 1000)
{
$include = [
'account',
'user.company_user',
'token',
'company.activities',
'company.users.company_user',
'company.tax_rates',
'company.groups',
'company.company_gateways.gateway',
// 'company.clients',
// 'company.products',
// 'company.invoices',
// 'company.payments',
// 'company.quotes',
];
}
else
{
$include = [
'account',
'user.company_user',
'token',
'company.activities',
'company.users.company_user',
'company.tax_rates',
'company.groups',
'company.company_gateways.gateway',
'company.clients',
'company.products',
'company.invoices',
'company.payments',
'company.quotes',
];
}
$include = array_merge($this->forced_includes, $include);
$include = implode(",", $include);
}
else if(request()->input('include') !== null)
{ {
$request_include = explode(",", request()->input('include')); $request_include = explode(",", request()->input('include'));

View File

@ -53,7 +53,7 @@ class StoreInvoice implements ShouldQueue
* We expect the Invoice object along with * We expect the Invoice object along with
* the request in array form * the request in array form
* *
* Embedded in the request may be additionals * Embedded in the request may be additional
* attributes which require additional work to be * attributes which require additional work to be
* done in this job, these include - but are not limited to: * done in this job, these include - but are not limited to:
* *

View File

@ -39,6 +39,7 @@ class UpdateOrCreateProduct implements ShouldQueue
{ {
$this->products = $products; $this->products = $products;
$this->invoice = $invoice; $this->invoice = $invoice;
} }
@ -60,6 +61,8 @@ class UpdateOrCreateProduct implements ShouldQueue
$product->product_key = $item->product_key; $product->product_key = $item->product_key;
$product->notes = $item->notes; $product->notes = $item->notes;
$product->cost = $item->cost; $product->cost = $item->cost;
$product->price = $item->price;
$product->quantity = $item->quantity;
$product->tax_name1 = $item->tax_name1; $product->tax_name1 = $item->tax_name1;
$product->tax_rate1 = $item->tax_rate1; $product->tax_rate1 = $item->tax_rate1;
$product->tax_name2 = $item->tax_name2; $product->tax_name2 = $item->tax_name2;

View File

@ -35,6 +35,6 @@ class CreateInvoicePdf implements ShouldQueue
*/ */
public function handle($event) public function handle($event)
{ {
PdfCreator::dispatch($event->invoice); PdfCreator::dispatch($event->invoice, $event->company);
} }
} }

View File

@ -95,7 +95,7 @@ class Client extends BaseModel
// 'primary_contact', // 'primary_contact',
'country', 'country',
// 'shipping_country', // 'shipping_country',
'company' // 'company'
]; ];
protected $casts = [ protected $casts = [