diff --git a/app/config/version.php b/app/config/version.php index 9de6c82f7a86..a13c0e496e36 100644 --- a/app/config/version.php +++ b/app/config/version.php @@ -1,5 +1,5 @@ 'v1.2.7-3', - 'hash_version' => 'v1.2.7-3-g5e7a4e8', + 'app_version' => 'v1.2.7-4', + 'hash_version' => 'v1.2.7-4-gf463cd6', ); \ No newline at end of file diff --git a/app/controllers/admin/AssetsController.php b/app/controllers/admin/AssetsController.php index 96ad92cd5e09..cb905efce47b 100755 --- a/app/controllers/admin/AssetsController.php +++ b/app/controllers/admin/AssetsController.php @@ -156,7 +156,7 @@ public function postCreate() } else { $asset->rtd_location_id = e(Input::get('rtd_location_id')); } - + $checkModel = Config::get('app.url').'/api/models/'.e(Input::get('model_id')).'/check'; $asset->mac_address = ($checkModel == true) ? e(Input::get('mac_address')) : NULL; @@ -293,7 +293,7 @@ public function postEdit($assetId = null) } else { $asset->rtd_location_id = e(Input::get('rtd_location_id')); } - + $checkModel = Config::get('app.url').'/api/models/'.e(Input::get('model_id')).'/check'; $asset->mac_address = ($checkModel == true) ? e(Input::get('mac_address')) : NULL; @@ -441,20 +441,20 @@ public function postCheckout($assetId) $data['first_name'] = $user->first_name; $data['item_name'] = $asset->showAssetName(); $data['require_acceptance'] = $asset->requireAcceptance(); - + $settings = Setting::getSettings(); - + if ($settings->slack_endpoint) { - + $slack_settings = [ 'username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true ]; - + $client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings); - + try { $client->attach([ 'color' => 'good', @@ -468,13 +468,13 @@ public function postCheckout($assetId) 'value' => e($logaction->note) ], - - + + ] ])->send('Asset Checked Out'); - + } catch (Exception $e) { - + } } @@ -563,18 +563,18 @@ public function postCheckin($assetId = null, $backto = null) $log = $logaction->logaction('checkin from'); $settings = Setting::getSettings(); - + if ($settings->slack_endpoint) { - + $slack_settings = [ 'username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true ]; - + $client = new \Maknz\Slack\Client($settings->slack_endpoint,$slack_settings); - + try { $client->attach([ 'color' => 'good', @@ -587,16 +587,16 @@ public function postCheckin($assetId = null, $backto = null) 'title' => 'Note:', 'value' => e($logaction->note) ], - + ] ])->send('Asset Checked In'); - + } catch (Exception $e) { - + } } - + if ($backto=='user') { return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/hardware/message.checkin.success')); } else { @@ -872,51 +872,51 @@ public function displayFile($assetID = null, $fileId = null) **/ public function postBulkEdit($assets = null) { - + if (!Input::has('edit_asset')) { return Redirect::back()->with('error', 'No assets selected'); } else { - $asset_raw_array = Input::get('edit_asset'); + $asset_raw_array = Input::get('edit_asset'); foreach ($asset_raw_array as $asset_id => $value) { - $asset_ids[] = $asset_id; - + $asset_ids[] = $asset_id; + } - + } - + if (Input::has('bulk_actions')) { - - + + // Create labels if (Input::get('bulk_actions')=='labels') { $assets = Asset::find($asset_ids); $assetcount = count($assets); $count = 0; - - $settings = Setting::getSettings(); + + $settings = Setting::getSettings(); return View::make('backend/hardware/labels')->with('assets',$assets)->with('settings',$settings)->with('count',$count); - - // Bulk edit + + // Bulk edit } elseif (Input::get('bulk_actions')=='edit') { - + $assets = Input::get('edit_asset'); - + $supplier_list = array('' => '') + Supplier::orderBy('name', 'asc')->lists('name', 'id'); - $statuslabel_list = array('' => '') + Statuslabel::lists('name', 'id'); - $location_list = array('' => '') + Location::lists('name', 'id'); - - return View::make('backend/hardware/bulk')->with('assets',$assets)->with('supplier_list',$supplier_list)->with('statuslabel_list',$statuslabel_list)->with('location_list',$location_list); + $statuslabel_list = array('' => '') + Statuslabel::lists('name', 'id'); + $location_list = array('' => '') + Location::lists('name', 'id'); + + return View::make('backend/hardware/bulk')->with('assets',$assets)->with('supplier_list',$supplier_list)->with('statuslabel_list',$statuslabel_list)->with('location_list',$location_list); + - } - + } else { - return Redirect::back()->with('error', 'No action selected'); + return Redirect::back()->with('error', 'No action selected'); } - + } @@ -933,7 +933,7 @@ public function postBulkSave($assets = null) $assets = Input::get('bulk_edit'); - if ( (Input::has('purchase_date')) || (Input::has('rtd_location_id')) || (Input::has('status_id')) ) { + if ( (Input::has('purchase_date')) || (Input::has('purchase_cost')) || (Input::has('supplier_id')) || (Input::has('order_number')) || (Input::has('warranty_months')) || (Input::has('rtd_location_id')) || (Input::has('status_id')) ) { foreach ($assets as $key => $value) { @@ -942,19 +942,19 @@ public function postBulkSave($assets = null) if (Input::has('purchase_date')) { $update_array['purchase_date'] = e(Input::get('purchase_date')); } - + if (Input::has('purchase_cost')) { $update_array['purchase_cost'] = e(Input::get('purchase_cost')); } - + if (Input::has('supplier_id')) { $update_array['supplier_id'] = e(Input::get('supplier_id')); } - + if (Input::has('order_number')) { $update_array['order_number'] = e(Input::get('order_number')); } - + if (Input::has('warranty_months')) { $update_array['warranty_months'] = e(Input::get('warranty_months')); } @@ -1007,7 +1007,7 @@ public function getDatatable($status = null) { $assets = Asset::with('model','assigneduser','assigneduser.userloc','assetstatus','defaultLoc','assetlog','model','model.category')->Hardware()->select(array('id', 'name','model_id','assigned_to','asset_tag','serial','status_id','purchase_date','deleted_at')); - + switch ($status) { case 'Pending': @@ -1031,66 +1031,66 @@ public function getDatatable($status = null) case 'Deleted': $assets->withTrashed()->Deleted(); break; - } - - + } + + $assets = $assets->orderBy('asset_tag', 'ASC')->get(); - - - $actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($assets) - { + + + $actions = new \Chumper\Datatable\Columns\FunctionColumn('actions', function ($assets) + { if ($assets->deleted_at=='') { return ' '; } elseif ($assets->model->deleted_at=='') { return ''; } - + }); - - $inout = new \Chumper\Datatable\Columns\FunctionColumn('inout', function ($assets) - { + + $inout = new \Chumper\Datatable\Columns\FunctionColumn('inout', function ($assets) + { if (($assets->assigned_to !='') && ($assets->assigned_to > 0)) { return ''.Lang::get('general.checkin').''; } else { return ''.Lang::get('general.checkout').''; } }); - - - + + + return Datatable::collection($assets) ->addColumn('',function($assets) - { - return ''; + { + return ''; }) ->addColumn('name',function($assets) { return ''.$assets->name.''; - }) + }) ->addColumn('asset_tag',function($assets) { return ''.$assets->asset_tag.''; - }) - + }) + ->showColumns('serial') - + ->addColumn('model',function($assets) { return $assets->model->name; }) - + ->addColumn('status',function($assets) - { + { if ($assets->assigned_to!='') { return link_to('../admin/users/'.$assets->assigned_to.'/view', $assets->assigneduser->fullName()); } else { - return $assets->assetstatus->name; + return $assets->assetstatus->name; } - + }) ->addColumn('location',function($assets) { - if ($assets->assigned_to && $assets->assigneduser->userloc) { + if ($assets->assigned_to && $assets->assigneduser->userloc) { return link_to('admin/location/'.$assets->assigneduser->userloc->id.'/edit', $assets->assigneduser->userloc->name); } elseif ($assets->defaultLoc){ return link_to('admin/location/'.$assets->defaultLoc->id.'/edit', $assets->defaultLoc->name); @@ -1100,26 +1100,26 @@ public function getDatatable($status = null) { return $assets->model->category->name; - }) - + }) + ->addColumn('eol',function($assets) { return $assets->eol_date(); - }) - - + }) + + ->addColumn('checkout_date',function($assets) - { + { if (($assets->assigned_to!='') && ($assets->assetlog->first())) { return $assets->assetlog->first()->created_at->format('Y-m-d'); - } - - }) - ->addColumn($inout) - ->addColumn($actions) + } + + }) + ->addColumn($inout) + ->addColumn($actions) ->searchColumns('name', 'asset_tag', 'serial', 'model', 'status','location','eol','checkout_date', 'inout','category') ->orderColumns('name', 'asset_tag', 'serial', 'model', 'status','location','eol','checkout_date', 'inout') ->make(); - + } } diff --git a/app/views/backend/hardware/bulk.blade.php b/app/views/backend/hardware/bulk.blade.php index f3abb5bc1aa6..e7125c218c2d 100755 --- a/app/views/backend/hardware/bulk.blade.php +++ b/app/views/backend/hardware/bulk.blade.php @@ -3,7 +3,7 @@ {{-- Page title --}} @section('title') @lang('admin/hardware/form.update') :: - + @parent @stop @@ -29,12 +29,12 @@
- + - +
@@ -47,7 +47,9 @@
- +
{{ Form::select('status_id', $statuslabel_list , Input::old('status_id'), array('class'=>'select2', 'style'=>'width:350px')) }} {{ $errors->first('status_id', '
:message') }} @@ -62,18 +64,18 @@ {{ $errors->first('status_id', '
:message') }}
- +
@lang('general.currency') - + {{ $errors->first('purchase_cost', '
:message') }}
- +
@@ -91,7 +93,7 @@ {{ $errors->first('order_number', '
:message') }}
- +
@@ -103,11 +105,11 @@
- + @foreach ($assets as $key => $value) - + @endforeach - +