From 6bf17e7d47ff21e9c88e7b773b0ad32ea063bb74 Mon Sep 17 00:00:00 2001 From: Daniel Meltzer Date: Sat, 20 Jan 2018 11:40:01 -0500 Subject: [PATCH 01/27] Reset the item between rows of import to avoid stale data. (#4868) --- app/Importer/ItemImporter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Importer/ItemImporter.php b/app/Importer/ItemImporter.php index 09e7d5b155..72a618cbd1 100644 --- a/app/Importer/ItemImporter.php +++ b/app/Importer/ItemImporter.php @@ -22,6 +22,9 @@ class ItemImporter extends Importer protected function handle($row) { + // Need to reset this between iterations or we'll have stale data. + $this->item = []; + $item_category = $this->findCsvMatch($row, "category"); if ($this->shouldUpdateField($item_category)) { $this->item["category_id"] = $this->createOrFetchCategory($item_category); From 2dede67ae9ccd809069827bfb37d067a33da9e39 Mon Sep 17 00:00:00 2001 From: snipe Date: Sat, 20 Jan 2018 08:45:53 -0800 Subject: [PATCH 02/27] Removed unusued badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 37873209c3..d00c25111c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=develop)](https://travis-ci.org/snipe/snipe-it) [![Stories in Ready](https://badge.waffle.io/snipe/snipe-it.png?label=ready+for+dev&title=Ready+for+development)](http://waffle.io/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://img.shields.io/badge/Shipping_faster_with-ZenHub-5e60ba.svg)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade) +[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=master)](https://travis-ci.org/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://img.shields.io/badge/Shipping_faster_with-ZenHub-5e60ba.svg)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade) [![All Contributors](https://img.shields.io/badge/all_contributors-92-orange.svg?style=flat-square)](#contributors) From a9441521a40e8dc72a8853bfd22325f57acf3385 Mon Sep 17 00:00:00 2001 From: snipe Date: Sat, 20 Jan 2018 08:46:19 -0800 Subject: [PATCH 03/27] Small refactor for Setting method --- app/Models/Setting.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 751faa80f5..a745234b7a 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -79,14 +79,11 @@ class Setting extends Model public static function getDefaultEula() { - $Parsedown = new \Parsedown(); if (Setting::getSettings()->default_eula_text) { return $Parsedown->text(e(Setting::getSettings()->default_eula_text)); - } else { - return null; } - + return null; } /** From 5f65f993a09dec9a8890bd6394798e01a861a5f6 Mon Sep 17 00:00:00 2001 From: snipe Date: Sat, 20 Jan 2018 08:47:39 -0800 Subject: [PATCH 04/27] Small refactor for AssetPresenter method --- app/Presenters/AssetPresenter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index 833428b5a7..55337ea680 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -331,9 +331,8 @@ class AssetPresenter extends Presenter return $this->model->model->name.' ('.$this->model->asset_tag.')'; } return $this->model->asset_tag; - } else { - return $this->model->name . ' (' . $this->model->asset_tag . ')'; } + return $this->model->name . ' (' . $this->model->asset_tag . ')'; } From 93ec7068df7744ce05702863cd7acf18bf7f0d9e Mon Sep 17 00:00:00 2001 From: snipe Date: Sat, 20 Jan 2018 08:54:49 -0800 Subject: [PATCH 05/27] Removed a few additional unused badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d00c25111c..f3deb6771a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=master)](https://travis-ci.org/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://img.shields.io/badge/Shipping_faster_with-ZenHub-5e60ba.svg)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade) +[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=master)](https://travis-ci.org/snipe/snipe-it) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade) [![All Contributors](https://img.shields.io/badge/all_contributors-92-orange.svg?style=flat-square)](#contributors) From b346556caa0d216fa23e8098824b853e2f29ff48 Mon Sep 17 00:00:00 2001 From: Tim Bishop Date: Mon, 22 Jan 2018 21:12:02 +0000 Subject: [PATCH 06/27] Allow manager_id to be fillable. (#4882) The API UsersController accepts manager_id, but calls the following: $user->fill($request->all()); This results in manager_id being ignored. I can't see any problem with allowing a user's manager to be modified using the API, so this change allows it. --- app/Models/User.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/User.php b/app/Models/User.php index bb85516e16..8fbbac9cfa 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -45,6 +45,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo 'country', 'zip', 'activated', + 'manager_id', ]; protected $casts = [ From 7b596c750d362687d989b03980023f0d4a142bd9 Mon Sep 17 00:00:00 2001 From: vcordes79 Date: Mon, 22 Jan 2018 22:14:04 +0100 Subject: [PATCH 07/27] API for (dis)associating fields with fieldsets (#4881) * start work on fields in fieldset api * revert CustomFieldsetsController * fieldset associate / disassociate api * fix variable names and payload * fix variable name --- .../Api/CustomFieldsController.php | 32 +++++++++++++++++++ .../Api/CustomFieldsetsController.php | 20 ++++++++++-- routes/api.php | 22 ++++++++++++- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/CustomFieldsController.php b/app/Http/Controllers/Api/CustomFieldsController.php index fb0493046f..da27ba02d2 100644 --- a/app/Http/Controllers/Api/CustomFieldsController.php +++ b/app/Http/Controllers/Api/CustomFieldsController.php @@ -125,6 +125,38 @@ class CustomFieldsController extends Controller } + public function associate(Request $request, $field_id) + { + $this->authorize('edit', CustomFieldset::class); + $field = CustomField::findOrFail($field_id); + + $fieldset_id = $request->input('fieldset_id'); + foreach ($field->fieldset as $fieldset) { + if ($fieldset->id == $fieldset_id) { + return response()->json(Helper::formatStandardApiResponse('success', $fieldset, trans('admin/custom_fields/message.fieldset.update.success'))); + } + } + + $fieldset = CustomFieldset::findOrFail($fieldset_id); + $fieldset->fields()->attach($field->id, ["required" => ($request->input('required') == "on"), "order" => $request->input('order', $fieldset->fields->count())]); + return response()->json(Helper::formatStandardApiResponse('success', $fieldset, trans('admin/custom_fields/message.fieldset.update.success'))); + } + + public function disassociate(Request $request, $field_id) + { + $this->authorize('edit', CustomFieldset::class); + $field = CustomField::findOrFail($field_id); + + $fieldset_id = $request->input('fieldset_id'); + foreach ($field->fieldset as $fieldset) { + if ($fieldset->id == $fieldset_id) { + $fieldset->fields()->detach($field->id); + return response()->json(Helper::formatStandardApiResponse('success', $fieldset, trans('admin/custom_fields/message.fieldset.update.success'))); + } + } + $fieldset = CustomFieldset::findOrFail($fieldset_id); + return response()->json(Helper::formatStandardApiResponse('success', $fieldset, trans('admin/custom_fields/message.fieldset.update.success'))); + } /** * Delete a custom field. diff --git a/app/Http/Controllers/Api/CustomFieldsetsController.php b/app/Http/Controllers/Api/CustomFieldsetsController.php index 3b82d0e5eb..915518e945 100644 --- a/app/Http/Controllers/Api/CustomFieldsetsController.php +++ b/app/Http/Controllers/Api/CustomFieldsetsController.php @@ -126,7 +126,7 @@ class CustomFieldsetsController extends Controller { $this->authorize('delete', CustomFieldset::class); $fieldset = CustomFieldset::findOrFail($id); - + $modelsCount = $fieldset->models->count(); $fieldsCount = $fieldset->fields->count(); @@ -141,7 +141,23 @@ class CustomFieldsetsController extends Controller return response()->json(Helper::formatStandardApiResponse('error', null, 'Unspecified error')); - + + } + + /** + * Return JSON containing a list of fields belonging to a fieldset. + * + * @author [V. Cordes] [] + * @since [v4.1.10] + * @param $fieldsetId + * @return string JSON + */ + public function fields($id) + { + $this->authorize('view', CustomFieldset::class); + $set = CustomFieldset::findOrFail($id); + $fields = $set->fields->get(); + return (new CustomFieldsTransformer)->transformCustomFields($fields, $fields->count()); } } diff --git a/routes/api.php b/routes/api.php index 36646956c3..5b40657a74 100644 --- a/routes/api.php +++ b/routes/api.php @@ -219,11 +219,32 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () { 'uses' => 'CustomFieldsController@postReorder' ] ); + Route::post('{field}/associate', + [ + 'as' => 'api.customfields.associate', + 'uses' => 'CustomFieldsController@associate' + ] + ); + Route::post('{field}/disassociate', + [ + 'as' => 'api.customfields.disassociate', + 'uses' => 'CustomFieldsController@disassociate' + ] + ); }); // Fields group /*--- Fieldsets API ---*/ + Route::group(['prefix' => 'fieldsets'], function () { + Route::get('{fieldset}/fields', + [ + 'as' => 'api.fieldsets.fields', + 'uses' => 'CustomFieldsetsController@fields' + ] + ); + }); + Route::resource('fieldsets', 'CustomFieldsetsController', [ 'names' => @@ -240,7 +261,6 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () { ); // Custom fieldset resource - /*--- Groups API ---*/ Route::resource('groups', 'GroupsController', From 691ec164b1e3ea7f67d9d08924c87dc957da823e Mon Sep 17 00:00:00 2001 From: CronKz <34064225+CronKz@users.noreply.github.com> Date: Mon, 22 Jan 2018 22:14:52 +0100 Subject: [PATCH 08/27] Added Translations (#4880) --- resources/lang/en/general.php | 3 +++ resources/views/hardware/view.blade.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index f34e34c1d4..1ed5a4cd9b 100644 --- a/resources/lang/en/general.php +++ b/resources/lang/en/general.php @@ -70,6 +70,7 @@ 'department' => 'Department', 'deployed' => 'Deployed', 'depreciation_report' => 'Depreciation Report', + 'details' => 'Details', 'download' => 'Download', 'depreciation' => 'Depreciation', 'editprofile' => 'Edit Your Profile', @@ -82,6 +83,7 @@ 'first' => 'First', 'first_name' => 'First Name', 'first_name_format' => 'First Name (jane@example.com)', + 'files' => 'Files', 'file_name' => 'File', 'file_uploads' => 'File Uploads', 'generate' => 'Generate', @@ -118,6 +120,7 @@ 'locations' => 'Locations', 'logout' => 'Logout', 'lookup_by_tag' => 'Lookup by Asset Tag', + 'maintenances' => 'Maintenances', 'manufacturer' => 'Manufacturer', 'manufacturers' => 'Manufacturers', 'markdown' => 'This field allows Github flavored markdown.', diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index f390288587..9319bbe8c3 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -53,7 +53,7 @@ @can('delete', $user) From 5219fb63a1e4a61cf17ff134439b40496f452289 Mon Sep 17 00:00:00 2001 From: Richard Hofman Date: Wed, 24 Jan 2018 15:15:36 +1300 Subject: [PATCH 13/27] Add --base_dn option to LdapSync command. (#4888) --- app/Console/Commands/LdapSync.php | 103 ++++++++++++++++-------------- 1 file changed, 56 insertions(+), 47 deletions(-) diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index bff3b72328..aca8921deb 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -16,7 +16,7 @@ class LdapSync extends Command * * @var string */ - protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--summary} {--json_summary}'; + protected $signature = 'snipeit:ldap-sync {--location=} {--location_id=} {--base_dn=} {--summary} {--json_summary}'; /** * The console command description. @@ -67,37 +67,24 @@ class LdapSync extends Command $summary = array(); - try { - $results = Ldap::findLdapUsers(); - } catch (\Exception $e) { - if ($this->option('json_summary')) { + try { + if ($this->option('base_dn') != '') { + $search_base = $this->option('base_dn'); + LOG::debug('Importing users from specified base DN: \"'.$search_base.'\".'); + } else { + $search_base = null; + } + $results = Ldap::findLdapUsers($search_base); + } catch (\Exception $e) { + if ($this->option('json_summary')) { $json_summary = [ "error" => true, "error_message" => $e->getMessage(), "summary" => [] ]; $this->info(json_encode($json_summary)); } LOG::error($e); return []; } - - // Retrieve locations with a mapped OU, and sort them from the shallowest to deepest OU (see #3993) - $ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray(); - $ldap_ou_lengths = array(); - - foreach ($ldap_ou_locations as $location) { - $ldap_ou_lengths[] = strlen($location["ldap_ou"]); - } - - array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations); - - if (sizeof($ldap_ou_locations) > 0) { - LOG::debug('Some locations have special OUs set. Locations will be automatically set for users in those OUs.'); - } - - // Inject location information fields - for ($i = 0; $i < $results["count"]; $i++) { - $results[$i]["ldap_location_override"] = false; - $results[$i]["location_id"] = 0; - } + /* Determine which location to assign users to by default. */ if ($this->option('location')!='') { $location = Location::where('name', '=', $this->option('location'))->first(); LOG::debug('Location name '.$this->option('location').' passed'); @@ -107,39 +94,61 @@ class LdapSync extends Command LOG::debug('Location ID '.$this->option('location_id').' passed'); LOG::debug('Importing to '.$location->name.' ('.$location->id.')'); } else { - $location = NULL; - } - + $location = NULL; + } if (!isset($location)) { LOG::debug('That location is invalid or a location was not provided, so no location will be assigned by default.'); } - // Grab subsets based on location-specific DNs, and overwrite location for these users. - foreach ($ldap_ou_locations as $ldap_loc) { - $location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]); - $usernames = array(); - for ($i = 0; $i < $location_users["count"]; $i++) { - $location_users[$i]["ldap_location_override"] = true; - $location_users[$i]["location_id"] = $ldap_loc["id"]; - $usernames[] = $location_users[$i][$ldap_result_username][0]; + /* Process locations with explicitly defined OUs, if doing a full import. */ + if ($this->option('base_dn')=='') { + // Retrieve locations with a mapped OU, and sort them from the shallowest to deepest OU (see #3993) + $ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray(); + $ldap_ou_lengths = array(); + + foreach ($ldap_ou_locations as $location) { + $ldap_ou_lengths[] = strlen($location["ldap_ou"]); } - // Delete located users from the general group. - foreach ($results as $key => $generic_entry) { - if (in_array($generic_entry[$ldap_result_username][0], $usernames)) { - unset($results[$key]); + array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations); + + if (sizeof($ldap_ou_locations) > 0) { + LOG::debug('Some locations have special OUs set. Locations will be automatically set for users in those OUs.'); + } + + // Inject location information fields + for ($i = 0; $i < $results["count"]; $i++) { + $results[$i]["ldap_location_override"] = false; + $results[$i]["location_id"] = 0; + } + + // Grab subsets based on location-specific DNs, and overwrite location for these users. + foreach ($ldap_ou_locations as $ldap_loc) { + $location_users = Ldap::findLdapUsers($ldap_loc["ldap_ou"]); + $usernames = array(); + for ($i = 0; $i < $location_users["count"]; $i++) { + $location_users[$i]["ldap_location_override"] = true; + $location_users[$i]["location_id"] = $ldap_loc["id"]; + $usernames[] = $location_users[$i][$ldap_result_username][0]; } - } - $global_count = $results['count']; - $results = array_merge($location_users, $results); - $results['count'] = $global_count; + // Delete located users from the general group. + foreach ($results as $key => $generic_entry) { + if (in_array($generic_entry[$ldap_result_username][0], $usernames)) { + unset($results[$key]); + } + } + + $global_count = $results['count']; + $results = array_merge($location_users, $results); + $results['count'] = $global_count; + } } + /* Create user account entries in Snipe-IT */ $tmp_pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20); $pass = bcrypt($tmp_pass); - for ($i = 0; $i < $results["count"]; $i++) { if (empty($ldap_result_active_flag) || $results[$i][$ldap_result_active_flag][0] == "TRUE") { @@ -207,9 +216,9 @@ class LdapSync extends Command if ($this->option('summary')) { for ($x = 0; $x < count($summary); $x++) { if ($summary[$x]['status']=='error') { - $this->error('ERROR: '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].' was not imported: '.$summary[$x]['note']); + $this->error('ERROR: '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].') was not imported: '.$summary[$x]['note']); } else { - $this->info('User '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].' was '.strtoupper($summary[$x]['createorupdate']).'.'); + $this->info('User '.$summary[$x]['firstname'].' '.$summary[$x]['lastname'].' (username: '.$summary[$x]['username'].') was '.strtoupper($summary[$x]['createorupdate']).'.'); } } } else if ($this->option('json_summary')) { From f1bbdc9e59771d135037a0a14dae2135e6745fe7 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 23 Jan 2018 18:13:41 -0800 Subject: [PATCH 14/27] Revert PR #4845 --- app/Http/Controllers/Api/UsersController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index d611eaa770..f5b7ce08e4 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -286,7 +286,6 @@ class UsersController extends Controller { $this->authorize('view', User::class); $assets = Asset::where('assigned_to', '=', $id)->with('model')->get(); - if ($assets) $this->authorize('view', $assets[0]); return (new AssetsTransformer)->transformAssets($assets, $assets->count()); } } From 7b99f81f72a905ae7f888e5fdc17d35841787e1e Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 24 Jan 2018 03:38:29 -0800 Subject: [PATCH 15/27] Fixed parse error on hardware blade --- app/Presenters/AssetPresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index 771f6fbd31..b8ca796d28 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -246,7 +246,7 @@ class AssetPresenter extends Presenter "searchable" => false, "sortable" => false, "switchable" => true, - "title" => trans('general.checkin')'/'trans('general.checkout'), + "title" => trans('general.checkin').'/'.trans('general.checkout'), "visible" => true, "formatter" => "hardwareInOutFormatter", ]; From e20cd42cc232b75c8d0eb8224cc2ed5ec2614b17 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 24 Jan 2018 03:42:49 -0800 Subject: [PATCH 16/27] More parse error fixes --- app/Presenters/ComponentPresenter.php | 2 +- app/Presenters/LicensePresenter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php index 22567bc5e9..843d8e8275 100644 --- a/app/Presenters/ComponentPresenter.php +++ b/app/Presenters/ComponentPresenter.php @@ -114,7 +114,7 @@ class ComponentPresenter extends Presenter "searchable" => false, "sortable" => false, "switchable" => true, - "title" => trans('general.checkin')'/'trans('general.checkout'), + "title" => trans('general.checkin').'/'.trans('general.checkout'), "visible" => true, "formatter" => "componentsInOutFormatter", ]; diff --git a/app/Presenters/LicensePresenter.php b/app/Presenters/LicensePresenter.php index 631b4f8bfc..3d793c33e7 100644 --- a/app/Presenters/LicensePresenter.php +++ b/app/Presenters/LicensePresenter.php @@ -125,7 +125,7 @@ class LicensePresenter extends Presenter "searchable" => false, "sortable" => false, "switchable" => true, - "title" => trans('general.checkin')'/'trans('general.checkout'), + "title" => trans('general.checkin').'/'.trans('general.checkout'), "visible" => true, "formatter" => "licensesInOutFormatter", ]; From b37f78dbbf5ff1891c1c4aaef945ca3a450cd711 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 24 Jan 2018 04:24:45 -0800 Subject: [PATCH 17/27] Fixed #4858 - wrong params for id count --- app/Http/Controllers/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 9f983ddd35..9c6dc0d64f 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -1088,7 +1088,7 @@ class AssetsController extends Controller \Log::debug($request->input('ids')); - if (($request->has('ids')) && (count($request->input('ids') > 0))) { + if (($request->has('ids')) && (count($request->input('ids')) > 0)) { $assets = $request->input('ids'); if (($request->has('purchase_date')) || ($request->has('purchase_cost')) From 7cafa194c1ecf3fc1a1b4ba262b65f1c57fbb1d8 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 24 Jan 2018 04:26:15 -0800 Subject: [PATCH 18/27] Fix for counts --- app/Http/Controllers/UsersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 2303da761a..4a8ba70e7d 100755 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -461,7 +461,7 @@ class UsersController extends Controller public function postBulkEditSave(Request $request) { $this->authorize('update', User::class); - if ((!Input::has('ids')) || (count(Input::has('ids')) == 0)) { + if ((!Input::has('ids')) || (count(Input::input('ids')) == 0)) { return redirect()->back()->with('error', 'No users selected'); } else { From a7b8b4bf55ab4a49337749c6287dbbe9f5e136ad Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 24 Jan 2018 04:38:25 -0800 Subject: [PATCH 19/27] Added: ability to change actual location from bulk edit assets --- app/Http/Controllers/AssetsController.php | 6 ++++++ resources/views/hardware/bulk.blade.php | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 9c6dc0d64f..a7794e2478 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -1131,7 +1131,13 @@ class AssetsController extends Controller } if ($request->has('rtd_location_id')) { $update_array['rtd_location_id'] = $request->input('rtd_location_id'); + if (($request->has('update_real_loc')) + && (($request->input('update_real_loc')) == '1')) + { + $update_array['location_id'] = $request->input('location_id'); + } } + if ($request->has('status_id')) { $update_array['status_id'] = $request->input('status_id'); } diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php index ff0c4cb8c6..8207e95715 100755 --- a/resources/views/hardware/bulk.blade.php +++ b/resources/views/hardware/bulk.blade.php @@ -54,8 +54,25 @@ @include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.default_location'), 'fieldname' => 'rtd_location_id']) + +
+
- +
+
+
+ +
+
+
+ + + +