mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:24:36 -04:00
Fixes for Download Recurring Invoice
This commit is contained in:
parent
5affb4a036
commit
d1aae93c08
@ -33,6 +33,7 @@ use App\Utils\Traits\SavesDocuments;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RecurringInvoiceController.
|
* Class RecurringInvoiceController.
|
||||||
@ -500,9 +501,12 @@ class RecurringInvoiceController extends BaseController
|
|||||||
$contact = $invitation->contact;
|
$contact = $invitation->contact;
|
||||||
$recurring_invoice = $invitation->recurring_invoice;
|
$recurring_invoice = $invitation->recurring_invoice;
|
||||||
|
|
||||||
$file_path = $recurring_invoice->service()->getInvoicePdf($contact);
|
$file = $recurring_invoice->service()->getInvoicePdf($contact);
|
||||||
|
|
||||||
|
return response()->streamDownload(function () use($file) {
|
||||||
|
echo Storage::get($file);
|
||||||
|
}, basename($file));
|
||||||
|
|
||||||
return response()->download($file_path, basename($file_path), ['Cache-Control:' => 'no-cache'])->deleteFileAfterSend(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,14 +41,14 @@ class GetInvoicePdf extends AbstractService
|
|||||||
|
|
||||||
$file_path = $path.$this->entity->hashed_id.'.pdf';
|
$file_path = $path.$this->entity->hashed_id.'.pdf';
|
||||||
|
|
||||||
$disk = 'public';
|
$disk = config('filesystems.default');
|
||||||
|
|
||||||
$file = Storage::disk($disk)->exists($file_path);
|
$file = Storage::disk($disk)->exists($file_path);
|
||||||
|
|
||||||
if (! $file) {
|
if (! $file) {
|
||||||
$file_path = CreateEntityPdf::dispatchNow($invitation);
|
$file_path = CreateEntityPdf::dispatchNow($invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Storage::disk($disk)->path($file_path);
|
return $file_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user