diff --git a/app/config/version.php b/app/config/version.php index f9bfc38354..680fefbc2b 100644 --- a/app/config/version.php +++ b/app/config/version.php @@ -1,5 +1,5 @@ 'v2.0.6-97', - 'hash_version' => 'v2.0.6-97-g72f3b45', + 'app_version' => 'v2.0.6-99', + 'hash_version' => 'v2.0.6-99-g25338c0', ); \ No newline at end of file diff --git a/app/controllers/admin/AssetsController.php b/app/controllers/admin/AssetsController.php index db26b0986c..153f113300 100755 --- a/app/controllers/admin/AssetsController.php +++ b/app/controllers/admin/AssetsController.php @@ -33,6 +33,7 @@ use Artisan; use Symfony\Component\Console\Output\BufferedOutput; use CustomField; use Symfony\Component\HttpFoundation\JsonResponse; +use Models; class AssetsController extends AdminController @@ -1086,43 +1087,56 @@ class AssetsController extends AdminController public function postBulkEdit($assets = null) { - if (!Company::isCurrentUserAuthorized()) { - return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions')); - } - else if (!Input::has('edit_asset')) { - return Redirect::back()->with('error', 'No assets selected'); - } else { - $asset_raw_array = Input::get('edit_asset'); - foreach ($asset_raw_array as $asset_id => $value) { - $asset_ids[] = $asset_id; + if (!Company::isCurrentUserAuthorized()) { + return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions')); - } + } elseif (!Input::has('edit_asset')) { + return Redirect::back()->with('error', 'No assets selected'); - } + } else { + $asset_raw_array = Input::get('edit_asset'); + foreach ($asset_raw_array as $asset_id => $value) { + $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(); + if ($settings->qr_code=='1') { - $settings = Setting::getSettings(); - return View::make('backend/hardware/labels')->with('assets',$assets)->with('settings',$settings)->with('count',$count); + $assets = Asset::find($asset_ids); + $assetcount = count($assets); + $count = 0; + return View::make('backend/hardware/labels')->with('assets',$assets)->with('settings',$settings)->with('count',$count); + + } else { + // QR codes are not enabled + return Redirect::to("hardware")->with('error','Barcodes are not enabled in Admin > Settings'); + } + + } elseif (Input::get('bulk_actions')=='delete') { + + + $assets = Asset::with('assigneduser','assetloc')->find($asset_ids); + return View::make('backend/hardware/bulk-delete')->with('assets',$assets); // 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'); + $statuslabel_list = array('' => '') + Statuslabel::lists('name', 'id'); + $location_list = array('' => '') + Location::lists('name', 'id'); + $models_list = array('' => '') + Model::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); + return View::make('backend/hardware/bulk')->with('assets',$assets)->with('supplier_list',$supplier_list)->with('statuslabel_list',$statuslabel_list)->with('location_list',$location_list)->with('models_list',$models_list); } @@ -1145,14 +1159,14 @@ class AssetsController extends AdminController public function postBulkSave($assets = null) { - if (!Company::isCurrentUserAuthorized()) { - return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions')); - } - else if (Input::has('bulk_edit')) { + if (!Company::isCurrentUserAuthorized()) { + return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions')); + + } elseif (Input::has('bulk_edit')) { $assets = Input::get('bulk_edit'); - 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('requestable')) || (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('requestable')) || (Input::has('status_id')) || (Input::has('model_id')) ) { foreach ($assets as $key => $value) { @@ -1170,6 +1184,10 @@ class AssetsController extends AdminController $update_array['supplier_id'] = e(Input::get('supplier_id')); } + if (Input::has('model_id')) { + $update_array['model_id'] = e(Input::get('model_id')); + } + if (Input::has('order_number')) { $update_array['order_number'] = e(Input::get('order_number')); } @@ -1186,11 +1204,11 @@ class AssetsController extends AdminController $update_array['status_id'] = e(Input::get('status_id')); } - if (Input::get('requestable')=='1') { + if (Input::get('requestable')=='1') { $update_array['requestable'] = 1; } else { - $update_array['requestable'] = 0; - } + $update_array['requestable'] = 0; + } if (DB::table('assets') @@ -1227,6 +1245,55 @@ class AssetsController extends AdminController } + /** + * Save bulk edits + * + * @return View + **/ + public function postBulkDelete($assets = null) + { + + if (!Company::isCurrentUserAuthorized()) { + return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions')); + } elseif (Input::has('bulk_edit')) { + //$assets = Input::get('bulk_edit'); + $assets = Asset::find(Input::get('bulk_edit')); + //print_r($assets); + + + foreach ($assets as $asset) { + //echo '
@lang('admin/hardware/form.bulk_delete_help')
+@lang('admin/hardware/form.bulk_delete_warn', ['asset_count' => count($assets)])
+ + + +