mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 03:14:47 -04:00
Fixes for designs and pdf_variables (#3425)
This commit is contained in:
parent
7acc6ee300
commit
ab4ec76830
@ -125,14 +125,44 @@ class PreviewController extends BaseController
|
|||||||
|
|
||||||
private function blankEntity()
|
private function blankEntity()
|
||||||
{
|
{
|
||||||
|
$client = factory(\App\Models\Client::class)->create([
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
'company_id' => auth()->user()->company()->id,
|
||||||
|
]);
|
||||||
|
|
||||||
return response()->json(['message' => 'Blank Entity not implemented.'], 200);
|
$contact = factory(\App\Models\ClientContact::class)->create([
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
'company_id' => auth()->user()->company()->id,
|
||||||
|
'client_id' => $client->id,
|
||||||
|
'is_primary' => 1,
|
||||||
|
'send_email' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$invoice = factory(\App\Models\Invoice::class)->create([
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
'company_id' => auth()->user()->company()->id,
|
||||||
|
'client_id' => $client->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$invoice->setRelation('client', $client);
|
||||||
|
$invoice->load('client');
|
||||||
|
|
||||||
|
$invoice_design = new Custom((object)request()->input('body'));
|
||||||
|
|
||||||
|
$designer = new Designer($invoice, $invoice_design, $invoice->client->getSetting('pdf_variables'), lcfirst(request()->has('entity')));
|
||||||
|
|
||||||
|
$html = $this->generateInvoiceHtml($designer->build()->getHtml(), $invoice);
|
||||||
|
|
||||||
|
$file_path = PreviewPdf::dispatchNow($html, auth()->user()->company());
|
||||||
|
|
||||||
|
$invoice->forceDelete();
|
||||||
|
$contact->forceDelete();
|
||||||
|
$client->forceDelete();
|
||||||
|
|
||||||
|
return response()->download($file_path)->deleteFileAfterSend(true);
|
||||||
|
|
||||||
// $invoice_design = new Custom((object)request()->input('body'));
|
|
||||||
|
|
||||||
// $file_path = PreviewPdf::dispatchNow(request()->input('body'), auth()->user()->company());
|
|
||||||
|
|
||||||
// return response()->download($file_path)->deleteFileAfterSend(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ trait CompanySettingsSaver
|
|||||||
$settings = (object)$settings;
|
$settings = (object)$settings;
|
||||||
$casts = CompanySettings::$casts;
|
$casts = CompanySettings::$casts;
|
||||||
|
|
||||||
|
if(property_exists($settings, 'pdf_variables'))
|
||||||
|
unset($settings->pdf_variables);
|
||||||
|
|
||||||
ksort($casts);
|
ksort($casts);
|
||||||
|
|
||||||
foreach ($casts as $key => $value) {
|
foreach ($casts as $key => $value) {
|
||||||
|
@ -45,7 +45,6 @@ class DesignSeeder extends Seeder
|
|||||||
$design_object->include = $invoice_design->include();
|
$design_object->include = $invoice_design->include();
|
||||||
$design_object->header = $invoice_design->header();
|
$design_object->header = $invoice_design->header();
|
||||||
$design_object->body = $invoice_design->body();
|
$design_object->body = $invoice_design->body();
|
||||||
$design_object->table_styles = $invoice_design->table_styles();
|
|
||||||
$design_object->product_table = $invoice_design->product_table();
|
$design_object->product_table = $invoice_design->product_table();
|
||||||
$design_object->task_table = $invoice_design->task_table();
|
$design_object->task_table = $invoice_design->task_table();
|
||||||
$design_object->footer = $invoice_design->footer();
|
$design_object->footer = $invoice_design->footer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user