mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
fixes for design preview
This commit is contained in:
parent
c7701b71d6
commit
0bff698bc4
@ -214,9 +214,9 @@ class PreviewController extends BaseController
|
||||
->first();
|
||||
}
|
||||
|
||||
if($request->has('client_id')) {
|
||||
if($request->has('client_id') && strlen($request->client_id) > 4) {
|
||||
$client = Client::withTrashed()->find($this->decodePrimaryKey($request->client_id));
|
||||
if($request->settings_type == 'client'){
|
||||
if($request->settings_type == 'client' && $client ){
|
||||
$client->settings = $request->settings;
|
||||
$client->save();
|
||||
}
|
||||
@ -243,7 +243,7 @@ class PreviewController extends BaseController
|
||||
if($request->has('terms') && !$request->filled('terms') && $request->input('entity') == 'recurring_invoice')
|
||||
$request->merge(['terms' => $company->settings->invoice_terms]);
|
||||
|
||||
$entity_obj = $repo->save($request->all(), $entity_obj);
|
||||
// $entity_obj = $repo->save($request->all(), $entity_obj);
|
||||
|
||||
if (! $request->has('entity_id')) {
|
||||
$entity_obj->service()->fillDefaults()->save();
|
||||
@ -311,28 +311,36 @@ class PreviewController extends BaseController
|
||||
return;
|
||||
}
|
||||
|
||||
//if phantom js...... inject here..
|
||||
//if phantom js...... inject here..et
|
||||
if (config('ninja.phantomjs_pdf_generation') || config('ninja.pdf_generator') == 'phantom') {
|
||||
return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
||||
$pdf = (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true));
|
||||
|
||||
$headers = ['Content-Type' => 'application/pdf'];
|
||||
|
||||
if(request()->input('inline') == 'true')
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
|
||||
return response()->streamDownload(function () use($pdf) {
|
||||
echo $pdf;
|
||||
}, "preview.pdf", $headers);
|
||||
|
||||
}
|
||||
|
||||
if(config('ninja.invoiceninja_hosted_pdf_generation') || config('ninja.pdf_generator') == 'hosted_ninja'){
|
||||
$pdf = (new NinjaPdf())->build($maker->getCompiledHTML(true));
|
||||
|
||||
$numbered_pdf = $this->pageNumbering($pdf, auth()->user()->company());
|
||||
$headers = ['Content-Type' => 'application/pdf'];
|
||||
|
||||
if(request()->input('inline') == 'true')
|
||||
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
|
||||
|
||||
$numbered_pdf = $this->pageNumbering($pdf, auth()->user()->company());
|
||||
return response()->streamDownload(function () use($pdf) {
|
||||
echo $pdf;
|
||||
}, "preview.pdf", $headers);
|
||||
|
||||
if ($numbered_pdf) {
|
||||
$pdf = $numbered_pdf;
|
||||
}
|
||||
|
||||
return $pdf;
|
||||
}
|
||||
|
||||
$file_path = (new PreviewPdf($maker->getCompiledHTML(true), $company))->handle();
|
||||
|
||||
$response = Response::make($file_path, 200);
|
||||
$response->header('Content-Type', 'application/pdf');
|
||||
|
||||
|
@ -22,15 +22,7 @@ class UnlinkFile implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $file_path;
|
||||
|
||||
protected $disk;
|
||||
|
||||
public function __construct(string $disk, string $file_path)
|
||||
{
|
||||
$this->file_path = $file_path;
|
||||
$this->disk = $disk;
|
||||
}
|
||||
public function __construct(protected string $disk = '', protected ?string $file_path = ''){}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
@ -40,9 +32,12 @@ class UnlinkFile implements ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
/* Do not delete files if we are on the sync queue*/
|
||||
if (config('queue.default') == 'sync') {
|
||||
if (config('queue.default') == 'sync')
|
||||
return;
|
||||
|
||||
|
||||
if(!$this->file_path)
|
||||
return;
|
||||
}
|
||||
|
||||
Storage::disk($this->disk)->delete($this->file_path);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class BaseRepository
|
||||
protected function alternativeSave($data, $model)
|
||||
{ //$start = microtime(true);
|
||||
//forces the client_id if it doesn't exist
|
||||
if(array_key_exists('client_id', $data))
|
||||
if(array_key_exists('client_id', $data) && !empty($data['client_id']))
|
||||
$model->client_id = $data['client_id'];
|
||||
|
||||
$client = Client::with('group_settings')->where('id', $model->client_id)->withTrashed()->firstOrFail();
|
||||
@ -176,7 +176,7 @@ class BaseRepository
|
||||
|
||||
if (isset($tmp_data['client_contacts']))
|
||||
unset($tmp_data['client_contacts']);
|
||||
|
||||
nlog($tmp_data);
|
||||
$model->fill($tmp_data);
|
||||
|
||||
$model->custom_surcharge_tax1 = $client->company->custom_surcharge_taxes1;
|
||||
|
@ -52,8 +52,8 @@
|
||||
}
|
||||
|
||||
.company-logo {
|
||||
max-width: 65%;
|
||||
/* max-width: $company_logo_size;*/
|
||||
/* max-width: 65%;*/
|
||||
max-width: $company_logo_size;
|
||||
}
|
||||
|
||||
#company-details {
|
||||
|
Loading…
x
Reference in New Issue
Block a user