diff --git a/app/Http/Middleware/PasswordProtection.php b/app/Http/Middleware/PasswordProtection.php index 74aea8e573..e3a80cf457 100644 --- a/app/Http/Middleware/PasswordProtection.php +++ b/app/Http/Middleware/PasswordProtection.php @@ -57,9 +57,6 @@ class PasswordProtection $user = false; $google = new Google(); $user = $google->getTokenResponse(request()->header('X-API-OAUTH-PASSWORD')); - - nlog("user"); - nlog($user); if (is_array($user)) { @@ -68,8 +65,6 @@ class PasswordProtection 'oauth_provider_id'=> 'google' ]; - nlog($query); - //If OAuth and user also has a password set - check both if ($existing_user = MultiDB::hasUser($query) && auth()->user()->company()->oauth_password_required && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { diff --git a/app/Jobs/Company/CreateCompanyTaskStatuses.php b/app/Jobs/Company/CreateCompanyTaskStatuses.php index d95954f8d2..2c07dbf6cf 100644 --- a/app/Jobs/Company/CreateCompanyTaskStatuses.php +++ b/app/Jobs/Company/CreateCompanyTaskStatuses.php @@ -48,6 +48,9 @@ class CreateCompanyTaskStatuses MultiDB::setDb($this->company->db); + if(TaskStatus::where('company_id', $this->company->id)->count() > 0) + return; + $task_statuses = [ ['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 1], ['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 2], diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 1112121955..4200e4efb6 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -430,8 +430,6 @@ class Import implements ShouldQueue private function transformCompanyData(array $data): array { - nlog("pre transformed"); - nlog($data['settings']); $company_settings = CompanySettings::defaults(); @@ -454,9 +452,7 @@ class Import implements ShouldQueue $data['settings'] = $company_settings; } - - nlog("transformed Settings"); - nlog($data['settings']); + return $data; } diff --git a/app/Jobs/Util/RefreshPdfs.php b/app/Jobs/Util/RefreshPdfs.php new file mode 100644 index 0000000000..4de8e77457 --- /dev/null +++ b/app/Jobs/Util/RefreshPdfs.php @@ -0,0 +1,76 @@ +company = $company; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + + MultiDB::setDb($this->company->db); + + + InvoiceInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) { + + nlog("generating invoice pdf for {$invitation->invoice_id}"); + CreateEntityPdf::dispatch($invitation); + + }); + + QuoteInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) { + + nlog("generating quote pdf for {$invitation->quote_id}"); + CreateEntityPdf::dispatch($invitation); + + }); + + + CreditInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) { + + nlog("generating credit pdf for {$invitation->credit_id}"); + CreateEntityPdf::dispatch($invitation); + + }); + + } +} diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index de4518e295..68b3078cdf 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -940,7 +940,7 @@ class SubscriptionService 'subscription' => $this->subscription->hashed_id, 'recurring_invoice' => $recurring_invoice_hashed_id, 'client' => $invoice->client->hashed_id, - 'contact' => $invoice->client->primary_contact()->first()->hashed_id, + 'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->contacts->first() : false, 'invoice' => $invoice->hashed_id, ]; diff --git a/resources/views/portal/ninja2020/invoices/payment.blade.php b/resources/views/portal/ninja2020/invoices/payment.blade.php index 4f2b845185..6596f978e3 100644 --- a/resources/views/portal/ninja2020/invoices/payment.blade.php +++ b/resources/views/portal/ninja2020/invoices/payment.blade.php @@ -48,18 +48,28 @@ @endif