mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Allow passing "template" param
This commit is contained in:
parent
a60ee7736b
commit
a8b6a4a259
|
@ -547,6 +547,7 @@ class AssetsController extends Controller
|
||||||
return (new Label())
|
return (new Label())
|
||||||
->with('assets', collect([ $asset ]))
|
->with('assets', collect([ $asset ]))
|
||||||
->with('settings', Setting::getSettings())
|
->with('settings', Setting::getSettings())
|
||||||
|
->with('template', request()->get('template'))
|
||||||
->with('offset', request()->get('offset'))
|
->with('offset', request()->get('offset'))
|
||||||
->with('bulkedit', false)
|
->with('bulkedit', false)
|
||||||
->with('count', 0);
|
->with('count', 0);
|
||||||
|
|
|
@ -27,7 +27,6 @@ class Label implements View
|
||||||
$this->data = new Collection();
|
$this->data = new Collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the PDF label.
|
* Render the PDF label.
|
||||||
*
|
*
|
||||||
|
@ -38,9 +37,10 @@ class Label implements View
|
||||||
$settings = $this->data->get('settings');
|
$settings = $this->data->get('settings');
|
||||||
$assets = $this->data->get('assets');
|
$assets = $this->data->get('assets');
|
||||||
$offset = $this->data->get('offset');
|
$offset = $this->data->get('offset');
|
||||||
|
$template = $this->data->get('template');
|
||||||
|
|
||||||
// If disabled, pass to legacy view
|
// If disabled, pass to legacy view
|
||||||
if (!$settings->label2_enable) {
|
if ((!$settings->label2_enable) && (!$template)) {
|
||||||
return view('hardware/labels')
|
return view('hardware/labels')
|
||||||
->with('assets', $assets)
|
->with('assets', $assets)
|
||||||
->with('settings', $settings)
|
->with('settings', $settings)
|
||||||
|
@ -48,8 +48,9 @@ class Label implements View
|
||||||
->with('count', $this->data->get('count'));
|
->with('count', $this->data->get('count'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($template)) $template = LabelModel::find($settings->label2_template);
|
||||||
|
elseif (is_string($template)) $template = LabelModel::find($template);
|
||||||
|
|
||||||
$template = LabelModel::find($settings->label2_template);
|
|
||||||
$template->validate();
|
$template->validate();
|
||||||
|
|
||||||
$pdf = new TCPDF(
|
$pdf = new TCPDF(
|
||||||
|
|
Loading…
Reference in a new issue