1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #6338 from turbo124/v5-develop

Fixes for filters
This commit is contained in:
David Bomba 2021-07-26 21:53:28 +10:00 committed by GitHub
commit 1fa10f14f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 10 deletions

View File

@ -49,6 +49,10 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps: steps:
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 ninja.test" | sudo tee -a /etc/hosts
- name: Start mysql service - name: Start mysql service
run: | run: |
sudo /etc/init.d/mysql start sudo /etc/init.d/mysql start

View File

@ -92,9 +92,11 @@ class ClientFilters extends QueryFilters
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('clients.name', 'like', '%'.$filter.'%') $query->where('clients.name', 'like', '%'.$filter.'%')
->orWhere('clients.id_number', 'like', '%'.$filter.'%') ->orWhere('clients.id_number', 'like', '%'.$filter.'%')
->orWhere('client_contacts.first_name', 'like', '%'.$filter.'%') ->orWhereHas('contacts', function ($query) use($filter){
->orWhere('client_contacts.last_name', 'like', '%'.$filter.'%') $query->where('first_name', 'like', '%'.$filter.'%');
->orWhere('client_contacts.email', 'like', '%'.$filter.'%') $query->orWhere('last_name', 'like', '%'.$filter.'%');
$query->orWhere('email', 'like', '%'.$filter.'%');
})
->orWhere('clients.custom_value1', 'like', '%'.$filter.'%') ->orWhere('clients.custom_value1', 'like', '%'.$filter.'%')
->orWhere('clients.custom_value2', 'like', '%'.$filter.'%') ->orWhere('clients.custom_value2', 'like', '%'.$filter.'%')
->orWhere('clients.custom_value3', 'like', '%'.$filter.'%') ->orWhere('clients.custom_value3', 'like', '%'.$filter.'%')

View File

@ -38,9 +38,11 @@ class ExpenseFilters extends QueryFilters
return $this->builder->where(function ($query) use ($filter) { return $this->builder->where(function ($query) use ($filter) {
$query->where('expenses.name', 'like', '%'.$filter.'%') $query->where('expenses.name', 'like', '%'.$filter.'%')
->orWhere('expenses.id_number', 'like', '%'.$filter.'%') ->orWhere('expenses.id_number', 'like', '%'.$filter.'%')
->orWhere('expense_contacts.first_name', 'like', '%'.$filter.'%') ->orWhereHas('contacts', function ($query) use($filter){
->orWhere('expense_contacts.last_name', 'like', '%'.$filter.'%') $query->where('expense_contacts.first_name', 'like', '%'.$filter.'%');
->orWhere('expense_contacts.email', 'like', '%'.$filter.'%') $query->orWhere('expense_contacts.last_name', 'like', '%'.$filter.'%');
$query->orWhere('expense_contacts.email', 'like', '%'.$filter.'%');
})
->orWhere('expenses.custom_value1', 'like', '%'.$filter.'%') ->orWhere('expenses.custom_value1', 'like', '%'.$filter.'%')
->orWhere('expenses.custom_value2', 'like', '%'.$filter.'%') ->orWhere('expenses.custom_value2', 'like', '%'.$filter.'%')
->orWhere('expenses.custom_value3', 'like', '%'.$filter.'%') ->orWhere('expenses.custom_value3', 'like', '%'.$filter.'%')

View File

@ -13,6 +13,7 @@ namespace App\Filters;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\User; use App\Models\User;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -21,6 +22,7 @@ use Illuminate\Support\Carbon;
*/ */
class InvoiceFilters extends QueryFilters class InvoiceFilters extends QueryFilters
{ {
use MakesHash;
/** /**
* Filter based on client status. * Filter based on client status.
* *
@ -65,6 +67,18 @@ class InvoiceFilters extends QueryFilters
return $this->builder; return $this->builder;
} }
public function client_id(string $client_id = '') :Builder
{
if (strlen($client_id) == 0) {
return $this->builder;
}
$this->builder->where('client_id', $this->decodePrimaryKey($client_id));
return $this->builder;
}
public function number(string $number) :Builder public function number(string $number) :Builder
{ {
return $this->builder->where('number', $number); return $this->builder->where('number', $number);
@ -96,6 +110,7 @@ class InvoiceFilters extends QueryFilters
}); });
} }
/** /**
* Filters the list based on the status * Filters the list based on the status
* archived, active, deleted - legacy from V1. * archived, active, deleted - legacy from V1.

View File

@ -38,9 +38,11 @@ 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('vendors.name', 'like', '%'.$filter.'%')
->orWhere('vendors.id_number', 'like', '%'.$filter.'%') ->orWhere('vendors.id_number', 'like', '%'.$filter.'%')
->orWhere('vendor_contacts.first_name', 'like', '%'.$filter.'%') ->orWhereHas('contacts', function ($query) use($filter){
->orWhere('vendor_contacts.last_name', 'like', '%'.$filter.'%') $query->where('vendor_contacts.first_name', 'like', '%'.$filter.'%');
->orWhere('vendor_contacts.email', 'like', '%'.$filter.'%') $query->orWhere('vendor_contacts.last_name', 'like', '%'.$filter.'%');
$query->orWhere('vendor_contacts.email', 'like', '%'.$filter.'%');
})
->orWhere('vendors.custom_value1', 'like', '%'.$filter.'%') ->orWhere('vendors.custom_value1', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value2', 'like', '%'.$filter.'%') ->orWhere('vendors.custom_value2', 'like', '%'.$filter.'%')
->orWhere('vendors.custom_value3', 'like', '%'.$filter.'%') ->orWhere('vendors.custom_value3', 'like', '%'.$filter.'%')

View File

@ -167,7 +167,8 @@ trait MockAccountData
$settings = CompanySettings::defaults(); $settings = CompanySettings::defaults();
$settings->company_logo = asset('images/new_logo.png'); $settings->company_logo = '';
// $settings->company_logo = asset('images/new_logo.png');
$settings->website = 'www.invoiceninja.com'; $settings->website = 'www.invoiceninja.com';
$settings->address1 = 'Address 1'; $settings->address1 = 'Address 1';
$settings->address2 = 'Address 2'; $settings->address2 = 'Address 2';