diff --git a/.all-contributorsrc b/.all-contributorsrc index 5c33ed4b2..a8452eb83 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -856,6 +856,24 @@ "contributions": [ "code" ] + }, + { + "login": "CronKz", + "name": "CronKz", + "avatar_url": "https://avatars0.githubusercontent.com/u/34064225?v=4", + "profile": "https://github.com/CronKz", + "contributions": [ + "code" + ] + }, + { + "login": "tdb", + "name": "Tim Bishop", + "avatar_url": "https://avatars1.githubusercontent.com/u/585486?v=4", + "profile": "https://github.com/tdb", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index 37873209c..ca49bfb60 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![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) -[![All Contributors](https://img.shields.io/badge/all_contributors-92-orange.svg?style=flat-square)](#contributors) +[![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-94-orange.svg?style=flat-square)](#contributors) ## Snipe-IT - Open Source Asset Management System @@ -69,7 +69,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken | [
Jason Spriggs](http://jasonspriggs.com)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=jasonspriggs "Code") | [
Nate Felton](http://n8felton.wordpress.com)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=n8felton "Code") | [
Manasses Ferreira](http://homepages.dcc.ufmg.br/~manassesferreira)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=manassesferreira "Code") | [
Steve](https://github.com/steveelwood)
[⚠️](https://github.com/snipe/snipe-it/commits?author=steveelwood "Tests") | [
matc](http://twitter.com/matc)
[⚠️](https://github.com/snipe/snipe-it/commits?author=matc "Tests") | [
Cole R. Davis](http://www.davisracingteam.com)
[⚠️](https://github.com/snipe/snipe-it/commits?author=VanillaNinjaD "Tests") | [
gibsonjoshua55](https://github.com/gibsonjoshua55)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=gibsonjoshua55 "Code") | | [
Robin Temme](https://github.com/zwerch)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [
Iman](https://github.com/imanghafoori1)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [
Richard Hofman](https://github.com/richardhofman6)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [
gizzmojr](https://github.com/gizzmojr)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") | [
Jenny Li](https://github.com/imjennyli)
[πŸ“–](https://github.com/snipe/snipe-it/commits?author=imjennyli "Documentation") | [
Geoff Young](https://github.com/GeoffYoung)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=GeoffYoung "Code") | [
Elliot Blackburn](http://www.elliotblackburn.com)
[πŸ“–](https://github.com/snipe/snipe-it/commits?author=BlueHatbRit "Documentation") | | [
TΓ΅nis Ormisson](http://andmemasin.eu)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=TonisOrmisson "Code") | [
Nicolai Essig](http://www.nicolai-essig.de)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=thakilla "Code") | [
Danielle](https://github.com/techincolor)
[πŸ“–](https://github.com/snipe/snipe-it/commits?author=techincolor "Documentation") | [
Lawrence](https://github.com/TheVakman)
[⚠️](https://github.com/snipe/snipe-it/commits?author=TheVakman "Tests") [πŸ›](https://github.com/snipe/snipe-it/issues?q=author%3ATheVakman "Bug reports") | [
uknzaeinozpas](https://github.com/uknzaeinozpas)
[⚠️](https://github.com/snipe/snipe-it/commits?author=uknzaeinozpas "Tests") [πŸ’»](https://github.com/snipe/snipe-it/commits?author=uknzaeinozpas "Code") | [
Ryan](https://github.com/Gelob)
[πŸ“–](https://github.com/snipe/snipe-it/commits?author=Gelob "Documentation") | [
vcordes79](https://github.com/vcordes79)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=vcordes79 "Code") | -| [
fordster78](https://github.com/fordster78)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=fordster78 "Code") | +| [
fordster78](https://github.com/fordster78)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=fordster78 "Code") | [
CronKz](https://github.com/CronKz)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=CronKz "Code") | [
Tim Bishop](https://github.com/tdb)
[πŸ’»](https://github.com/snipe/snipe-it/commits?author=tdb "Code") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index bff3b7232..aca8921de 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')) { diff --git a/app/Http/Controllers/Api/CustomFieldsController.php b/app/Http/Controllers/Api/CustomFieldsController.php index fb0493046..da27ba02d 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 3b82d0e5e..915518e94 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/app/Http/Controllers/Api/ReportsController.php b/app/Http/Controllers/Api/ReportsController.php index 10f63da41..bd5eb6e28 100644 --- a/app/Http/Controllers/Api/ReportsController.php +++ b/app/Http/Controllers/Api/ReportsController.php @@ -46,7 +46,7 @@ class ReportsController extends Controller ]; $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; - $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; + $order = $request->input('order') === 'asc' ? 'desc' : 'asc'; $offset = request('offset', 0); $limit = request('limit', 50); $total = $actionlogs->count(); diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 9f983ddd3..a7794e247 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')) @@ -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/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 807f5466f..a5f50e5bd 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -375,6 +375,8 @@ class SettingsController extends Controller $setting->brand = $request->input('brand', '1'); $setting->header_color = $request->input('header_color'); + $setting->support_footer = $request->input('support_footer'); + $setting->footer_text = $request->input('footer_text'); $setting->show_url_in_emails = $request->input('show_url_in_emails', '0'); diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 2303da761..4a8ba70e7 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 { diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 76c9bd9f9..611f8ec3d 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -36,13 +36,13 @@ class AssetsTransformer 'id' => (int) $asset->assetstatus->id, 'name'=> e($asset->assetstatus->name), 'status_type'=> e($asset->assetstatus->getStatuslabelType()), - 'status_meta' => e($asset->present()->statusMeta), + 'status_meta' => e($asset->present()->statusMeta), ] : null, - 'category' => ($asset->model->category) ? [ + 'category' => (($asset->model) && ($asset->model->category)) ? [ 'id' => (int) $asset->model->category->id, 'name'=> e($asset->model->category->name) ] : null, - 'manufacturer' => ($asset->model->manufacturer) ? [ + 'manufacturer' => (($asset->model) && ($asset->model->manufacturer)) ? [ 'id' => (int) $asset->model->manufacturer->id, 'name'=> e($asset->model->manufacturer->name) ] : null, diff --git a/app/Importer/ItemImporter.php b/app/Importer/ItemImporter.php index 09e7d5b15..72a618cbd 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); diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 8d7a5bf75..1c6ad8fcb 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -223,7 +223,7 @@ class Asset extends Depreciable */ public function components() { - return $this->belongsToMany('\App\Models\Component', 'components_assets', 'asset_id', 'component_id')->withPivot('id')->withTrashed(); + return $this->belongsToMany('\App\Models\Component', 'components_assets', 'asset_id', 'component_id')->withPivot('id', 'assigned_qty')->withTrashed(); } /** diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 751faa80f..a745234b7 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; } /** diff --git a/app/Models/User.php b/app/Models/User.php index bb85516e1..8fbbac9cf 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 = [ diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index 833428b5a..b8ca796d2 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -165,7 +165,7 @@ class AssetPresenter extends Presenter "searchable" => false, "sortable" => false, "visible" => false, - "title" => 'Warranty Expires', + "title" => trans('admin/hardware/form.warranty_expires'), "formatter" => "dateDisplayFormatter" ],[ "field" => "notes", @@ -246,11 +246,11 @@ class AssetPresenter extends Presenter "searchable" => false, "sortable" => false, "switchable" => true, - "title" => 'Checkin/Checkout', + "title" => trans('general.checkin').'/'.trans('general.checkout'), "visible" => true, "formatter" => "hardwareInOutFormatter", ]; - + $layout[] = [ "field" => "actions", "searchable" => false, @@ -263,7 +263,7 @@ class AssetPresenter extends Presenter return json_encode($layout); } - + /** * Generate html link to this items name. @@ -325,15 +325,14 @@ class AssetPresenter extends Presenter **/ public function name() { - + if (empty($this->model->name)) { if (isset($this->model->model)) { 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 . ')'; } @@ -399,7 +398,7 @@ class AssetPresenter extends Presenter public function statusMeta() { if ($this->model->assigned) { - return strtolower(trans('general.deployed')); + return 'deployed'; } return $this->model->assetstatus->getStatuslabelType(); } @@ -483,4 +482,3 @@ class AssetPresenter extends Presenter return ''; } } - diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php index 2ea797c4e..843d8e827 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" => 'Checkin/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 f58bbbe2d..3d793c33e 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" => 'Checkin/Checkout', + "title" => trans('general.checkin').'/'.trans('general.checkout'), "visible" => true, "formatter" => "licensesInOutFormatter", ]; diff --git a/database/migrations/2016_09_04_182149_migrate_asset_log_to_action_log.php b/database/migrations/2016_09_04_182149_migrate_asset_log_to_action_log.php index ad8118a41..4d0de747a 100644 --- a/database/migrations/2016_09_04_182149_migrate_asset_log_to_action_log.php +++ b/database/migrations/2016_09_04_182149_migrate_asset_log_to_action_log.php @@ -57,7 +57,6 @@ class MigrateAssetLogToActionLog extends Migration $a->deleted_at = $log->deleted_at; $a->note = $log->note; $a->expected_checkin = $log->expected_checkin; - $a->thread_id = $log->thread_id; $a->accepted_id = $log->accepted_id; $a->filename = $log->filename; diff --git a/database/migrations/2018_01_24_062633_add_footer_settings_to_settings.php b/database/migrations/2018_01_24_062633_add_footer_settings_to_settings.php new file mode 100644 index 000000000..5b9de3ce5 --- /dev/null +++ b/database/migrations/2018_01_24_062633_add_footer_settings_to_settings.php @@ -0,0 +1,34 @@ +char('support_footer', 5)->nullable()->default('on'); + $table->text('footer_text')->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('settings', function (Blueprint $table) { + $table->text('support_footer'); + $table->text('footer_text'); + }); + } +} diff --git a/resources/lang/en/admin/hardware/form.php b/resources/lang/en/admin/hardware/form.php index af643641d..9b3ac3241 100644 --- a/resources/lang/en/admin/hardware/form.php +++ b/resources/lang/en/admin/hardware/form.php @@ -38,6 +38,7 @@ return array( 'tag' => 'Asset Tag', 'update' => 'Asset Update', 'warranty' => 'Warranty', + 'warranty_expires' => 'Warranty Expires', 'years' => 'years', ) ; diff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.php index 76159635b..012cedb08 100644 --- a/resources/lang/en/admin/settings/general.php +++ b/resources/lang/en/admin/settings/general.php @@ -40,6 +40,8 @@ return array( 'alt_barcode_type' => '1D barcode type', 'eula_settings' => 'EULA Settings', 'eula_markdown' => 'This EULA allows Github flavored markdown.', + 'footer_text' => 'Additional Footer Text ', + 'footer_text_help' => 'This text will appear in the right-side footer. Links are allowed using Github flavored markdown. Line breaks, headers, images, etc may result in unpredictable results.', 'general_settings' => 'General Settings', 'generate_backup' => 'Generate Backup', 'header_color' => 'Header Color', @@ -71,6 +73,7 @@ return array( 'ldap_active_flag' => 'LDAP Active Flag', 'ldap_emp_num' => 'LDAP Employee Number', 'ldap_email' => 'LDAP Email', + 'license' => 'Software License', 'load_remote_text' => 'Remote Scripts', 'load_remote_help_text' => 'This Snipe-IT install can load scripts from the outside world.', 'login_note' => 'Login Note', @@ -103,6 +106,8 @@ return array( 'slack_integration' => 'Slack Settings', 'slack_integration_help' => 'Slack integration is optional, however the endpoint and channel are required if you wish to use it. To configure Slack integration, you must first create an incoming webhook on your Slack account.', 'snipe_version' => 'Snipe-IT version', + 'support_footer' => 'Support Footer Links ', + 'support_footer_help' => 'Specify who sees the links to the Snipe-IT Support info and Users Manual', 'system' => 'System Information', 'update' => 'Update Settings', 'value' => 'Value', diff --git a/resources/lang/en/admin/users/general.php b/resources/lang/en/admin/users/general.php index 985138d06..30355972f 100644 --- a/resources/lang/en/admin/users/general.php +++ b/resources/lang/en/admin/users/general.php @@ -16,6 +16,7 @@ return array( 'restore_user' => 'Click here to restore them.', 'last_login' => 'Last Login', 'ldap_config_text' => 'LDAP configuration settings can be found Admin > Settings. The (optional) selected location will be set for all imported users.', + 'print_assigned' => 'Print All Assigned', 'software_user' => 'Software Checked out to :name', 'view_user' => 'View User :name', 'usercsv' => 'CSV file', diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index f34e34c1d..1ed5a4cd9 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/components/view.blade.php b/resources/views/components/view.blade.php index 5f59e9d46..924d6c99b 100644 --- a/resources/views/components/view.blade.php +++ b/resources/views/components/view.blade.php @@ -58,7 +58,7 @@ {{ trans('general.asset') }} {{ trans('general.qty') }} {{ trans('general.date') }} - Checkin/Checkout + {{ trans('general.checkin') }}/{{ trans('general.checkout') }} diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php index ff0c4cb8c..8207e9571 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']) + +
+
- +
+
+
+ +
+
+
+ + + +
- {{ Form::checkbox('is_ad', '1', Input::old('is_ad', $setting->is_ad),array('class' => 'minimal')) }} + @if (config('app.lock_passwords')===true) + {{ Form::checkbox('is_ad', '1', Input::old('is_ad', $setting->is_ad),['class' => 'minimal disabled', 'disabled' => 'disabled']) }} + @else + {{ Form::checkbox('is_ad', '1', Input::old('is_ad', $setting->is_ad),array('class' => 'minimal')) }} + @endif + {{ trans('admin/settings/general.is_ad') }} {!! $errors->first('is_ad', ':message') !!}
@@ -84,10 +94,16 @@
- {{ Form::label('is_ad', trans('admin/settings/general.ldap_pw_sync')) }} + {{ Form::label('ldap_pw_sync', trans('admin/settings/general.ldap_pw_sync')) }}
- {{ Form::checkbox('ldap_pw_sync', '1', Input::old('ldap_pw_sync', $setting->ldap_pw_sync),array('class' => 'minimal')) }} + @if (config('app.lock_passwords')===true) + {{ Form::checkbox('ldap_pw_sync', '1', Input::old('ldap_pw_sync', $setting->ldap_pw_sync),['class' => 'minimal disabled', 'disabled' => 'disabled']) }} + @else + {{ Form::checkbox('ldap_pw_sync', '1', Input::old('ldap_pw_sync', $setting->ldap_pw_sync),array('class' => 'minimal')) }} + @endif + + {{ trans('general.yes') }}

{{ trans('admin/settings/general.ldap_pw_sync_help') }}

{!! $errors->first('ldap_pw_sync', ':message') !!} @@ -132,7 +148,13 @@ {{ Form::label('ldap_tls', trans('admin/settings/general.ldap_tls')) }}
- {{ Form::checkbox('ldap_tls', '1', Input::old('ldap_tls', $setting->ldap_tls),array('class' => 'minimal')) }} + @if (config('app.lock_passwords')===true) + {{ Form::checkbox('ldap_tls', '1', Input::old('ldap_tls', $setting->ldap_tls),['class' => 'minimal disabled', 'disabled' => 'disabled']) }} + @else + {{ Form::checkbox('ldap_tls', '1', Input::old('ldap_tls', $setting->ldap_tls),array('class' => 'minimal')) }} + @endif + + {{ trans('admin/settings/general.ldap_tls_help') }} {!! $errors->first('ldap_tls', ':message') !!}
@@ -144,7 +166,13 @@ {{ Form::label('ldap_server_cert_ignore', trans('admin/settings/general.ldap_server_cert')) }}
- {{ Form::checkbox('ldap_server_cert_ignore', '1', Input::old('ldap_server_cert_ignore', $setting->ldap_server_cert_ignore),array('class' => 'minimal')) }} + @if (config('app.lock_passwords')===true) + {{ Form::checkbox('ldap_server_cert_ignore', '1', Input::old('ldap_server_cert_ignore', $setting->ldap_server_cert_ignore),['class' => 'minimal disabled', 'disabled' => 'disabled']) }} + @else + {{ Form::checkbox('ldap_server_cert_ignore', '1', Input::old('ldap_server_cert_ignore', $setting->ldap_server_cert_ignore),array('class' => 'minimal')) }} + @endif + + {{ trans('admin/settings/general.ldap_server_cert_ignore') }} {!! $errors->first('ldap_server_cert_ignore', ':message') !!}

{{ trans('admin/settings/general.ldap_server_cert_help') }}

diff --git a/resources/views/suppliers/view.blade.php b/resources/views/suppliers/view.blade.php index f81e4f144..2534b0174 100755 --- a/resources/views/suppliers/view.blade.php +++ b/resources/views/suppliers/view.blade.php @@ -51,7 +51,7 @@ {{ trans('admin/hardware/form.serial') }} {{ trans('general.category') }} {{ trans('general.purchase_cost') }} - Checkin/Checkout + {{ trans('general.checkin') }}/{{ trans('general.checkout') }} {{ trans('table.actions') }} diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index 1996d96c7..d43a5047f 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -241,7 +241,7 @@ {{ trans('admin/users/general.clone') }}
@can('delete', $user) @@ -478,7 +478,7 @@ - {{ trans('general.date') }} + {{ trans('general.date') }} {{ trans('general.admin') }} {{ trans('general.action') }} {{ trans('general.item') }} diff --git a/routes/api.php b/routes/api.php index 36646956c..5b40657a7 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',