1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

remove redundant code paths

This commit is contained in:
David Bomba 2023-10-26 13:47:46 +11:00
parent e98a12a50a
commit 3b86d39e1d

View File

@ -16,7 +16,6 @@ use Illuminate\Support\Carbon;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesDates;
use App\Helpers\Invoice\InvoiceSum;
// use App\Jobs\Entity\CreateEntityPdf;
use App\Utils\Traits\MakesReminders;
use App\Services\Credit\CreditService;
use App\Services\Ledger\LedgerService;
@ -358,54 +357,6 @@ class Credit extends BaseModel
$this->saveQuietly();
}
/** @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->credit_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);
}
public function markInvitationsSent()
{
$this->invitations->each(function ($invitation) {