mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
adds redirect to render and save if template is null
This commit is contained in:
parent
f4e69679ca
commit
0118504cd3
|
@ -798,7 +798,12 @@ class SettingsController extends Controller
|
|||
$setting->labels_display_model = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($setting->save()) {
|
||||
if ($setting->label2_template === null) {
|
||||
return redirect()->route('settings.labels.index')->with('error', trans('admin/settings/message.labels.null_template'));
|
||||
}
|
||||
|
||||
return redirect()->route('settings.labels.index')
|
||||
->with('success', trans('admin/settings/message.update.success'));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Models\Labels\Label as LabelModel;
|
|||
use App\Models\Labels\Sheet;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use TCPDF;
|
||||
|
@ -39,6 +40,7 @@ class Label implements View
|
|||
$assets = $this->data->get('assets');
|
||||
$offset = $this->data->get('offset');
|
||||
|
||||
|
||||
// If disabled, pass to legacy view
|
||||
if ((!$settings->label2_enable)) {
|
||||
return view('hardware/labels')
|
||||
|
@ -52,7 +54,7 @@ class Label implements View
|
|||
$template = LabelModel::find($settings->label2_template);
|
||||
|
||||
if ($template === null) {
|
||||
throw new \UnexpectedValueException('Template is null.');
|
||||
return redirect()->route('settings.labels.index')->with('error', trans('admin/settings/message.labels.null_template'));
|
||||
}
|
||||
|
||||
$template->validate();
|
||||
|
@ -66,6 +68,7 @@ class Label implements View
|
|||
|
||||
}
|
||||
|
||||
$template->validate();
|
||||
|
||||
$pdf = new TCPDF(
|
||||
$template->getOrientation(),
|
||||
|
|
|
@ -36,6 +36,9 @@ return [
|
|||
'testing_authentication' => 'Testing LDAP Authentication...',
|
||||
'authentication_success' => 'User authenticated against LDAP successfully!'
|
||||
],
|
||||
'labels' => [
|
||||
'null_template' => 'Label template not found, Please select a template.',
|
||||
],
|
||||
'webhook' => [
|
||||
'sending' => 'Sending :app test message...',
|
||||
'success' => 'Your :webhook_name Integration works!',
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-sm-10 col-sm-offset-1 col-md-10">
|
||||
|
||||
<div class="panel box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h2 class="box-title">
|
||||
|
@ -35,8 +34,6 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<!-- New Label Engine -->
|
||||
|
|
Loading…
Reference in a new issue