From 9eef7a94abf74f8a798682d795f04e3f3e270579 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 00:40:30 -0800 Subject: [PATCH 1/8] Fixed #4557 - added missing fields in components/consumables list view --- .../Transformers/ComponentsTransformer.php | 6 +++++- .../Transformers/ConsumablesTransformer.php | 2 +- app/Presenters/ComponentPresenter.php | 12 ++++++++++++ app/Presenters/ConsumablePresenter.php | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/Http/Transformers/ComponentsTransformer.php b/app/Http/Transformers/ComponentsTransformer.php index bb24cafb0b..cf51b55d79 100644 --- a/app/Http/Transformers/ComponentsTransformer.php +++ b/app/Http/Transformers/ComponentsTransformer.php @@ -23,7 +23,7 @@ class ComponentsTransformer 'id' => (int) $component->id, 'name' => e($component->name), 'image' => ($component->image) ? e(url('/').'/uploads/components/'.e($component->image)) : null, - 'serial_number' => ($component->serial) ? e($component->serial) : null, + 'serial' => ($component->serial) ? e($component->serial) : null, 'location' => ($component->location) ? [ 'id' => (int) $component->location->id, 'name' => e($component->location->name) @@ -34,6 +34,10 @@ class ComponentsTransformer 'id' => (int) $component->category->id, 'name' => e($component->category->name) ] : null, + 'location' => ($component->location) ? [ + 'id' => (int) $component->location->id, + 'name' => e($component->location->name) + ] : null, 'order_number' => e($component->order_number), 'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'), 'purchase_cost' => Helper::formatCurrencyOutput($component->purchase_cost), diff --git a/app/Http/Transformers/ConsumablesTransformer.php b/app/Http/Transformers/ConsumablesTransformer.php index 426cfb9d41..3d68697a58 100644 --- a/app/Http/Transformers/ConsumablesTransformer.php +++ b/app/Http/Transformers/ConsumablesTransformer.php @@ -30,7 +30,7 @@ class ConsumablesTransformer 'location' => ($consumable->location) ? ['id' => (int) $consumable->location->id, 'name' => e($consumable->location->name)] : null, 'manufacturer' => ($consumable->manufacturer) ? ['id' => (int) $consumable->manufacturer->id, 'name' => e($consumable->manufacturer->name)] : null, 'min_amt' => (int) $consumable->min_amt, - 'model_number' => e($consumable->model_number), + 'model_number' => ($consumable->model_number!='') ? e($consumable->model_number) : null, 'remaining' => $consumable->numRemaining(), 'order_number' => e($consumable->order_number), 'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost), diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php index 6983b73d11..2ea797c4e6 100644 --- a/app/Presenters/ComponentPresenter.php +++ b/app/Presenters/ComponentPresenter.php @@ -50,6 +50,12 @@ class ComponentPresenter extends Presenter "title" => trans('general.image'), "visible" => false, "formatter" => 'imageFormatter', + ],[ + "field" => "serial", + "searchable" => true, + "sortable" => true, + "title" => trans('admin/hardware/form.serial'), + "formatter" => "componentsLinkFormatter" ], [ "field" => "category", "searchable" => true, @@ -74,6 +80,12 @@ class ComponentPresenter extends Presenter "sortable" => false, "title" => trans('general.min_amt'), "visible" => true, + ], [ + "field" => "location", + "searchable" => true, + "sortable" => true, + "title" => trans('general.location'), + "formatter" => "locationsLinkObjFormatter" ], [ "field" => "order_number", "searchable" => true, diff --git a/app/Presenters/ConsumablePresenter.php b/app/Presenters/ConsumablePresenter.php index 2089771cc0..334398fabd 100644 --- a/app/Presenters/ConsumablePresenter.php +++ b/app/Presenters/ConsumablePresenter.php @@ -56,6 +56,11 @@ class ConsumablePresenter extends Presenter "sortable" => true, "title" => trans('general.category'), "formatter" => "categoriesLinkObjFormatter" + ],[ + "field" => "model_number", + "searchable" => true, + "sortable" => true, + "title" => trans('general.model_no'), ],[ "field" => "item_no", "searchable" => true, @@ -79,6 +84,19 @@ class ConsumablePresenter extends Presenter "sortable" => false, "title" => trans('general.min_amt'), "visible" => true, + ], [ + "field" => "location", + "searchable" => true, + "sortable" => true, + "title" => trans('general.location'), + "formatter" => "locationsLinkObjFormatter" + ], [ + "field" => "manufacturer", + "searchable" => true, + "sortable" => true, + "title" => trans('general.manufacturer'), + "visible" => false, + "formatter" => "manufacturersLinkObjFormatter" ], [ "field" => "order_number", "searchable" => true, From 7efa7ec03f7191320a69fb37359e1c7e8784cfb3 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 01:55:24 -0800 Subject: [PATCH 2/8] Starter print template for all assets assigned to a user --- app/Http/Controllers/UsersController.php | 17 +++++ resources/views/users/print.blade.php | 86 ++++++++++++++++++++++++ resources/views/users/view.blade.php | 4 ++ routes/web/users.php | 7 ++ 4 files changed, 114 insertions(+) create mode 100644 resources/views/users/print.blade.php diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index d3ebe34316..4ce47490d7 100755 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -1147,4 +1147,21 @@ class UsersController extends Controller return response()->json(['message' => trans('admin/settings/general.two_factor_reset_error')], 500); } } + + /** + * LDAP form processing. + * + * @author Aladin Alaily + * @since [v1.8] + * @return \Illuminate\Http\RedirectResponse + */ + public function print($id) + { + $user = User::where('id',$id)->withTrashed()->first(); + $assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model')->get(); + $licenses = $user->licenses()->get(); + return view('users/print')->with('assets', $assets)->with('licenses',$licenses); + + } + } diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php new file mode 100644 index 0000000000..e8c4c2df02 --- /dev/null +++ b/resources/views/users/print.blade.php @@ -0,0 +1,86 @@ + + + + + Assigned to {{ $user->present()->fullName() }} + + + +

