diff --git a/app/Models/CreditInvitation.php b/app/Models/CreditInvitation.php index f1473f4944ca..d5d449e388aa 100644 --- a/app/Models/CreditInvitation.php +++ b/app/Models/CreditInvitation.php @@ -11,13 +11,10 @@ namespace App\Models; -// use App\Jobs\Entity\CreateEntityPdf; use App\Utils\Traits\Inviteable; use App\Utils\Traits\MakesDates; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\Storage; /** * App\Models\CreditInvitation @@ -155,15 +152,4 @@ class CreditInvitation extends BaseModel $this->save(); } - /** @deprecated 5.7 */ - public function pdf_file_path() - { - $storage_path = Storage::url($this->credit->client->quote_filepath($this).$this->credit->numberFormatter().'.pdf'); - - if (! Storage::exists($this->credit->client->credit_filepath($this).$this->credit->numberFormatter().'.pdf')) { - // (new CreateEntityPdf($this))->handle(); - } - - return $storage_path; - } } diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index abec2ad21ac5..928b49525c58 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -15,7 +15,6 @@ use App\Utils\Ninja; use Illuminate\Support\Carbon; use App\Utils\Traits\MakesDates; use App\Helpers\Invoice\InvoiceSum; -// use App\Jobs\Entity\CreateEntityPdf; use App\Utils\Traits\MakesReminders; use App\Utils\Traits\NumberFormatter; use App\Services\Ledger\LedgerService; @@ -526,67 +525,6 @@ class Invoice extends BaseModel return $invoice_calc->build(); } - /** @deprecated 5.7 */ - public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false) - { - - if (! $invitation) { - if ($this->invitations()->exists()) { - $invitation = $this->invitations()->first(); - } else { - $this->service()->createInvitations(); - $invitation = $this->invitations()->first(); - } - } - - if (! $invitation) { - throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - } - - $file_path = $this->client->invoice_filepath($invitation).$this->numberFormatter().'.pdf'; - - $file_exists = false; - - /* Flysystem throws an exception if the path is "corrupted" so lets wrap it in a try catch and return a bool 06/01/2022*/ - try { - $file_exists = Storage::disk(config('filesystems.default'))->exists($file_path); - } catch (\Exception $e) { - nlog($e->getMessage()); - } - - if (Ninja::isHosted() && $portal && $file_exists) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } elseif (Ninja::isHosted()) { - // $file_path = (new CreateEntityPdf($invitation, config('filesystems.default')))->handle(); - - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - try { - $file_exists = Storage::disk(config('filesystems.default'))->exists($file_path); - } catch (\Exception $e) { - nlog($e->getMessage()); - } - - if ($file_exists) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - try { - $file_exists = Storage::disk('public')->exists($file_path); - } catch (\Exception $e) { - nlog($e->getMessage()); - } - - if ($file_exists) { - return Storage::disk('public')->{$type}($file_path); - } - - // $file_path = (new CreateEntityPdf($invitation))->handle(); - - return Storage::disk('public')->{$type}($file_path); - } - public function markInvitationsSent() { $this->invitations->each(function ($invitation) { diff --git a/app/Models/InvoiceInvitation.php b/app/Models/InvoiceInvitation.php index 61578c427fd1..eff3ab15915f 100644 --- a/app/Models/InvoiceInvitation.php +++ b/app/Models/InvoiceInvitation.php @@ -12,7 +12,6 @@ namespace App\Models; use App\Events\Invoice\InvoiceWasUpdated; -// use App\Jobs\Entity\CreateEntityPdf; use App\Utils\Ninja; use App\Utils\Traits\Inviteable; use App\Utils\Traits\MakesDates; @@ -157,16 +156,4 @@ class InvoiceInvitation extends BaseModel $this->save(); } - /** @deprecated 5.7 */ - public function pdf_file_path(): string - { - $storage_path = Storage::url($this->invoice->client->invoice_filepath($this).$this->invoice->numberFormatter().'.pdf'); - - if (! Storage::exists($this->invoice->client->invoice_filepath($this).$this->invoice->numberFormatter().'.pdf')) { - event(new InvoiceWasUpdated($this->invoice, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); - // (new CreateEntityPdf($this))->handle(); - } - - return $storage_path; - } } diff --git a/app/Models/PurchaseOrder.php b/app/Models/PurchaseOrder.php index 7752d919190f..6048d378f970 100644 --- a/app/Models/PurchaseOrder.php +++ b/app/Models/PurchaseOrder.php @@ -281,39 +281,6 @@ class PurchaseOrder extends BaseModel }); } - /** @deprecated 5.7 */ - public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false) - { - if (! $invitation) { - if ($this->invitations()->exists()) { - $invitation = $this->invitations()->first(); - } else { - $this->service()->createInvitations(); - $invitation = $this->invitations()->first(); - } - } - - if (!$invitation) { - throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - } - - $file_path = $this->vendor->purchase_order_filepath($invitation).$this->numberFormatter().'.pdf'; - - if (Ninja::isHosted() && $portal && Storage::disk(config('filesystems.default'))->exists($file_path)) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } elseif (Ninja::isHosted() && $portal) { - $file_path = (new CreatePurchaseOrderPdf($invitation, config('filesystems.default')))->handle(); - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - if (Storage::disk('public')->exists($file_path)) { - return Storage::disk('public')->{$type}($file_path); - } - - $file_path = (new CreatePurchaseOrderPdf($invitation))->handle(); - return Storage::disk('public')->{$type}($file_path); - } - public function invitations(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(PurchaseOrderInvitation::class); diff --git a/app/Models/Quote.php b/app/Models/Quote.php index a2c18c5aef84..054690249095 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -13,7 +13,6 @@ namespace App\Models; use App\Helpers\Invoice\InvoiceSum; use App\Helpers\Invoice\InvoiceSumInclusive; -// use App\Jobs\Entity\CreateEntityPdf; use App\Models\Presenters\QuotePresenter; use App\Services\Quote\QuoteService; use App\Utils\Ninja; @@ -314,52 +313,6 @@ class Quote extends BaseModel return new QuoteService($this); } - /** @deprecated 5.7 */ - public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false) - { - if (! $invitation) { - if ($this->invitations()->exists()) { - $invitation = $this->invitations()->first(); - } else { - $this->service()->createInvitations(); - $invitation = $this->invitations()->first(); - } - } - - if (! $invitation) { - throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - } - - $file_path = $this->client->quote_filepath($invitation).$this->numberFormatter().'.pdf'; - - if (Ninja::isHosted() && $portal && Storage::disk(config('filesystems.default'))->exists($file_path)) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } elseif (Ninja::isHosted() && $portal) { - // $file_path = (new CreateEntityPdf($invitation, config('filesystems.default')))->handle(); - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - $file_exists = false; - - try { - $file_exists = Storage::disk(config('filesystems.default'))->exists($file_path); - } catch (\Exception $e) { - nlog($e->getMessage()); - } - - if ($file_exists) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - if (Storage::disk('public')->exists($file_path)) { - return Storage::disk('public')->{$type}($file_path); - } - - // $file_path = (new CreateEntityPdf($invitation))->handle(); - - return Storage::disk('public')->{$type}($file_path); - } - /** * @param int $status * @return string diff --git a/app/Models/QuoteInvitation.php b/app/Models/QuoteInvitation.php index 878a74869098..34e01ea5cbbe 100644 --- a/app/Models/QuoteInvitation.php +++ b/app/Models/QuoteInvitation.php @@ -139,16 +139,4 @@ class QuoteInvitation extends BaseModel $this->save(); } - /** @deprecated 5.7 */ - - public function pdf_file_path() - { - $storage_path = Storage::url($this->quote->client->quote_filepath($this).$this->quote->numberFormatter().'.pdf'); - - if (! Storage::exists($this->quote->client->quote_filepath($this).$this->quote->numberFormatter().'.pdf')) { - // (new CreateEntityPdf($this))->handle(); - } - - return $storage_path; - } } diff --git a/app/Services/Credit/CreditService.php b/app/Services/Credit/CreditService.php index 6ed9a4df141b..365a9d1f2176 100644 --- a/app/Services/Credit/CreditService.php +++ b/app/Services/Credit/CreditService.php @@ -17,7 +17,6 @@ use App\Models\Payment; use App\Models\PaymentType; use App\Factory\PaymentFactory; use App\Utils\Traits\MakesHash; -// use App\Jobs\Entity\CreateEntityPdf; use App\Repositories\CreditRepository; use App\Repositories\PaymentRepository; use Illuminate\Support\Facades\Storage; diff --git a/app/Services/Credit/GetCreditPdf.php b/app/Services/Credit/GetCreditPdf.php index e1f59b68236b..d43bb335ae55 100644 --- a/app/Services/Credit/GetCreditPdf.php +++ b/app/Services/Credit/GetCreditPdf.php @@ -11,8 +11,8 @@ namespace App\Services\Credit; -use App\Models\CreditInvitation; use App\Jobs\Entity\CreateRawPdf; +use App\Models\CreditInvitation; use App\Services\AbstractService; class GetCreditPdf extends AbstractService diff --git a/app/Services/PurchaseOrder/TriggeredActions.php b/app/Services/PurchaseOrder/TriggeredActions.php index 624efc3ac4fd..9e4fb63ace5e 100644 --- a/app/Services/PurchaseOrder/TriggeredActions.php +++ b/app/Services/PurchaseOrder/TriggeredActions.php @@ -38,7 +38,6 @@ class TriggeredActions extends AbstractService $this->purchase_order ->service() ->markSent() - // ->touchPdf() ->save(); $this->sendEmail(); @@ -48,7 +47,6 @@ class TriggeredActions extends AbstractService $this->purchase_order = $this->purchase_order ->service() ->markSent() - // ->touchPdf() ->save(); }