From 1bb1480f676dc0ce12294fd0983640d75ba6486b Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 8 Nov 2017 18:03:27 -0800 Subject: [PATCH 1/8] Added a comment around protected dates so we know wtf --- app/Models/Asset.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 75c8343267..fa92f8fc96 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -42,6 +42,7 @@ class Asset extends Depreciable */ protected $injectUniqueIdentifier = true; + // We set these as protected dates so that they will be easily accessible via Carbon protected $dates = [ 'created_at', 'updated_at', @@ -138,7 +139,7 @@ class Asset extends Depreciable * @param User $user * @param User $admin * @param Carbon $checkout_at - * @param null $expected_checkin + * @param Carbon $expected_checkin * @param string $note * @param null $name * @return bool From c162c02304120329db43ff7aed3fc78c665f93d1 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 8 Nov 2017 18:03:47 -0800 Subject: [PATCH 2/8] =?UTF-8?q?Force=20expected=20checkin=20to=20be=20form?= =?UTF-8?q?atted=20as=20a=20date=20(not=20datetime)=20since=20it=E2=80=99s?= =?UTF-8?q?=20a=20date=20field=20in=20the=20DB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Notifications/CheckoutNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Notifications/CheckoutNotification.php b/app/Notifications/CheckoutNotification.php index a0f44baf10..8a5512aa91 100644 --- a/app/Notifications/CheckoutNotification.php +++ b/app/Notifications/CheckoutNotification.php @@ -93,7 +93,7 @@ class CheckoutNotification extends Notification 'first_name' => $target->present()->fullName(), 'item_name' => $item->present()->name(), 'checkout_date' => $item->last_checkout, - 'expected_checkin' => $item->expected_checkin, + 'expected_checkin' => $item->expected_checkin->format('Y-m-d'), 'item_tag' => $item->asset_tag, 'note' => $this->params['note'], 'item_serial' => $item->serial, From 4f4920615cfde4e5637e7c70689677fba5e310ed Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 8 Nov 2017 18:06:14 -0800 Subject: [PATCH 3/8] Format expected checkin as Y-m-d in form --- resources/views/partials/forms/edit/purchase_date.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/partials/forms/edit/purchase_date.blade.php b/resources/views/partials/forms/edit/purchase_date.blade.php index 6e721bcbe5..783f654b65 100644 --- a/resources/views/partials/forms/edit/purchase_date.blade.php +++ b/resources/views/partials/forms/edit/purchase_date.blade.php @@ -3,7 +3,7 @@
- +
{!! $errors->first('purchase_date', ' :message') !!} From 65353fa42233efa2dc88daef101ee149afdd2522 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 8 Nov 2017 18:06:51 -0800 Subject: [PATCH 4/8] Nicer styling for purchase cost in edit form Made it more consistent with the warranty months foeld below it --- .../forms/edit/purchase_cost.blade.php | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/resources/views/partials/forms/edit/purchase_cost.blade.php b/resources/views/partials/forms/edit/purchase_cost.blade.php index c1fdca4e2a..3f94ac64f4 100644 --- a/resources/views/partials/forms/edit/purchase_cost.blade.php +++ b/resources/views/partials/forms/edit/purchase_cost.blade.php @@ -1,17 +1,20 @@
- -
-
- + +
+
+ + @if (isset($currency_type)) - {{ $currency_type }} + {{ $currency_type }} @else - {{ $snipeSettings->default_currency }} - @endif - - - {!! $errors->first('purchase_cost', ' :message') !!} -
-
+ {{ $snipeSettings->default_currency }} + @endif +
+
+
+ {!! $errors->first('purchase_cost', ' :message') !!} +
+
+
From 487fd17ce3ca50dfcfa57580ca40d6e877e57a27 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 8 Nov 2017 20:03:26 -0800 Subject: [PATCH 5/8] Fixed ambiguous query when selecting by model_id --- app/Models/Asset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index fa92f8fc96..1dafcfd450 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -711,7 +711,7 @@ class Asset extends Depreciable */ public function scopeInModelList($query, array $modelIdListing) { - return $query->whereIn('model_id', $modelIdListing); + return $query->whereIn('assets.model_id', $modelIdListing); } /** From 172c7c75a869998d82a0375cc83e9154ee4dbeb3 Mon Sep 17 00:00:00 2001 From: madd15 Date: Thu, 9 Nov 2017 14:35:39 +1030 Subject: [PATCH 6/8] 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 810d610d67..125c91bd7d 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 0000000000..4e4d018ae4 --- /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 9e3994037b..cbfb1f4449 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 68ee1ba61c..e3409c4c11 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 @@
+
From c26a2f8291b1764df673f2affe0ba167a8a5b048 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 8 Nov 2017 20:28:18 -0800 Subject: [PATCH 7/8] Patching #4402 into develop --- upgrade.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/upgrade.php b/upgrade.php index 0375c18f2f..c08c39cd79 100644 --- a/upgrade.php +++ b/upgrade.php @@ -1,11 +1,15 @@ Date: Thu, 9 Nov 2017 10:51:55 -0800 Subject: [PATCH 8/8] Removed gates from selectlist method --- app/Http/Controllers/Api/AssetModelsController.php | 1 - app/Http/Controllers/Api/CompaniesController.php | 1 - app/Http/Controllers/Api/DepartmentsController.php | 1 - app/Http/Controllers/Api/ManufacturersController.php | 1 - app/Http/Controllers/Api/SuppliersController.php | 1 - 5 files changed, 5 deletions(-) diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index 8b81947d2a..637d13d61d 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -182,7 +182,6 @@ class AssetModelsController extends Controller */ public function selectlist(Request $request) { - $this->authorize('view', AssetModel::class); $assetmodels = AssetModel::select([ 'models.id', diff --git a/app/Http/Controllers/Api/CompaniesController.php b/app/Http/Controllers/Api/CompaniesController.php index 3a21e80290..4d5a1b2a4f 100644 --- a/app/Http/Controllers/Api/CompaniesController.php +++ b/app/Http/Controllers/Api/CompaniesController.php @@ -153,7 +153,6 @@ class CompaniesController extends Controller */ public function selectlist(Request $request) { - $this->authorize('view', Company::class); $companies = Company::select([ 'companies.id', diff --git a/app/Http/Controllers/Api/DepartmentsController.php b/app/Http/Controllers/Api/DepartmentsController.php index a899708ee7..7acd3f5976 100644 --- a/app/Http/Controllers/Api/DepartmentsController.php +++ b/app/Http/Controllers/Api/DepartmentsController.php @@ -122,7 +122,6 @@ class DepartmentsController extends Controller */ public function selectlist(Request $request) { - $this->authorize('view', Department::class); $departments = Department::select([ 'id', diff --git a/app/Http/Controllers/Api/ManufacturersController.php b/app/Http/Controllers/Api/ManufacturersController.php index 21c99810a1..9b35148cc0 100644 --- a/app/Http/Controllers/Api/ManufacturersController.php +++ b/app/Http/Controllers/Api/ManufacturersController.php @@ -132,7 +132,6 @@ class ManufacturersController extends Controller */ public function selectlist(Request $request) { - $this->authorize('view', Manufacturers::class); $manufacturers = Manufacturer::select([ 'id', diff --git a/app/Http/Controllers/Api/SuppliersController.php b/app/Http/Controllers/Api/SuppliersController.php index 288b6b3c2d..96a1efe224 100644 --- a/app/Http/Controllers/Api/SuppliersController.php +++ b/app/Http/Controllers/Api/SuppliersController.php @@ -146,7 +146,6 @@ class SuppliersController extends Controller */ public function selectlist(Request $request) { - $this->authorize('view', Supplier::class); $suppliers = Supplier::select([ 'id',