1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 06:32:40 +01:00

Merge pull request #8195 from turbo124/v5-develop

Fixes for clientcontact observer bug
This commit is contained in:
David Bomba 2023-01-22 21:01:28 +11:00 committed by GitHub
commit d104d3e51c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 127 additions and 129 deletions

View File

@ -1 +1 @@
5.5.59 5.5.60

View File

@ -33,7 +33,7 @@ class CompanyGatewayFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('company_gateways.label', 'like', '%'.$filter.'%'); $query->where('label', 'like', '%'.$filter.'%');
}); });
} }

View File

@ -42,7 +42,6 @@ class CreditFilters extends QueryFilters
return $this->builder; return $this->builder;
} }
$credit_filters = []; $credit_filters = [];
if (in_array('draft', $status_parameters)) if (in_array('draft', $status_parameters))

View File

@ -38,7 +38,7 @@ class InvoiceFilters extends QueryFilters
* @param string client_status The invoice status as seen by the client * @param string client_status The invoice status as seen by the client
* @return Builder * @return Builder
*/ */
public function client_status(string $value = '') :Builder public function client_status(string $value = ''): Builder
{ {
if (strlen($value) == 0) { if (strlen($value) == 0) {
return $this->builder; return $this->builder;
@ -77,7 +77,7 @@ class InvoiceFilters extends QueryFilters
return $this->builder; return $this->builder;
} }
public function number(string $number = '') :Builder public function number(string $number = ''): Builder
{ {
if(strlen($number) == 0) if(strlen($number) == 0)
return $this->builder; return $this->builder;
@ -92,22 +92,22 @@ class InvoiceFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('invoices.number', 'like', '%'.$filter.'%') $query->where('number', 'like', '%'.$filter.'%')
->orWhere('invoices.po_number', 'like', '%'.$filter.'%') ->orWhere('po_number', 'like', '%'.$filter.'%')
->orWhere('invoices.date', 'like', '%'.$filter.'%') ->orWhere('date', 'like', '%'.$filter.'%')
->orWhere('invoices.amount', 'like', '%'.$filter.'%') ->orWhere('amount', 'like', '%'.$filter.'%')
->orWhere('invoices.balance', 'like', '%'.$filter.'%') ->orWhere('balance', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value1', 'like', '%'.$filter.'%') ->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
@ -115,7 +115,7 @@ class InvoiceFilters extends QueryFilters
* @return Builder * @return Builder
* @throws RuntimeException * @throws RuntimeException
*/ */
public function without_deleted_clients() public function without_deleted_clients(): Builder
{ {
return $this->builder->whereHas('client', function ($query) { return $this->builder->whereHas('client', function ($query) {
@ -127,7 +127,7 @@ class InvoiceFilters extends QueryFilters
* @return Builder * @return Builder
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function upcoming() public function upcoming(): Builder
{ {
return $this->builder return $this->builder
->where(function ($query) { ->where(function ($query) {
@ -141,9 +141,9 @@ class InvoiceFilters extends QueryFilters
* @return void * @return void
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function overdue() public function overdue(): Builder
{ {
$this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) return $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('is_deleted', 0) ->where('is_deleted', 0)
->where(function ($query) { ->where(function ($query) {
$query->where('due_date', '<', now()) $query->where('due_date', '<', now())
@ -157,7 +157,7 @@ class InvoiceFilters extends QueryFilters
* @return Builder * @return Builder
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */
public function payable(string $client_id = '') public function payable(string $client_id = ''): Builder
{ {
if (strlen($client_id) == 0) { if (strlen($client_id) == 0) {
return $this->builder; return $this->builder;
@ -175,7 +175,7 @@ class InvoiceFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort = '') : Builder public function sort(string $sort = ''): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);

View File

@ -25,26 +25,26 @@ class PaymentFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('payments.amount', 'like', '%'.$filter.'%') $query->where('amount', 'like', '%'.$filter.'%')
->orWhere('payments.date', 'like', '%'.$filter.'%') ->orWhere('date', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value1', 'like', '%'.$filter.'%') ->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
/** /**
* Returns a list of payments that can be matched to bank transactions * Returns a list of payments that can be matched to bank transactions
*/ */
public function match_transactions($value = 'true') :Builder public function match_transactions($value = 'true'): Builder
{ {
if($value == 'true'){ if($value == 'true'){
@ -68,7 +68,7 @@ class PaymentFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);
@ -78,7 +78,7 @@ class PaymentFilters extends QueryFilters
return true; return true;
} }
public function number(string $number) : Builder public function number(string $number = ''): Builder
{ {
return $this->builder->where('number', $number); return $this->builder->where('number', $number);
} }
@ -88,7 +88,7 @@ class PaymentFilters extends QueryFilters
* *
* @return Illuminate\Database\Query\Builder * @return Illuminate\Database\Query\Builder
*/ */
public function entityFilter() public function entityFilter(): Builder
{ {
if (auth()->guard('contact')->user()) { if (auth()->guard('contact')->user()) {
return $this->contactViewFilter(); return $this->contactViewFilter();
@ -103,7 +103,7 @@ class PaymentFilters extends QueryFilters
* *
* @return Builder * @return Builder
*/ */
private function contactViewFilter() : Builder private function contactViewFilter(): Builder
{ {
return $this->builder return $this->builder
->whereCompanyId(auth()->guard('contact')->user()->company->id) ->whereCompanyId(auth()->guard('contact')->user()->company->id)

View File

@ -32,7 +32,7 @@ class PaymentTermFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('payment_terms.name', 'like', '%'.$filter.'%'); $query->where('name', 'like', '%'.$filter.'%');
}); });
} }

View File

@ -27,23 +27,23 @@ class ProductFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('products.product_key', 'like', '%'.$filter.'%') $query->where('product_key', 'like', '%'.$filter.'%')
->orWhere('products.notes', 'like', '%'.$filter.'%') ->orWhere('notes', 'like', '%'.$filter.'%')
->orWhere('products.custom_value1', 'like', '%'.$filter.'%') ->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('products.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('products.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('products.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
public function product_key(string $filter = '') : Builder public function product_key(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
@ -58,7 +58,7 @@ class ProductFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);

View File

@ -22,19 +22,19 @@ class ProjectFilters extends QueryFilters
* Filter based on search text. * Filter based on search text.
* *
* @param string query filter * @param string query filter
* @return Builder * @return Illuminate\Eloquent\Query\Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = '') :Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('projects.name', 'like', '%'.$filter.'%') $query->where('name', 'like', '%'.$filter.'%')
->orWhere('projects.public_notes', 'like', '%'.$filter.'%') ->orWhere('public_notes', 'like', '%'.$filter.'%')
->orWhere('projects.private_notes', 'like', '%'.$filter.'%'); ->orWhere('private_notes', 'like', '%'.$filter.'%');
}); });
} }
@ -42,9 +42,9 @@ class ProjectFilters extends QueryFilters
* Sorts the list based on $sort. * Sorts the list based on $sort.
* *
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Illuminate\Eloquent\Query\Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort) :Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);
@ -55,9 +55,9 @@ class ProjectFilters extends QueryFilters
/** /**
* Filters the query by the users company ID. * Filters the query by the users company ID.
* *
* @return Illuminate\Database\Query\Builder * @return Illuminate\Eloquent\Query\Builder
*/ */
public function entityFilter() public function entityFilter() :Builder
{ {
return $this->builder->company(); return $this->builder->company();
} }

View File

@ -29,7 +29,7 @@ class PurchaseOrderFilters extends QueryFilters
* *
* @return Builder * @return Builder
*/ */
public function client_status(string $value = '') :Builder public function client_status(string $value = ''): Builder
{ {
if (strlen($value) == 0) { if (strlen($value) == 0) {
return $this->builder; return $this->builder;
@ -81,22 +81,22 @@ class PurchaseOrderFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('purchase_orders.number', 'like', '%'.$filter.'%') $query->where('number', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.number', 'like', '%'.$filter.'%') ->orWhere('number', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.date', 'like', '%'.$filter.'%') ->orWhere('date', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.amount', 'like', '%'.$filter.'%') ->orWhere('amount', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.balance', 'like', '%'.$filter.'%') ->orWhere('balance', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value1', 'like', '%'.$filter.'%') ->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
@ -106,7 +106,7 @@ class PurchaseOrderFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);
@ -119,7 +119,7 @@ class PurchaseOrderFilters extends QueryFilters
* We need to ensure we are using the correct company ID * We need to ensure we are using the correct company ID
* as we could be hitting this from either the client or company auth guard * as we could be hitting this from either the client or company auth guard
*/ */
public function entityFilter() public function entityFilter(): Builder
{ {
if (auth()->guard('contact')->user()) { if (auth()->guard('contact')->user()) {
return $this->contactViewFilter(); return $this->contactViewFilter();

View File

@ -26,18 +26,18 @@ class QuoteFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('quotes.number', 'like', '%'.$filter.'%') $query->where('number', 'like', '%'.$filter.'%')
->orwhere('quotes.custom_value1', 'like', '%'.$filter.'%') ->orwhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('quotes.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('quotes.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('quotes.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
@ -53,7 +53,7 @@ class QuoteFilters extends QueryFilters
* @param string client_status The invoice status as seen by the client * @param string client_status The invoice status as seen by the client
* @return Builder * @return Builder
*/ */
public function client_status(string $value = '') :Builder public function client_status(string $value = ''): Builder
{ {
if (strlen($value) == 0) { if (strlen($value) == 0) {
return $this->builder; return $this->builder;
@ -111,7 +111,7 @@ class QuoteFilters extends QueryFilters
return $this->builder; return $this->builder;
} }
public function number($number = '') public function number($number = ''): Builder
{ {
return $this->builder->where('number', 'like', '%'.$number.'%'); return $this->builder->where('number', 'like', '%'.$number.'%');
} }
@ -122,7 +122,7 @@ class QuoteFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);
@ -135,9 +135,9 @@ class QuoteFilters extends QueryFilters
/** /**
* Filters the query by the users company ID. * Filters the query by the users company ID.
* *
* @return Illuminate\Database\Query\Builder * @return Illuminate\Eloquent\Query\Builder
*/ */
public function entityFilter() public function entityFilter(): Builder
{ {
return $this->builder->company(); return $this->builder->company();
} }

View File

@ -56,9 +56,9 @@ class RecurringExpenseFilters extends QueryFilters
/** /**
* Filters the query by the users company ID. * Filters the query by the users company ID.
* *
* @return Illuminate\Database\Query\Builder * @return Illuminate\Eloquent\Builder
*/ */
public function entityFilter() public function entityFilter(): Builder
{ {
return $this->builder->company(); return $this->builder->company();
} }

View File

@ -26,7 +26,7 @@ class RecurringInvoiceFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
@ -52,7 +52,7 @@ class RecurringInvoiceFilters extends QueryFilters
* @param string client_status The invoice status as seen by the client * @param string client_status The invoice status as seen by the client
* @return Builder * @return Builder
*/ */
public function client_status(string $value = '') :Builder public function client_status(string $value = ''): Builder
{ {
if (strlen($value) == 0) { if (strlen($value) == 0) {
return $this->builder; return $this->builder;
@ -89,7 +89,7 @@ class RecurringInvoiceFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);
@ -99,7 +99,7 @@ class RecurringInvoiceFilters extends QueryFilters
/** /**
* Filters the query by the users company ID. * Filters the query by the users company ID.
* *
* @return Illuminate\Database\Query\Builder * @return Illuminate\Eloquent\Builder
*/ */
public function entityFilter() public function entityFilter()
{ {

View File

@ -22,7 +22,7 @@ class RecurringQuoteFilters extends QueryFilters
* Filter based on search text. * Filter based on search text.
* *
* @param string query filter * @param string query filter
* @return Builder * @return Illuminate\Database\Eloquent\Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = ''): Builder public function filter(string $filter = ''): Builder
@ -32,10 +32,10 @@ class RecurringQuoteFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('recurring_quotes.custom_value1', 'like', '%'.$filter.'%') $query->where('custom_value1', 'like', '%'.$filter.'%')
->orWhere('recurring_quotes.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('recurring_quotes.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('recurring_quotes.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
@ -43,7 +43,7 @@ class RecurringQuoteFilters extends QueryFilters
* Sorts the list based on $sort. * Sorts the list based on $sort.
* *
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Illuminate\Database\Eloquent\Builder
*/ */
public function sort(string $sort): Builder public function sort(string $sort): Builder
{ {
@ -55,7 +55,7 @@ class RecurringQuoteFilters extends QueryFilters
/** /**
* Filters the query by the users company ID. * Filters the query by the users company ID.
* *
* @return Builder * @return Illuminate\Database\Eloquent\Builder
*/ */
public function entityFilter(): Builder public function entityFilter(): Builder
{ {

View File

@ -35,15 +35,14 @@ class TaskFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('tasks.description', 'like', '%'.$filter.'%') $query->where('description', 'like', '%'.$filter.'%')
->orWhere('tasks.custom_value1', 'like', '%'.$filter.'%') ->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('tasks.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('tasks.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('tasks.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }
/** /**
* Filter based on client status. * Filter based on client status.
* *
@ -73,7 +72,7 @@ class TaskFilters extends QueryFilters
return $this->builder; return $this->builder;
} }
public function project_tasks($project) public function project_tasks($project): Builder
{ {
if (strlen($project) == 0) { if (strlen($project) == 0) {

View File

@ -32,7 +32,7 @@ class TaskStatusFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('task_statuses.name', 'like', '%'.$filter.'%'); $query->where('name', 'like', '%'.$filter.'%');
}); });
} }
@ -42,7 +42,7 @@ class TaskStatusFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);

View File

@ -32,7 +32,7 @@ class TaxRateFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('tax_rates.name', 'like', '%'.$filter.'%'); $query->where('name', 'like', '%'.$filter.'%');
}); });
} }
@ -42,7 +42,7 @@ class TaxRateFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);

View File

@ -25,14 +25,14 @@ class TokenFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('company_tokens.name', 'like', '%'.$filter.'%'); $query->where('name', 'like', '%'.$filter.'%');
}); });
} }
@ -42,7 +42,7 @@ class TokenFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);

View File

@ -25,17 +25,17 @@ class UserFilters extends QueryFilters
* @return Builder * @return Builder
* @deprecated * @deprecated
*/ */
public function filter(string $filter = '') : Builder public function filter(string $filter = ''): Builder
{ {
if (strlen($filter) == 0) { if (strlen($filter) == 0) {
return $this->builder; return $this->builder;
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('users.first_name', 'like', '%'.$filter.'%') $query->where('first_name', 'like', '%'.$filter.'%')
->orWhere('users.last_name', 'like', '%'.$filter.'%') ->orWhere('last_name', 'like', '%'.$filter.'%')
->orWhere('users.email', 'like', '%'.$filter.'%') ->orWhere('email', 'like', '%'.$filter.'%')
->orWhere('users.signature', 'like', '%'.$filter.'%'); ->orWhere('signature', 'like', '%'.$filter.'%');
}); });
} }
@ -46,7 +46,7 @@ class UserFilters extends QueryFilters
* @param string sort formatted as column|asc * @param string sort formatted as column|asc
* @return Builder * @return Builder
*/ */
public function sort(string $sort) : Builder public function sort(string $sort): Builder
{ {
$sort_col = explode('|', $sort); $sort_col = explode('|', $sort);

View File

@ -32,17 +32,17 @@ class VendorFilters extends QueryFilters
} }
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('vendors.name', 'like', '%'.$filter.'%') $query->where('name', 'like', '%'.$filter.'%')
->orWhere('vendors.id_number', 'like', '%'.$filter.'%') ->orWhere('id_number', 'like', '%'.$filter.'%')
->orWhereHas('contacts', function ($query) use ($filter) { ->orWhereHas('contacts', function ($query) use ($filter) {
$query->where('vendor_contacts.first_name', 'like', '%'.$filter.'%'); $query->where('first_name', 'like', '%'.$filter.'%');
$query->orWhere('vendor_contacts.last_name', 'like', '%'.$filter.'%'); $query->orWhere('last_name', 'like', '%'.$filter.'%');
$query->orWhere('vendor_contacts.email', 'like', '%'.$filter.'%'); $query->orWhere('email', 'like', '%'.$filter.'%');
}) })
->orWhere('vendors.custom_value1', 'like', '%'.$filter.'%') ->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value2', 'like', '%'.$filter.'%') ->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value3', 'like', '%'.$filter.'%') ->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value4', 'like', '%'.$filter.'%'); ->orWhere('custom_value4', 'like', '%'.$filter.'%');
}); });
} }

View File

@ -67,7 +67,7 @@ class ClientContactObserver
QuoteInvitation::withTrashed()->where('client_contact_id', $client_contact_id)->cursor()->each(function ($invite){ QuoteInvitation::withTrashed()->where('client_contact_id', $client_contact_id)->cursor()->each(function ($invite){
if($invite->invoice()->doesnthave('invitations')) if($invite->quote()->doesnthave('invitations'))
$invite->quote->service()->createInvitations(); $invite->quote->service()->createInvitations();
}); });
@ -75,7 +75,7 @@ class ClientContactObserver
RecurringInvoiceInvitation::withTrashed()->where('client_contact_id', $client_contact_id)->cursor()->each(function ($invite){ RecurringInvoiceInvitation::withTrashed()->where('client_contact_id', $client_contact_id)->cursor()->each(function ($invite){
if($invite->recurring_invoice()->doesnthave('invitations')) if($invite->recurring_invoice()->doesnthave('invitations'))
$invite->quote->service()->createInvitations(); $invite->recurring_invoice->service()->createInvitations();
}); });

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.59', 'app_version' => '5.5.60',
'app_tag' => '5.5.59', 'app_tag' => '5.5.60',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),