1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +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) {
$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;
}
$credit_filters = [];
if (in_array('draft', $status_parameters))

View File

@ -99,15 +99,15 @@ class InvoiceFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('invoices.number', 'like', '%'.$filter.'%')
->orWhere('invoices.po_number', 'like', '%'.$filter.'%')
->orWhere('invoices.date', 'like', '%'.$filter.'%')
->orWhere('invoices.amount', 'like', '%'.$filter.'%')
->orWhere('invoices.balance', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value1', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value2', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value3', 'like', '%'.$filter.'%')
->orWhere('invoices.custom_value4', 'like', '%'.$filter.'%');
$query->where('number', 'like', '%'.$filter.'%')
->orWhere('po_number', 'like', '%'.$filter.'%')
->orWhere('date', 'like', '%'.$filter.'%')
->orWhere('amount', 'like', '%'.$filter.'%')
->orWhere('balance', 'like', '%'.$filter.'%')
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -115,7 +115,7 @@ class InvoiceFilters extends QueryFilters
* @return Builder
* @throws RuntimeException
*/
public function without_deleted_clients()
public function without_deleted_clients(): Builder
{
return $this->builder->whereHas('client', function ($query) {
@ -127,7 +127,7 @@ class InvoiceFilters extends QueryFilters
* @return Builder
* @throws InvalidArgumentException
*/
public function upcoming()
public function upcoming(): Builder
{
return $this->builder
->where(function ($query) {
@ -141,9 +141,9 @@ class InvoiceFilters extends QueryFilters
* @return void
* @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(function ($query) {
$query->where('due_date', '<', now())
@ -157,7 +157,7 @@ class InvoiceFilters extends QueryFilters
* @return Builder
* @throws InvalidArgumentException
*/
public function payable(string $client_id = '')
public function payable(string $client_id = ''): Builder
{
if (strlen($client_id) == 0) {
return $this->builder;

View File

@ -32,12 +32,12 @@ class PaymentFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('payments.amount', 'like', '%'.$filter.'%')
->orWhere('payments.date', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value1', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value2', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value3', 'like', '%'.$filter.'%')
->orWhere('payments.custom_value4', 'like', '%'.$filter.'%');
$query->where('amount', 'like', '%'.$filter.'%')
->orWhere('date', 'like', '%'.$filter.'%')
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -78,7 +78,7 @@ class PaymentFilters extends QueryFilters
return true;
}
public function number(string $number) : Builder
public function number(string $number = ''): Builder
{
return $this->builder->where('number', $number);
}
@ -88,7 +88,7 @@ class PaymentFilters extends QueryFilters
*
* @return Illuminate\Database\Query\Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
if (auth()->guard('contact')->user()) {
return $this->contactViewFilter();

View File

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

View File

@ -34,12 +34,12 @@ class ProductFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('products.product_key', 'like', '%'.$filter.'%')
->orWhere('products.notes', 'like', '%'.$filter.'%')
->orWhere('products.custom_value1', 'like', '%'.$filter.'%')
->orWhere('products.custom_value2', 'like', '%'.$filter.'%')
->orWhere('products.custom_value3', 'like', '%'.$filter.'%')
->orWhere('products.custom_value4', 'like', '%'.$filter.'%');
$query->where('product_key', 'like', '%'.$filter.'%')
->orWhere('notes', 'like', '%'.$filter.'%')
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}

View File

@ -22,7 +22,7 @@ class ProjectFilters extends QueryFilters
* Filter based on search text.
*
* @param string query filter
* @return Builder
* @return Illuminate\Eloquent\Query\Builder
* @deprecated
*/
public function filter(string $filter = '') :Builder
@ -32,9 +32,9 @@ class ProjectFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('projects.name', 'like', '%'.$filter.'%')
->orWhere('projects.public_notes', 'like', '%'.$filter.'%')
->orWhere('projects.private_notes', 'like', '%'.$filter.'%');
$query->where('name', 'like', '%'.$filter.'%')
->orWhere('public_notes', 'like', '%'.$filter.'%')
->orWhere('private_notes', 'like', '%'.$filter.'%');
});
}
@ -42,7 +42,7 @@ class ProjectFilters extends QueryFilters
* Sorts the list based on $sort.
*
* @param string sort formatted as column|asc
* @return Builder
* @return Illuminate\Eloquent\Query\Builder
*/
public function sort(string $sort) :Builder
{
@ -55,9 +55,9 @@ class ProjectFilters extends QueryFilters
/**
* 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();
}

View File

@ -88,15 +88,15 @@ class PurchaseOrderFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('purchase_orders.number', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.number', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.date', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.amount', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.balance', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value1', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value2', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value3', 'like', '%'.$filter.'%')
->orWhere('purchase_orders.custom_value4', 'like', '%'.$filter.'%');
$query->where('number', 'like', '%'.$filter.'%')
->orWhere('number', 'like', '%'.$filter.'%')
->orWhere('date', 'like', '%'.$filter.'%')
->orWhere('amount', 'like', '%'.$filter.'%')
->orWhere('balance', 'like', '%'.$filter.'%')
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -119,7 +119,7 @@ class PurchaseOrderFilters extends QueryFilters
* 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
*/
public function entityFilter()
public function entityFilter(): Builder
{
if (auth()->guard('contact')->user()) {
return $this->contactViewFilter();

View File

@ -33,11 +33,11 @@ class QuoteFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('quotes.number', 'like', '%'.$filter.'%')
->orwhere('quotes.custom_value1', 'like', '%'.$filter.'%')
->orWhere('quotes.custom_value2', 'like', '%'.$filter.'%')
->orWhere('quotes.custom_value3', 'like', '%'.$filter.'%')
->orWhere('quotes.custom_value4', 'like', '%'.$filter.'%');
$query->where('number', 'like', '%'.$filter.'%')
->orwhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -111,7 +111,7 @@ class QuoteFilters extends QueryFilters
return $this->builder;
}
public function number($number = '')
public function number($number = ''): Builder
{
return $this->builder->where('number', 'like', '%'.$number.'%');
}
@ -135,9 +135,9 @@ class QuoteFilters extends QueryFilters
/**
* 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();
}

View File

@ -56,9 +56,9 @@ class RecurringExpenseFilters extends QueryFilters
/**
* 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();
}

View File

@ -99,7 +99,7 @@ class RecurringInvoiceFilters extends QueryFilters
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Illuminate\Eloquent\Builder
*/
public function entityFilter()
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,10 +32,10 @@ class UserFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('users.first_name', 'like', '%'.$filter.'%')
->orWhere('users.last_name', 'like', '%'.$filter.'%')
->orWhere('users.email', 'like', '%'.$filter.'%')
->orWhere('users.signature', 'like', '%'.$filter.'%');
$query->where('first_name', 'like', '%'.$filter.'%')
->orWhere('last_name', 'like', '%'.$filter.'%')
->orWhere('email', 'like', '%'.$filter.'%')
->orWhere('signature', 'like', '%'.$filter.'%');
});
}

View File

@ -32,17 +32,17 @@ class VendorFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('vendors.name', 'like', '%'.$filter.'%')
->orWhere('vendors.id_number', 'like', '%'.$filter.'%')
$query->where('name', 'like', '%'.$filter.'%')
->orWhere('id_number', 'like', '%'.$filter.'%')
->orWhereHas('contacts', function ($query) use ($filter) {
$query->where('vendor_contacts.first_name', 'like', '%'.$filter.'%');
$query->orWhere('vendor_contacts.last_name', 'like', '%'.$filter.'%');
$query->orWhere('vendor_contacts.email', 'like', '%'.$filter.'%');
$query->where('first_name', 'like', '%'.$filter.'%');
$query->orWhere('last_name', 'like', '%'.$filter.'%');
$query->orWhere('email', 'like', '%'.$filter.'%');
})
->orWhere('vendors.custom_value1', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value2', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value3', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value4', 'like', '%'.$filter.'%');
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', '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){
if($invite->invoice()->doesnthave('invitations'))
if($invite->quote()->doesnthave('invitations'))
$invite->quote->service()->createInvitations();
});
@ -75,7 +75,7 @@ class ClientContactObserver
RecurringInvoiceInvitation::withTrashed()->where('client_contact_id', $client_contact_id)->cursor()->each(function ($invite){
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),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.59',
'app_tag' => '5.5.59',
'app_version' => '5.5.60',
'app_tag' => '5.5.60',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),