From ac0d63b0b2cecfcbe1f15f4f69583bd6e05f3cad Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 May 2020 22:54:22 +1000 Subject: [PATCH] Fixes for Readme (#3721) * Skip preview tests * Fixes for product test * Fixes for tests * Update README.md * Update README.md * Update README.md * Update README.md * Fixes for incorrect payment types * Refactor class nameS * Entity Notification refactor * Entity Notifications * Add oauth_provider to User transformer * Invoices can only be deleted in the balance in zero --- app/Http/Controllers/BaseController.php | 6 ++++++ app/Http/Middleware/StartupCheck.php | 2 ++ app/Transformers/UserTransformer.php | 1 + app/Utils/Traits/Invoice/ActionsInvoice.php | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index d2804c94343b..585deebab093 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -311,6 +311,12 @@ class BaseController extends Controller public function flutterRoute() { + + // // Ensure all request are over HTTPS in production + // if (! request()->secure()) { + // return redirect()->secure(request()->path()); + // } + if ((bool)$this->checkAppSetup() !== false) { $data = []; diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index 84a0e1f37cb1..d8abfe9ca4a4 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -45,6 +45,8 @@ class StartupCheck Session::flash('message', 'Cache cleared'); } + + /* Make sure our cache is built */ $cached_tables = config('ninja.cached_tables'); diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index 7c3e017914df..2d5aba5e4d3f 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -64,6 +64,7 @@ class UserTransformer extends EntityTransformer 'custom_value2' => $user->custom_value2 ?: '', 'custom_value3' => $user->custom_value3 ?: '', 'custom_value4' => $user->custom_value4 ?: '', + 'oauth_provider_id' => (string)$user->oauth_provider_id, ]; } diff --git a/app/Utils/Traits/Invoice/ActionsInvoice.php b/app/Utils/Traits/Invoice/ActionsInvoice.php index 7b6c9988b003..78c344def9de 100644 --- a/app/Utils/Traits/Invoice/ActionsInvoice.php +++ b/app/Utils/Traits/Invoice/ActionsInvoice.php @@ -17,7 +17,7 @@ trait ActionsInvoice { public function invoiceDeletable($invoice) :bool { - if ($invoice->status_id <= Invoice::STATUS_SENT && $invoice->is_deleted == false && $invoice->deleted_at == null) { + if ($invoice->status_id <= Invoice::STATUS_SENT && $invoice->is_deleted == false && $invoice->deleted_at == null && $invoice->balance == 0) { return true; }