From 172c7c75a869998d82a0375cc83e9154ee4dbeb3 Mon Sep 17 00:00:00 2001 From: madd15 Date: Thu, 9 Nov 2017 14:35:39 +1030 Subject: [PATCH] Fixed #4374 - Add option to display company names to labels (#4405) * Migration - Labels Display Company Name setting * Add Company Name to Labels Add company name if it is turned on in settings and asset has a valid company * Add Company Name checkbox to Label settings * Add Company Name Lang * Add display company name to postLabels * Revert Add Company Name Lang * Fix display company name in postLabels * Change tinyInt to boolean for display company name * Simplify checking for company and getting the name * Change to square brackets for array notation * Move divs inside if statements on optional fields --- app/Http/Controllers/SettingsController.php | 1 + ..._08_123942_labels_display_company_name.php | 34 +++++++++++++++++++ resources/views/hardware/labels.blade.php | 26 ++++++++------ resources/views/settings/labels.blade.php | 34 +++++++++++-------- 4 files changed, 69 insertions(+), 26 deletions(-) create mode 100644 database/migrations/2017_11_08_123942_labels_display_company_name.php diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 810d610d6..125c91bd7 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -748,6 +748,7 @@ class SettingsController extends Controller $setting->labels_fontsize = $request->input('labels_fontsize'); $setting->labels_pagewidth = $request->input('labels_pagewidth'); $setting->labels_pageheight = $request->input('labels_pageheight'); + $setting->labels_display_company_name = $request->input('labels_display_company_name', '0'); diff --git a/database/migrations/2017_11_08_123942_labels_display_company_name.php b/database/migrations/2017_11_08_123942_labels_display_company_name.php new file mode 100644 index 000000000..4e4d018ae --- /dev/null +++ b/database/migrations/2017_11_08_123942_labels_display_company_name.php @@ -0,0 +1,34 @@ +boolean('labels_display_company_name')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('settings', function ($table) { + $table->dropColumn( + 'labels_display_company_name' + ); + }); + } +} diff --git a/resources/views/hardware/labels.blade.php b/resources/views/hardware/labels.blade.php index 9e3994037..cbfb1f444 100644 --- a/resources/views/hardware/labels.blade.php +++ b/resources/views/hardware/labels.blade.php @@ -112,28 +112,32 @@ @endif
-
@if ($settings->qr_text!='') +
{{ $settings->qr_text }}
- @endif
+ @endif + @if (($settings->labels_display_company_name=='1') && ($asset->company))
+ C: {{ $asset->company->name }} +
+ @endif @if (($settings->labels_display_name=='1') && ($asset->name!='')) +
N: {{ $asset->name }} - @endif
-
+ @endif @if (($settings->labels_display_tag=='1') && ($asset->asset_tag!='')) - T: {{ $asset->asset_tag }} - @endif -
- @if (($settings->labels_display_serial=='1') && ($asset->serial!='')) - S: {{ $asset->serial }} + T: {{ $asset->asset_tag }} +
+ @endif + @if (($settings->labels_display_serial=='1') && ($asset->serial!='')) +
+ S: {{ $asset->serial }} +
@endif -
-
@if ((($settings->alt_barcode_enabled=='1') && $settings->alt_barcode!='')) diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php index 68ee1ba61..e3409c4c1 100644 --- a/resources/views/settings/labels.blade.php +++ b/resources/views/settings/labels.blade.php @@ -45,7 +45,7 @@ {{ Form::label('labels_per_page', trans('admin/settings/general.labels_per_page')) }}
- {{ Form::text('labels_per_page', Input::old('labels_per_page', $setting->labels_per_page), array('class' => 'form-control','style' => 'width: 100px;')) }} + {{ Form::text('labels_per_page', Input::old('labels_per_page', $setting->labels_per_page), ['class' => 'form-control','style' => 'width: 100px;']) }} {!! $errors->first('labels_per_page', ':message') !!}
@@ -56,7 +56,7 @@
- {{ Form::text('labels_fontsize', Input::old('labels_fontsize', $setting->labels_fontsize), array('class' => 'form-control')) }} + {{ Form::text('labels_fontsize', Input::old('labels_fontsize', $setting->labels_fontsize), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.text_pt') }}
@@ -71,13 +71,13 @@
- {{ Form::text('labels_width', Input::old('labels_width', $setting->labels_width), array('class' => 'form-control')) }} + {{ Form::text('labels_width', Input::old('labels_width', $setting->labels_width), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.width_w') }}
- {{ Form::text('labels_height', Input::old('labels_height', $setting->labels_height), array('class' => 'form-control')) }} + {{ Form::text('labels_height', Input::old('labels_height', $setting->labels_height), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.height_h') }}
@@ -93,13 +93,13 @@
- {{ Form::text('labels_display_sgutter', Input::old('labels_display_sgutter', $setting->labels_display_sgutter), array('class' => 'form-control')) }} + {{ Form::text('labels_display_sgutter', Input::old('labels_display_sgutter', $setting->labels_display_sgutter), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.horizontal') }}
- {{ Form::text('labels_display_bgutter', Input::old('labels_display_bgutter', $setting->labels_display_bgutter), array('class' => 'form-control')) }} + {{ Form::text('labels_display_bgutter', Input::old('labels_display_bgutter', $setting->labels_display_bgutter), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.vertical') }}
@@ -115,21 +115,21 @@
- {{ Form::text('labels_pmargin_top', Input::old('labels_pmargin_top', $setting->labels_pmargin_top), array('class' => 'form-control')) }} + {{ Form::text('labels_pmargin_top', Input::old('labels_pmargin_top', $setting->labels_pmargin_top), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.top') }}
- {{ Form::text('labels_pmargin_right', Input::old('labels_pmargin_right', $setting->labels_pmargin_right), array('class' => 'form-control')) }} + {{ Form::text('labels_pmargin_right', Input::old('labels_pmargin_right', $setting->labels_pmargin_right), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.right') }}
- {{ Form::text('labels_pmargin_bottom', Input::old('labels_pmargin_bottom', $setting->labels_pmargin_bottom), array('class' => 'form-control')) }} + {{ Form::text('labels_pmargin_bottom', Input::old('labels_pmargin_bottom', $setting->labels_pmargin_bottom), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.bottom') }}
- {{ Form::text('labels_pmargin_left', Input::old('labels_pmargin_left', $setting->labels_pmargin_left), array('class' => 'form-control')) }} + {{ Form::text('labels_pmargin_left', Input::old('labels_pmargin_left', $setting->labels_pmargin_left), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.left') }}
@@ -145,13 +145,13 @@
- {{ Form::text('labels_pagewidth', Input::old('labels_pagewidth', $setting->labels_pagewidth), array('class' => 'form-control')) }} + {{ Form::text('labels_pagewidth', Input::old('labels_pagewidth', $setting->labels_pagewidth), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.width_w') }}
- {{ Form::text('labels_pageheight', Input::old('labels_pageheight', $setting->labels_pageheight), array('class' => 'form-control')) }} + {{ Form::text('labels_pageheight', Input::old('labels_pageheight', $setting->labels_pageheight), ['class' => 'form-control']) }}
{{ trans('admin/settings/general.height_h') }}
@@ -168,17 +168,21 @@
+