diff --git a/app/Http/Requests/Invoice/StoreInvoiceRequest.php b/app/Http/Requests/Invoice/StoreInvoiceRequest.php index 1e933de98877..a8e64ef0531e 100644 --- a/app/Http/Requests/Invoice/StoreInvoiceRequest.php +++ b/app/Http/Requests/Invoice/StoreInvoiceRequest.php @@ -34,7 +34,7 @@ class StoreInvoiceRequest extends Request return [ 'client_id' => 'required', - 'invoice_type_id' => 'integer', + // 'invoice_type_id' => 'integer', // 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', ]; diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index ad897fe43649..596a86dba952 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -36,7 +36,7 @@ class UpdateInvoiceRequest extends Request return [ 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', 'client_id' => 'required|integer', - 'invoice_type_id' => 'integer', + //'invoice_type_id' => 'integer', ]; } diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php new file mode 100644 index 000000000000..5126fddbca0c --- /dev/null +++ b/app/Utils/SystemHealth.php @@ -0,0 +1,113 @@ + $system_health, + 'extensions' => self::extensions(), + 'php_version' => phpversion(), + 'min_php_version' => self::$php_version, + 'dbs' => self::dbCheck(), + ]; + + } + + private static function extensions() :array + { + + $loaded_extensions = []; + + foreach(self::$extensions as $extension) + { + + $loaded_extensions[] = [$extension => extension_loaded($extension)]; + + } + + return $loaded_extensions; + + } + + private static function dbCheck() :array + { + + $result = []; + + if (! config('ninja.db.multi_db_enabled')) + { + $pdo = DB::connection()->getPdo(); + + if($pdo) + $result[] = [ DB::connection()->getDatabaseName() => TRUE ]; + else + $result[] = [ config('database.connections.' . config('database.default') . '.database') => FALSE ]; + + } + else + { + + foreach (MultiDB::$dbs as $db) + { + MultiDB::setDB($db); + + $pdo = DB::connection()->getPdo(); + + if($pdo) + $result[] = [ DB::connection()->getDatabaseName() => TRUE ]; + else + $result[] = [ config('database.connections.' . config('database.default') . '.database') => FALSE ]; + } + + return $result; + } + + } + +} diff --git a/tests/Feature/InvoiceTest.php b/tests/Feature/InvoiceTest.php index 64bcd01e73b6..112a7ac31a48 100644 --- a/tests/Feature/InvoiceTest.php +++ b/tests/Feature/InvoiceTest.php @@ -179,6 +179,7 @@ class InvoiceTest extends TestCase $response->assertStatus(200); $invoice_update = [ + 'client_id' => $invoice->client_id, 'status_id' => Invoice::STATUS_PAID ]; diff --git a/tests/Feature/PaymentTest.php b/tests/Feature/PaymentTest.php index a3332e67bd49..3fcca2686d68 100644 --- a/tests/Feature/PaymentTest.php +++ b/tests/Feature/PaymentTest.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; +use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Session; use Tests\TestCase; @@ -46,8 +47,8 @@ class PaymentTest extends TestCase $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, - 'name' => $this->faker->company, - 'email' => $this->faker->unique()->safeEmail, + 'name' => $this->faker->company, + 'email' => $this->faker->unique()->safeEmail, 'password' => 'ALongAndBrilliantPassword123', '_token' => csrf_token(), 'privacy_policy' => 1, @@ -110,8 +111,8 @@ class PaymentTest extends TestCase $data = [ 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName, - 'name' => $this->faker->company, - 'email' => $this->faker->unique()->safeEmail, + 'name' => $this->faker->company, + 'email' => $this->faker->unique()->safeEmail, 'password' => 'ALongAndBrilliantPassword123', '_token' => csrf_token(), 'privacy_policy' => 1, @@ -176,7 +177,8 @@ class PaymentTest extends TestCase $response->assertStatus(200); $Payment_update = [ - 'amount' => 10 + 'amount' => 10, + 'payment_date' => Carbon::now() ]; $this->assertNotNull($Payment); diff --git a/tests/Feature/QuoteTest.php b/tests/Feature/QuoteTest.php index d6de163e8046..ca6e0b5b276e 100644 --- a/tests/Feature/QuoteTest.php +++ b/tests/Feature/QuoteTest.php @@ -178,7 +178,8 @@ class QuoteTest extends TestCase $response->assertStatus(200); $quote_update = [ - 'status_id' => Quote::STATUS_APPROVED + 'status_id' => Quote::STATUS_APPROVED, + 'client_id' => $quote->client_id, ]; $this->assertNotNull($quote); diff --git a/tests/Feature/RecurringInvoiceTest.php b/tests/Feature/RecurringInvoiceTest.php index 8663a197a8d2..54583caea362 100644 --- a/tests/Feature/RecurringInvoiceTest.php +++ b/tests/Feature/RecurringInvoiceTest.php @@ -179,7 +179,8 @@ Log::error($acc); $response->assertStatus(200); $RecurringInvoice_update = [ - 'status_id' => RecurringInvoice::STATUS_DRAFT + 'status_id' => RecurringInvoice::STATUS_DRAFT, + 'client_id' => $RecurringInvoice->client_id, ]; $this->assertNotNull($RecurringInvoice); diff --git a/tests/Feature/RecurringQuoteTest.php b/tests/Feature/RecurringQuoteTest.php index fbcb98a5a6d5..eed41bdb3cc7 100644 --- a/tests/Feature/RecurringQuoteTest.php +++ b/tests/Feature/RecurringQuoteTest.php @@ -179,7 +179,8 @@ class RecurringQuoteTest extends TestCase $response->assertStatus(200); $RecurringQuote_update = [ - 'status_id' => RecurringQuote::STATUS_DRAFT + 'status_id' => RecurringQuote::STATUS_DRAFT, + 'client_id' => $RecurringQuote->client_id, ]; $this->assertNotNull($RecurringQuote);