mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Updates for Design Filters
This commit is contained in:
parent
50eceaf9d1
commit
8a0c802ed1
@ -24,7 +24,6 @@ class DesignFilters extends QueryFilters
|
|||||||
* @param string $filter
|
* @param string $filter
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*
|
*
|
||||||
* @deprecated
|
|
||||||
*/
|
*/
|
||||||
public function filter(string $filter = ''): Builder
|
public function filter(string $filter = ''): Builder
|
||||||
{
|
{
|
||||||
@ -33,7 +32,7 @@ class DesignFilters extends QueryFilters
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->builder->where(function ($query) use ($filter) {
|
return $this->builder->where(function ($query) use ($filter) {
|
||||||
$query->where('designs.name', 'like', '%'.$filter.'%');
|
$query->where('name', 'like', '%'.$filter.'%');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,17 +57,22 @@ class DesignFilters extends QueryFilters
|
|||||||
/**
|
/**
|
||||||
* Filters the query by the users company ID.
|
* Filters the query by the users company ID.
|
||||||
*
|
*
|
||||||
* @return Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function entityFilter(): Builder
|
public function entityFilter(): Builder
|
||||||
{
|
{
|
||||||
return $this->builder->where('company_id', auth()->user()->company()->id)->orWhere('company_id', null)->orderBy('id', 'asc');
|
//19-03-2023 change the scope for the design filters
|
||||||
|
return $this->builder->where(function ($query) {
|
||||||
|
$query->where('company_id', auth()->user()->company()->id)->orWhere('company_id', null)->orderBy('id', 'asc');
|
||||||
|
// return $this->builder->where('company_id', auth()->user()->company()->id)->orWhere('company_id', null)->orderBy('id', 'asc');
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the designs by `is_custom` column.
|
* Filter the designs by `is_custom` column.
|
||||||
*
|
*
|
||||||
* @return Illuminate\Database\Eloquent\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function custom(string $custom): Builder
|
public function custom(string $custom): Builder
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
* - overdue
|
* - overdue
|
||||||
* - reversed
|
* - reversed
|
||||||
*
|
*
|
||||||
* @param string client_status The invoice status as seen by the client
|
* @param string $value 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
|
||||||
@ -88,7 +88,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
/**
|
/**
|
||||||
* Filter based on search text.
|
* Filter based on search text.
|
||||||
*
|
*
|
||||||
* @param string query filter
|
* @param string $filter
|
||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@ -126,6 +126,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @return Builder
|
||||||
* @return Builder
|
* @return Builder
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
@ -141,6 +142,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
|
* @return Builder
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function overdue(): Builder
|
public function overdue(): Builder
|
||||||
@ -174,7 +176,7 @@ class InvoiceFilters 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 Builder
|
||||||
*/
|
*/
|
||||||
public function sort(string $sort = ''): Builder
|
public function sort(string $sort = ''): Builder
|
||||||
@ -194,9 +196,9 @@ class InvoiceFilters 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
|
||||||
*
|
*
|
||||||
* @return Illuminate\Database\Query\Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function entityFilter()
|
public function entityFilter(): Builder
|
||||||
{
|
{
|
||||||
if (auth()->guard('contact')->user()) {
|
if (auth()->guard('contact')->user()) {
|
||||||
return $this->contactViewFilter();
|
return $this->contactViewFilter();
|
||||||
@ -210,7 +212,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
* @return Builder
|
* @return Builder
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function private_notes($filter = '') :Builder
|
public function private_notes($filter = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($filter) == 0) {
|
if (strlen($filter) == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
@ -23,7 +23,7 @@ class ProductFilters extends QueryFilters
|
|||||||
/**
|
/**
|
||||||
* Filter based on search text.
|
* Filter based on search text.
|
||||||
*
|
*
|
||||||
* @param string query filter
|
* @param string $filter
|
||||||
* @return Builder
|
* @return Builder
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@ -115,7 +115,7 @@ abstract class QueryFilters
|
|||||||
* Explodes the value by delimiter.
|
* Explodes the value by delimiter.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @return stdClass
|
* @return \stdClass
|
||||||
*/
|
*/
|
||||||
public function split($value) : \stdClass
|
public function split($value) : \stdClass
|
||||||
{
|
{
|
||||||
@ -133,7 +133,7 @@ abstract class QueryFilters
|
|||||||
* Filters the list based on the status
|
* Filters the list based on the status
|
||||||
* archived, active, deleted.
|
* archived, active, deleted.
|
||||||
*
|
*
|
||||||
* @param string filter
|
* @param string $filter
|
||||||
* @return Builder
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function status(string $filter = ''): Builder
|
public function status(string $filter = ''): Builder
|
||||||
@ -196,13 +196,15 @@ abstract class QueryFilters
|
|||||||
*
|
*
|
||||||
* -Can only be used on contact routes
|
* -Can only be used on contact routes
|
||||||
*
|
*
|
||||||
* @return
|
* @return Builder
|
||||||
*/
|
*/
|
||||||
public function clientFilter()
|
public function clientFilter(): Builder
|
||||||
{
|
{
|
||||||
if (auth()->guard('contact')->user()) {
|
if (auth()->guard('contact')->user()) {
|
||||||
return $this->builder->where('client_id', auth()->guard('contact')->user()->client->id);
|
return $this->builder->where('client_id', auth()->guard('contact')->user()->client->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function created_at($value = '')
|
public function created_at($value = '')
|
||||||
|
@ -63,7 +63,7 @@ class PdfMock
|
|||||||
$pdf_config->entity_design_id = $pdf_config->settings->{"{$pdf_config->entity_string}_design_id"};
|
$pdf_config->entity_design_id = $pdf_config->settings->{"{$pdf_config->entity_string}_design_id"};
|
||||||
$pdf_config->setPdfVariables();
|
$pdf_config->setPdfVariables();
|
||||||
$pdf_config->setCurrency(Currency::find($this->settings->currency_id));
|
$pdf_config->setCurrency(Currency::find($this->settings->currency_id));
|
||||||
$pdf_config->setCountry(Country::find($this->settings->country_id));
|
$pdf_config->setCountry(Country::find($this->settings->country_id ?: 840));
|
||||||
$pdf_config->design = Design::find($this->decodePrimaryKey($pdf_config->entity_design_id));
|
$pdf_config->design = Design::find($this->decodePrimaryKey($pdf_config->entity_design_id));
|
||||||
$pdf_config->currency_entity = $this->mock->client;
|
$pdf_config->currency_entity = $this->mock->client;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user