From 64f3acca74a13eb9ad5145e8a382cdfb4e362124 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 20:05:30 +1000 Subject: [PATCH 01/11] Fixes for github actions --- .env.ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.ci b/.env.ci index a033ea644c..bd3fdaf407 100644 --- a/.env.ci +++ b/.env.ci @@ -2,7 +2,7 @@ APP_NAME="Invoice Ninja" APP_ENV=local APP_KEY= APP_DEBUG=true -APP_URL=http://ninja.test +APP_URL=http://localhost MULTI_DB_ENABLED=false # database DB_CONNECTION=mysql From 42de43b5746841e6b54b293497a9888f49e3d9fa Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 20:25:07 +1000 Subject: [PATCH 02/11] Fixes for client queries --- app/Filters/ClientFilters.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Filters/ClientFilters.php b/app/Filters/ClientFilters.php index a47fbb9c8f..4d4102e037 100644 --- a/app/Filters/ClientFilters.php +++ b/app/Filters/ClientFilters.php @@ -92,9 +92,11 @@ class ClientFilters extends QueryFilters return $this->builder->where(function ($query) use ($filter) { $query->where('clients.name', 'like', '%'.$filter.'%') ->orWhere('clients.id_number', 'like', '%'.$filter.'%') - ->orWhere('client_contacts.first_name', 'like', '%'.$filter.'%') - ->orWhere('client_contacts.last_name', 'like', '%'.$filter.'%') - ->orWhere('client_contacts.email', 'like', '%'.$filter.'%') + ->orWhereHas('contacts', function ($query) use($filter){ + $query->where('first_name', 'like', '%'.$filter.'%'); + $query->orWhere('last_name', 'like', '%'.$filter.'%'); + $query->orWhere('email', 'like', '%'.$filter.'%'); + }) ->orWhere('clients.custom_value1', 'like', '%'.$filter.'%') ->orWhere('clients.custom_value2', 'like', '%'.$filter.'%') ->orWhere('clients.custom_value3', 'like', '%'.$filter.'%') From dd70223652a5a5c25328c0bb2dbb1615f6b2ca0f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 20:29:41 +1000 Subject: [PATCH 03/11] Fixes for filters --- app/Filters/ExpenseFilters.php | 8 +++++--- app/Filters/VendorFilters.php | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Filters/ExpenseFilters.php b/app/Filters/ExpenseFilters.php index ac54ac9d75..8992424d59 100644 --- a/app/Filters/ExpenseFilters.php +++ b/app/Filters/ExpenseFilters.php @@ -38,9 +38,11 @@ class ExpenseFilters extends QueryFilters return $this->builder->where(function ($query) use ($filter) { $query->where('expenses.name', 'like', '%'.$filter.'%') ->orWhere('expenses.id_number', 'like', '%'.$filter.'%') - ->orWhere('expense_contacts.first_name', 'like', '%'.$filter.'%') - ->orWhere('expense_contacts.last_name', 'like', '%'.$filter.'%') - ->orWhere('expense_contacts.email', 'like', '%'.$filter.'%') + ->orWhereHas('contacts', function ($query) use($filter){ + $query->where('expense_contacts.first_name', '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_value2', 'like', '%'.$filter.'%') ->orWhere('expenses.custom_value3', 'like', '%'.$filter.'%') diff --git a/app/Filters/VendorFilters.php b/app/Filters/VendorFilters.php index 231bc4f5e8..0dafbb589d 100644 --- a/app/Filters/VendorFilters.php +++ b/app/Filters/VendorFilters.php @@ -38,9 +38,11 @@ class VendorFilters extends QueryFilters return $this->builder->where(function ($query) use ($filter) { $query->where('vendors.name', 'like', '%'.$filter.'%') ->orWhere('vendors.id_number', 'like', '%'.$filter.'%') - ->orWhere('vendor_contacts.first_name', 'like', '%'.$filter.'%') - ->orWhere('vendor_contacts.last_name', 'like', '%'.$filter.'%') - ->orWhere('vendor_contacts.email', '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.'%'); + }) ->orWhere('vendors.custom_value1', 'like', '%'.$filter.'%') ->orWhere('vendors.custom_value2', 'like', '%'.$filter.'%') ->orWhere('vendors.custom_value3', 'like', '%'.$filter.'%') From 24ad605de0c8e683189443dcc0d9fcf306f1ffd0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 20:30:46 +1000 Subject: [PATCH 04/11] Fixes for github --- .env.ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.ci b/.env.ci index bd3fdaf407..87bb3403d0 100644 --- a/.env.ci +++ b/.env.ci @@ -2,7 +2,7 @@ APP_NAME="Invoice Ninja" APP_ENV=local APP_KEY= APP_DEBUG=true -APP_URL=http://localhost +APP_URL=http://127.0.0.1 MULTI_DB_ENABLED=false # database DB_CONNECTION=mysql From 006939759827bda88f1b75a3b66062521edff999 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:02:46 +1000 Subject: [PATCH 05/11] fixes for github actions --- .env.ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.ci b/.env.ci index 87bb3403d0..102342d453 100644 --- a/.env.ci +++ b/.env.ci @@ -2,7 +2,7 @@ APP_NAME="Invoice Ninja" APP_ENV=local APP_KEY= APP_DEBUG=true -APP_URL=http://127.0.0.1 +APP_URL=http://172.17.0.1 MULTI_DB_ENABLED=false # database DB_CONNECTION=mysql From 39d82f1c422b433860c7c9fb5e5c9a79fd397ba3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:09:16 +1000 Subject: [PATCH 06/11] Additional filters --- .env.ci | 2 +- app/Filters/InvoiceFilters.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.env.ci b/.env.ci index 102342d453..a033ea644c 100644 --- a/.env.ci +++ b/.env.ci @@ -2,7 +2,7 @@ APP_NAME="Invoice Ninja" APP_ENV=local APP_KEY= APP_DEBUG=true -APP_URL=http://172.17.0.1 +APP_URL=http://ninja.test MULTI_DB_ENABLED=false # database DB_CONNECTION=mysql diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 254183ebf4..df0e557b42 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -13,6 +13,7 @@ namespace App\Filters; use App\Models\Invoice; use App\Models\User; +use App\Utils\Traits\MakesHash; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Carbon; @@ -21,6 +22,7 @@ use Illuminate\Support\Carbon; */ class InvoiceFilters extends QueryFilters { + use MakesHash; /** * Filter based on client status. * @@ -65,6 +67,18 @@ class InvoiceFilters extends QueryFilters 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 { return $this->builder->where('number', $number); @@ -96,6 +110,7 @@ class InvoiceFilters extends QueryFilters }); } + /** * Filters the list based on the status * archived, active, deleted - legacy from V1. From 3c6a8495056c3e87dd822e923b3349d63301c478 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:18:26 +1000 Subject: [PATCH 07/11] Fixes for github actions --- .github/workflows/phpunit.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 67440856c8..98b1cc08ad 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -6,6 +6,10 @@ on: branches: - v5-develop +environment: + name: dev + url: https://ninja.test + name: phpunit jobs: run: From b423ae0cfe7663d245e2c7c89b45bade33e3854f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:20:32 +1000 Subject: [PATCH 08/11] Fixes for github actions --- .github/workflows/phpunit.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 98b1cc08ad..e7063c5f37 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -6,10 +6,6 @@ on: branches: - v5-develop -environment: - name: dev - url: https://ninja.test - name: phpunit jobs: run: @@ -38,6 +34,7 @@ jobs: NINJA_LICENSE: 123456 TRAVIS: true MAIL_MAILER: log + APP_URL: http://ninja.test services: mariadb: From 34aa2f29eda3beea6e46c6dce09c380d1ac6558c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:26:22 +1000 Subject: [PATCH 09/11] Fixes for github actions --- .github/workflows/phpunit.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index e7063c5f37..bbdd6e6c42 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -49,6 +49,11 @@ jobs: MYSQL_ROOT_PASSWORD: ninja options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 + steps: + - name: Add hosts to /etc/hosts + run: | + sudo echo "127.0.0.1 ninja.test" | sudo tee -a /etc/hosts + steps: - name: Start mysql service run: | From 36dc83636c02df7df01da4c83b39bfb706236617 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:26:53 +1000 Subject: [PATCH 10/11] Fixes for github actions --- .github/workflows/phpunit.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index bbdd6e6c42..a0dfaac523 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -54,7 +54,6 @@ jobs: run: | sudo echo "127.0.0.1 ninja.test" | sudo tee -a /etc/hosts - steps: - name: Start mysql service run: | sudo /etc/init.d/mysql start From 6925c6e9f5794859294eb3e79258e51a1974dcef Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Jul 2021 21:31:21 +1000 Subject: [PATCH 11/11] Fixes for github actions --- .github/workflows/phpunit.yml | 1 - tests/MockAccountData.php | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index a0dfaac523..261ffa7fc6 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -34,7 +34,6 @@ jobs: NINJA_LICENSE: 123456 TRAVIS: true MAIL_MAILER: log - APP_URL: http://ninja.test services: mariadb: diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index 227200e9dd..33c11a94d8 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -167,7 +167,8 @@ trait MockAccountData $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->address1 = 'Address 1'; $settings->address2 = 'Address 2';