mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
minor fixes
This commit is contained in:
parent
8577566393
commit
634063779a
@ -24,7 +24,7 @@ class DesignFactory
|
||||
$design->is_active = true;
|
||||
$design->is_custom = true;
|
||||
$design->name = '';
|
||||
$design->design = [];
|
||||
$design->design = '[]';
|
||||
|
||||
return $design;
|
||||
}
|
||||
|
@ -556,4 +556,29 @@ class RecurringInvoiceController extends BaseController
|
||||
|
||||
return $this->itemResponse($recurring_invoice->fresh());
|
||||
}
|
||||
|
||||
public function downloadPdf(string $invitation_key)
|
||||
{
|
||||
$invitation = $this->recurring_invoice_repo->getInvitationByKey($invitation_key);
|
||||
|
||||
if (! $invitation) {
|
||||
return response()->json(['message' => 'no record found'], 400);
|
||||
}
|
||||
|
||||
$contact = $invitation->contact;
|
||||
$invoice = $invitation->recurring_invoice;
|
||||
|
||||
$file = $invoice->service()->getInvoicePdf($contact);
|
||||
|
||||
$headers = ['Content-Type' => 'application/pdf'];
|
||||
|
||||
if (request()->input('inline') == 'true') {
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
}
|
||||
|
||||
return response()->streamDownload(function () use ($file) {
|
||||
echo Storage::get($file);
|
||||
}, basename($file), $headers);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ class RecurringInvoiceRepository extends BaseRepository
|
||||
|
||||
public function getInvitationByKey($key) :?RecurringInvoiceInvitation
|
||||
{
|
||||
return RecurringInvoiceInvitation::where('key', $key)->first();
|
||||
return RecurringInvoiceInvitation::withTrashed()->where('key', $key)->first();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user