From 4803bc71ec25f98f41aa3b49dc61e644ab90b415 Mon Sep 17 00:00:00 2001 From: Petr Baloun Date: Wed, 4 May 2016 11:45:53 +0200 Subject: [PATCH 1/3] Docker image requires ubuntu trusty, not latest --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 935d45ebf7..22ad0ee47d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu +FROM ubuntu:trusty MAINTAINER Brady Wetherington RUN apt-get update && apt-get install -y \ From 8e182186523a7931699dbf04592c05e057154c56 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 11 May 2016 21:36:59 -0700 Subject: [PATCH 2/3] [Bugfix] Fixed admin user display bug --- app/views/backend/hardware/view.blade.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/backend/hardware/view.blade.php b/app/views/backend/hardware/view.blade.php index 0350c7bf5c..2ef5a059c3 100755 --- a/app/views/backend/hardware/view.blade.php +++ b/app/views/backend/hardware/view.blade.php @@ -166,7 +166,7 @@ @if ($asset->model->fieldset)
-
FIELDSET: +
FIELDSET: {{{ $asset->model->fieldset->name }}}
@foreach($asset->model->fieldset->fields as $field)
{{{ $field->name }}}: @@ -379,9 +379,10 @@ {{ $asset->created_at }} - @if (isset($asset->adminuser->id)) {{{ $asset->adminuser->fullName() }}} + @if ($asset->adminuser) + {{{ $asset->adminuser->fullName() }}} @else - @lang('general.unknown_admin') + @lang('general.unknown_admin') @endif @lang('general.created_asset') From 54f3c65624a64fc20d2064c340fabfd62f024897 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 16 May 2016 20:53:51 -0700 Subject: [PATCH 3/3] Fixes #1634 - better handling for category listings that are not asset categories --- .../admin/CategoriesController.php | 113 +++++++++++++++++- app/routes.php | 8 ++ app/views/backend/categories/view.blade.php | 7 +- public/uploads/.gitkeep | 0 4 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 public/uploads/.gitkeep diff --git a/app/controllers/admin/CategoriesController.php b/app/controllers/admin/CategoriesController.php index 788c80ddc2..d9010fbc33 100755 --- a/app/controllers/admin/CategoriesController.php +++ b/app/controllers/admin/CategoriesController.php @@ -267,7 +267,7 @@ class CategoriesController extends AdminController return $data; } - public function getDataView($categoryID) { + public function getDataViewAssets($categoryID) { $category = Category::with('assets.company')->find($categoryID); $category_assets = $category->assets; @@ -335,4 +335,115 @@ class CategoriesController extends AdminController } + + public function getDataViewAccessories($categoryID) { + + $category = Category::with('accessories.company')->find($categoryID); + $category_assets = $category->accessories; + + if (Input::has('search')) { + $category_assets = $category_assets->TextSearch(e(Input::get('search'))); + } + + if (Input::has('offset')) { + $offset = e(Input::get('offset')); + } else { + $offset = 0; + } + + if (Input::has('limit')) { + $limit = e(Input::get('limit')); + } else { + $limit = 50; + } + + $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; + + $allowed_columns = ['id','name','serial','asset_tag']; + $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $count = $category_assets->count(); + + $rows = array(); + + foreach ($category_assets as $asset) { + + $actions = ''; + $inout=''; + + if ($asset->deleted_at=='') { + $actions = '
'; + } elseif ($asset->deleted_at!='') { + $actions = ''; + } + + + + $rows[] = array( + 'id' => $asset->id, + 'name' => link_to_route('view/accessory', $asset->name, [$asset->id]), + 'actions' => $actions, + 'companyName' => Company::getName($asset), + ); + } + + $data = array('total' => $count, 'rows' => $rows); + return $data; + } + + + public function getDataViewConsumables($categoryID) { + + $category = Category::with('accessories.company')->find($categoryID); + $category_assets = $category->consumables; + + if (Input::has('search')) { + $category_assets = $category_assets->TextSearch(e(Input::get('search'))); + } + + if (Input::has('offset')) { + $offset = e(Input::get('offset')); + } else { + $offset = 0; + } + + if (Input::has('limit')) { + $limit = e(Input::get('limit')); + } else { + $limit = 50; + } + + $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; + + $allowed_columns = ['id','name','serial','asset_tag']; + $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; + $count = $category_assets->count(); + + $rows = array(); + + foreach ($category_assets as $asset) { + + $actions = ''; + $inout=''; + + if ($asset->deleted_at=='') { + $actions = '
'; + } elseif ($asset->deleted_at!='') { + $actions = ''; + } + + + + $rows[] = array( + 'id' => $asset->id, + 'name' => link_to_route('view/consumable', $asset->name, [$asset->id]), + 'actions' => $actions, + 'companyName' => Company::getName($asset), + ); + } + + $data = array('total' => $count, 'rows' => $rows); + return $data; + } + + } diff --git a/app/routes.php b/app/routes.php index 4f39ccec58..6ce5085310 100755 --- a/app/routes.php +++ b/app/routes.php @@ -124,6 +124,14 @@ Route::get( 'list', [ 'as' => 'api.categories.list', 'uses' => 'CategoriesController@getDatatable' ] ); Route::get( '{categoryID}/view', [ 'as' => 'api.categories.view', 'uses' => 'CategoriesController@getDataView' ] ); + Route::get( '{categoryID}/asset/view', + [ 'as' => 'api.categories.asset.view', 'uses' => 'CategoriesController@getDataViewAssets' ] ); + Route::get( '{categoryID}/accessory/view', + [ 'as' => 'api.categories.accessory.view', 'uses' => 'CategoriesController@getDataViewAccessories' ] ); + Route::get( '{categoryID}/consumable/view', + [ 'as' => 'api.categories.consumable.view', 'uses' => 'CategoriesController@getDataViewConsumables' ] ); + Route::get( '{categoryID}/component/view', + [ 'as' => 'api.categories.component.view', 'uses' => 'CategoriesController@getDataViewComponent' ] ); } ); /*-- Suppliers API (mostly for creating new ones in-line while creating an asset) --*/ diff --git a/app/views/backend/categories/view.blade.php b/app/views/backend/categories/view.blade.php index f196ea0c1a..291efe5fda 100644 --- a/app/views/backend/categories/view.blade.php +++ b/app/views/backend/categories/view.blade.php @@ -36,7 +36,7 @@ @@ -47,11 +47,14 @@ + @if ($category->category_type=='asset') + @endif + @@ -71,7 +74,7 @@ iconsPrefix: 'fa', showRefresh: true, //search: true, - pageSize: {{{ Setting::getSettings()->per_page }}}, + pageSize: {{ Setting::getSettings()->per_page }}, pagination: true, sidePagination: 'server', sortable: true, diff --git a/public/uploads/.gitkeep b/public/uploads/.gitkeep new file mode 100644 index 0000000000..e69de29bb2
@lang('general.id') @lang('general.name')@lang('admin/hardware/form.model') @lang('general.asset_tag') @lang('admin/hardware/form.serial') @lang('general.user') @lang('admin/hardware/table.change')@lang('table.actions')