From ed5ce8634e6b84cf53a01e16d50454d53084b7e3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 25 May 2020 09:45:12 +1000 Subject: [PATCH] Fixes for self updater (#3740) * Add checks for duplicate contacts in invitations * Fixes for self updater --- app/Console/Commands/PostUpdate.php | 4 +++- app/Http/Controllers/SelfUpdateController.php | 2 ++ app/Http/Requests/Invoice/StoreInvoiceRequest.php | 3 +++ config/self-update.php | 6 +----- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index bd07b6e590bc..1add8cf765ec 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -38,6 +38,8 @@ class PostUpdate extends Command { set_time_limit(0); + info("running post update"); + try { Artisan::call('migrate'); } catch (Exception $e) { @@ -85,7 +87,7 @@ class PostUpdate extends Command $output = $factory->createOutput(); $input = new \Symfony\Component\Console\Input\ArrayInput(array( - 'command' => 'update --no-dev', + 'command' => 'install', )); $input->setInteractive(false); echo "
";
diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php
index ba39e6a90d95..7f3aa42d77eb 100644
--- a/app/Http/Controllers/SelfUpdateController.php
+++ b/app/Http/Controllers/SelfUpdateController.php
@@ -83,6 +83,8 @@ info(print_r($release,1));
 
 info(print_r($res,1));
 
+        Artisan::call('ninja:post-update');
+
         return response()->json(['message'=>$res], 200);
     }
 }
diff --git a/app/Http/Requests/Invoice/StoreInvoiceRequest.php b/app/Http/Requests/Invoice/StoreInvoiceRequest.php
index 5ae19fae33c8..2667ee259ce0 100644
--- a/app/Http/Requests/Invoice/StoreInvoiceRequest.php
+++ b/app/Http/Requests/Invoice/StoreInvoiceRequest.php
@@ -49,6 +49,9 @@ class StoreInvoiceRequest extends Request
 
         $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
 
+        $rules['invitations.*.client_contact_id'] = 'distinct';
+
+
         return $rules;
     }
 
diff --git a/config/self-update.php b/config/self-update.php
index 602bec8fd977..8bdef338cc2d 100644
--- a/config/self-update.php
+++ b/config/self-update.php
@@ -140,11 +140,7 @@ return [
         'post_update' => [
             'ninja:post-update' => [
                 'class' => \App\Console\Commands\PostUpdate::class,
-                'params' => [
-                    'log' => 1,
-                    'reset' => false,
-                    // etc.
-                ]            
+                'params' => []            
             ],
         ],
     ],