1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +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,14 +53,14 @@ 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:
* *
* 1. email_invoice - Email the Invoice * 1. email_invoice - Email the Invoice
* 2. mark_paid - Mark the invoice as paid (Generates a payment against the invoice) * 2. mark_paid - Mark the invoice as paid (Generates a payment against the invoice)
* 3. ...... * 3. ......
* *
* @return NULL|Invoice * @return NULL|Invoice
*/ */
public function handle(InvoiceRepository $invoice_repo) : ?Invoice public function handle(InvoiceRepository $invoice_repo) : ?Invoice
@ -76,8 +76,8 @@ class StoreInvoice implements ShouldQueue
// $this->invoice = $invoice_repo->markSent($this->invoice); // $this->invoice = $invoice_repo->markSent($this->invoice);
// //fire autobill - todo - the PAYMENT class will update the INVOICE status. // //fire autobill - todo - the PAYMENT class will update the INVOICE status.
// // $payment = // // $payment =
// } // }
if(isset($this->data['email_invoice']) && (bool)$this->data['email_invoice']) if(isset($this->data['email_invoice']) && (bool)$this->data['email_invoice'])
@ -97,7 +97,7 @@ class StoreInvoice implements ShouldQueue
// generate a manual payment against the invoice // generate a manual payment against the invoice
// the PAYMENT class will update the INVOICE status. // the PAYMENT class will update the INVOICE status.
//$payment = //$payment =
} }
@ -106,7 +106,7 @@ class StoreInvoice implements ShouldQueue
{ {
//fire payment notifications here //fire payment notifications here
PaymentNotification::dispatch($payment, $payment->company); PaymentNotification::dispatch($payment, $payment->company);
} }
if(isset($data['download_invoice']) && (bool)$this->data['download_invoice']) if(isset($data['download_invoice']) && (bool)$this->data['download_invoice'])

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 = [