Assigned to {{ $user->present()->fullName() }}

+ +@if ($assets->count() > 0) + @php + $counter = 1; + @endphp +

Assets

+ + + + + + + + @foreach ($assets as $asset) + + + + + + + + + + @php + $counter++ + @endphp + @endforeach +
Asset TagNameCategoryModelChecked Out
{{ $counter }}{{ $asset->asset_tag }}{{ $asset->name }}{{ $asset->model->category->name }}{{ $asset->model->name }} + {{ $asset->last_checkout }}
+@endif + +@if ($licenses->count() > 0) +

Licenses

+ + + + + @php + $lcounter = 1; + @endphp + + @foreach ($licenses as $license) + + + + + + + @php + $lcounter++ + @endphp + @endforeach +
NameChecked Out
{{ $lcounter }}{{ $license->name }}{{ $license->created_at }}
+@endif + + + + diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index c78c576559..a9fe3e3a4e 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -216,6 +216,10 @@ + + @can('delete', $user) @if ($user->deleted_at=='')
diff --git a/routes/web/users.php b/routes/web/users.php index 56d35cf81c..8e467f14d7 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -17,6 +17,13 @@ Route::group([ 'prefix' => 'users', 'middleware' => ['auth']], function () { '{userId}/deletefile/{fileId}', [ 'as' => 'userfile.destroy', 'uses' => 'UsersController@getDeleteFile' ] ); + + Route::get( + '{userId}/print', + [ 'as' => 'users.print', 'uses' => 'UsersController@print' ] + ); + + Route::get( '{userId}/showfile/{fileId}', [ 'as' => 'show/userfile', 'uses' => 'UsersController@displayFile' ] From c9e6a75ea886bbcb41928729705d76ce4f76e204 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 11:28:48 -0800 Subject: [PATCH 3/8] Make sure there is a valid status label associated withthe asset when checking if deployable --- app/Models/Asset.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 15510e8588..230f4c7db8 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -128,7 +128,11 @@ class Asset extends Depreciable public function availableForCheckout() { - if ((empty($this->assigned_to)) && (empty($this->deleted_at)) && ($this->assetstatus->deployable == 1)) { + if ( + (empty($this->assigned_to)) && + (empty($this->deleted_at)) && + (($this->assetstatus) && ($this->assetstatus->deployable == 1))) + { return true; } return false; From a8cc29f062c3bee93886130b829ba22af3253b8c Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 12:34:16 -0800 Subject: [PATCH 4/8] Added #2562 - print view of all assigned inventory --- app/Http/Controllers/UsersController.php | 6 +- resources/views/users/print.blade.php | 106 +++++++++++++++++++---- resources/views/users/view.blade.php | 2 +- 3 files changed, 93 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 4ce47490d7..5feddf2798 100755 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -1157,10 +1157,12 @@ class UsersController extends Controller */ public function print($id) { + $user = User::where('id',$id)->withTrashed()->first(); - $assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model')->get(); + $assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model', 'model.category')->get(); $licenses = $user->licenses()->get(); - return view('users/print')->with('assets', $assets)->with('licenses',$licenses); + $accessories = $user->accessories()->get(); + return view('users/print')->with('assets', $assets)->with('licenses',$licenses)->with('accessories', $accessories); } diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index e8c4c2df02..89b359fb54 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -7,20 +7,20 @@ body { font-family: "Arial, Helvetica", sans-serif; } - table { + table.inventory { border: solid #000; - border-width: 1px 0 0 1px; + border-width: 1px 1px 1px 1px; width: 100%; } @page { size: A4; } - th, td { + table.inventory th, table.inventory td { border: solid #000; border-width: 0 1px 1px 0; padding: 3px; - font-size: 14px; + font-size: 12px; } @@ -31,14 +31,24 @@ @php $counter = 1; @endphp -

Assets

- - - - - - - +
Asset TagNameCategoryModelChecked Out
+ + + + + + + + + + + + + + + + + @foreach ($assets as $asset) @@ -47,6 +57,7 @@ + @@ -58,11 +69,21 @@ @endif @if ($licenses->count() > 0) -

Licenses

-
{{ trans('general.assets') }}
Asset TagNameCategoryModelSerialChecked Out
{{ $asset->name }} {{ $asset->model->category->name }} {{ $asset->model->name }}{{ $asset->serial }} {{ $asset->last_checkout }}
- - - +

+
NameChecked Out
+ + + + + + + + + + + + + @php $lcounter = 1; @endphp @@ -72,7 +93,8 @@ - + + @php $lcounter++ @@ -82,5 +104,53 @@ @endif +@if ($accessories->count() > 0) +

+
{{ trans('general.licenses') }}
NameSerial/Product KeyChecked Out
{{ $lcounter }} {{ $license->name }}{{ $license->created_at }}{{ $license->serial }}{{ $license->assetlog->first()->created_at }}
+ + + + + + + + + + + + + + @php + $acounter = 1; + @endphp + + @foreach ($accessories as $accessory) + + + + + + + + @php + $acounter++ + @endphp + @endforeach +
{{ trans('general.accessories') }}
NameCategoryChecked Out
{{ $acounter }}{{ $accessory->manufacturer->name }} {{ $accessory->name }} {{ $accessory->model_number }}{{ $accessory->category->name }}{{ $accessory->assetlog->first()->created_at }}
+@endif +
+
+
+ + + + + + + + +
Signed Off By:________________________________________________________Date:________________________________________________________
+ + diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index a9fe3e3a4e..88c3003210 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -217,7 +217,7 @@ {{ trans('admin/users/general.clone') }}
@can('delete', $user) From deba4d2b81cd67f1eb40a4c53460ad4e0fab7f37 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 12:37:42 -0800 Subject: [PATCH 5/8] Added consumables tio printable output --- app/Http/Controllers/UsersController.php | 3 +- resources/views/users/print.blade.php | 36 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 5feddf2798..2252a154d0 100755 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -1162,7 +1162,8 @@ class UsersController extends Controller $assets = Asset::where('assigned_to', $id)->where('assigned_type', User::class)->with('model', 'model.category')->get(); $licenses = $user->licenses()->get(); $accessories = $user->accessories()->get(); - return view('users/print')->with('assets', $assets)->with('licenses',$licenses)->with('accessories', $accessories); + $consumables = $user->consumables()->get(); + return view('users/print')->with('assets', $assets)->with('licenses',$licenses)->with('accessories', $accessories)->with('consumables', $consumables); } diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 89b359fb54..ce5415b36f 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -138,6 +138,42 @@ @endforeach @endif + +@if ($consumables->count() > 0) +

+ + + + + + + + + + + + + + + @php + $ccounter = 1; + @endphp + + @foreach ($consumables as $consumable) + + + + + + + + @php + $ccounter++ + @endphp + @endforeach +
{{ trans('general.consumables') }}
NameCategoryChecked Out
{{ $ccounter }}{{ $consumable->manufacturer->name }} {{ $consumable->name }} {{ $consumable->model_number }}{{ $consumable->category->name }}{{ $consumable->assetlog->first()->created_at }}
+@endif +


From e490185533a924ca17e1efcc02a9abb10608871c Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 12:54:19 -0800 Subject: [PATCH 6/8] Fixed EOL in custom report --- app/Http/Controllers/ReportsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index affdbda069..884915aaaf 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -637,7 +637,7 @@ class ReportsController extends Controller } if ($request->has('eol')) { - $row[] = ($asset->eol) ? $asset->present()->eol_date() : ''; + $row[] = ($asset->purchase_date!='') ? $asset->present()->eol_date() : ''; } if ($request->has('order')) { From 76fe2af0af69fcf4d5bcf3b6fe58cf10487d778b Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 13:03:11 -0800 Subject: [PATCH 7/8] Fixed #4444 - Added EOL back into asset lsiting and custom report --- app/Http/Transformers/AssetsTransformer.php | 1 + app/Presenters/AssetPresenter.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index b3435df54e..0f8109dc1c 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -31,6 +31,7 @@ class AssetsTransformer 'name'=> e($asset->model->name) ] : null, 'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null, + 'eol' => ($asset->purchase_date!='') ? Helper::getFormattedDateObject($asset->present()->eol_date(), 'date') : null , 'status_label' => ($asset->assetstatus) ? [ 'id' => (int) $asset->assetstatus->id, 'name'=> e($asset->present()->statusText), diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index f24d922531..d5b87b8e0d 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -147,6 +147,13 @@ class AssetPresenter extends Presenter "visible" => false, "title" => trans('general.order_number'), 'formatter' => "orderNumberObjFilterFormatter" + ], [ + "field" => "eol", + "searchable" => false, + "sortable" => false, + "visible" => false, + "title" => trans('general.eol'), + "formatter" => "dateDisplayFormatter" ], [ "field" => "warranty_months", "searchable" => true, From 027f6a7c124f044e19b75a3a27eaa052583d969f Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 13:18:52 -0800 Subject: [PATCH 8/8] Bumped hash --- config/version.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/version.php b/config/version.php index afef58b85f..397ef8baaf 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v4.1.7', - 'full_app_version' => 'v4.1.7 - build 3031-g4f3c932', - 'build_version' => '3031', + 'app_version' => 'v4.1.8-pre', + 'full_app_version' => 'v4.1.8-pre - build 3034-', + 'build_version' => '3034', 'prerelease_version' => '', - 'hash_version' => 'g4f3c932', - 'full_hash' => 'v4.1.6-37-g4f3c932', + 'hash_version' => '', + 'full_hash' => 'v4.1.7', 'branch' => 'develop', -); \ No newline at end of file +);