diff --git a/.all-contributorsrc b/.all-contributorsrc index eb052687eb..e6055ddb78 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2907,6 +2907,15 @@ "contributions": [ "code" ] + }, + { + "login": "vikaas-cyper", + "name": "VIKAAS-A", + "avatar_url": "https://avatars.githubusercontent.com/u/74609912?v=4", + "profile": "https://github.com/vikaas-cyper", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index 040de8e93c..a3a658fb84 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![Build Status](https://app.chipperci.com/projects/0e5f8979-31eb-4ee6-9abf-050b76ab0383/status/master) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![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/snipeitapp.svg?style=social)](https://twitter.com/snipeitapp) [![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-320-orange.svg?style=flat-square)](#contributors) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk) [![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev) +[![All Contributors](https://img.shields.io/badge/all_contributors-321-orange.svg?style=flat-square)](#contributors) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk) [![huntr](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev) ## Snipe-IT - Open Source Asset Management System @@ -144,7 +144,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken | [
Peace](https://github.com/julian-piehl)
[💻](https://github.com/snipe/snipe-it/commits?author=julian-piehl "Code") | [
Kyle Gordon](https://github.com/kylegordon)
[💻](https://github.com/snipe/snipe-it/commits?author=kylegordon "Code") | [
Katharina Drexel](http://www.bfh.ch)
[💻](https://github.com/snipe/snipe-it/commits?author=sunflowerbofh "Code") | [
David Sferruzza](https://david.sferruzza.fr/)
[💻](https://github.com/snipe/snipe-it/commits?author=dsferruzza "Code") | [
Rick Nelson](https://github.com/rnelsonee)
[💻](https://github.com/snipe/snipe-it/commits?author=rnelsonee "Code") | [
BasO12](https://github.com/BasO12)
[💻](https://github.com/snipe/snipe-it/commits?author=BasO12 "Code") | [
Vautia](https://github.com/Vautia)
[💻](https://github.com/snipe/snipe-it/commits?author=Vautia "Code") | | [
Chris Hartjes](http://www.littlehart.net/atthekeyboard)
[💻](https://github.com/snipe/snipe-it/commits?author=chartjes "Code") | [
geo-chen](https://github.com/geo-chen)
[💻](https://github.com/snipe/snipe-it/commits?author=geo-chen "Code") | [
Phan Nguyen](https://github.com/nh314)
[💻](https://github.com/snipe/snipe-it/commits?author=nh314 "Code") | [
Iisakki Jaakkola](https://github.com/StarlessNights)
[💻](https://github.com/snipe/snipe-it/commits?author=StarlessNights "Code") | [
Ikko Ashimine](https://bandism.net/)
[💻](https://github.com/snipe/snipe-it/commits?author=eltociear "Code") | [
Lukas Fehling](https://github.com/lukasfehling)
[💻](https://github.com/snipe/snipe-it/commits?author=lukasfehling "Code") | [
Fernando Almeida](https://github.com/fernando-almeida)
[💻](https://github.com/snipe/snipe-it/commits?author=fernando-almeida "Code") | | [
akemidx](https://github.com/akemidx)
[💻](https://github.com/snipe/snipe-it/commits?author=akemidx "Code") | [
Oguz Bilgic](http://oguz.site)
[💻](https://github.com/snipe/snipe-it/commits?author=oguzbilgic "Code") | [
Scooter Crawford](https://github.com/scoo73r)
[💻](https://github.com/snipe/snipe-it/commits?author=scoo73r "Code") | [
subdriven](https://github.com/subdriven)
[💻](https://github.com/snipe/snipe-it/commits?author=subdriven "Code") | [
Andrew Savinykh](https://github.com/AndrewSav)
[💻](https://github.com/snipe/snipe-it/commits?author=AndrewSav "Code") | [
Tadayuki Onishi](https://kenchan0130.github.io)
[💻](https://github.com/snipe/snipe-it/commits?author=kenchan0130 "Code") | [
Florian](https://github.com/floschoepfer)
[💻](https://github.com/snipe/snipe-it/commits?author=floschoepfer "Code") | -| [
Spencer Long](http://spencerlong.com)
[💻](https://github.com/snipe/snipe-it/commits?author=spencerrlongg "Code") | [
Marcus Moore](https://github.com/marcusmoore)
[💻](https://github.com/snipe/snipe-it/commits?author=marcusmoore "Code") | [
Martin Meredith](https://github.com/Mezzle)
| [
dboth](http://dboth.de)
[💻](https://github.com/snipe/snipe-it/commits?author=dboth "Code") | [
Zachary Fleck](https://github.com/zacharyfleck)
[💻](https://github.com/snipe/snipe-it/commits?author=zacharyfleck "Code") | +| [
Spencer Long](http://spencerlong.com)
[💻](https://github.com/snipe/snipe-it/commits?author=spencerrlongg "Code") | [
Marcus Moore](https://github.com/marcusmoore)
[💻](https://github.com/snipe/snipe-it/commits?author=marcusmoore "Code") | [
Martin Meredith](https://github.com/Mezzle)
| [
dboth](http://dboth.de)
[💻](https://github.com/snipe/snipe-it/commits?author=dboth "Code") | [
Zachary Fleck](https://github.com/zacharyfleck)
[💻](https://github.com/snipe/snipe-it/commits?author=zacharyfleck "Code") | [
VIKAAS-A](https://github.com/vikaas-cyper)
[💻](https://github.com/snipe/snipe-it/commits?author=vikaas-cyper "Code") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index a9e44d91b4..30a0b699e9 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api; use App\Helpers\Helper; use App\Http\Controllers\Controller; use App\Http\Transformers\AssetsTransformer; +use App\Http\Transformers\SelectlistTransformer; use App\Http\Transformers\StatuslabelsTransformer; use App\Models\Asset; use App\Models\Statuslabel; @@ -291,4 +292,45 @@ class StatuslabelsController extends Controller return '0'; } + + /** + * Gets a paginated collection for the select2 menus + * + * @author [A. Gianotto] [] + * @since [v6.1.1] + * @see \App\Http\Transformers\SelectlistTransformer + */ + public function selectlist(Request $request) + { + + $this->authorize('view.selectlists'); + $statuslabels = Statuslabel::orderBy('default_label', 'desc')->orderBy('name', 'asc')->orderBy('deployable', 'desc'); + + if ($request->filled('search')) { + $statuslabels = $statuslabels->where('name', 'LIKE', '%'.$request->get('search').'%'); + } + + if ($request->filled('deployable')) { + $statuslabels = $statuslabels->where('deployable', '=', '1'); + } + + if ($request->filled('pending')) { + $statuslabels = $statuslabels->where('pending', '=', '1'); + } + + if ($request->filled('archived')) { + $statuslabels = $statuslabels->where('archived', '=', '1'); + } + + $statuslabels = $statuslabels->orderBy('name', 'ASC')->paginate(50); + + // Loop through and set some custom properties for the transformer to use. + // This lets us have more flexibility in special cases like assets, where + // they may not have a ->name value but we want to display something anyway + foreach ($statuslabels as $statuslabel) { + $statuslabels->use_text = $statuslabel->name; + } + + return (new SelectlistTransformer)->transformSelectlist($statuslabels); + } } diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 80fe24255c..4fa7990a22 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -595,23 +595,23 @@ class ReportsController extends Controller 'model.category', 'model.manufacturer', 'supplier'); if ($request->filled('by_location_id')) { - $assets->where('assets.location_id', $request->input('by_location_id')); + $assets->whereIn('assets.location_id', $request->input('by_location_id')); } if ($request->filled('by_rtd_location_id')) { - $assets->where('assets.rtd_location_id', $request->input('by_rtd_location_id')); + $assets->whereIn('assets.rtd_location_id', $request->input('by_rtd_location_id')); } if ($request->filled('by_supplier_id')) { - $assets->where('assets.supplier_id', $request->input('by_supplier_id')); + $assets->whereIn('assets.supplier_id', $request->input('by_supplier_id')); } if ($request->filled('by_company_id')) { - $assets->where('assets.company_id', $request->input('by_company_id')); + $assets->whereIn('assets.company_id', $request->input('by_company_id')); } if ($request->filled('by_model_id')) { - $assets->where('assets.model_id', $request->input('by_model_id')); + $assets->whereIn('assets.model_id', $request->input('by_model_id')); } if ($request->filled('by_category_id')) { @@ -631,7 +631,7 @@ class ReportsController extends Controller } if ($request->filled('by_status_id')) { - $assets->where('assets.status_id', $request->input('by_status_id')); + $assets->whereIn('assets.status_id', $request->input('by_status_id')); } if (($request->filled('purchase_start')) && ($request->filled('purchase_end'))) { @@ -666,6 +666,7 @@ class ReportsController extends Controller $assets->onlyTrashed(); } + \Log::debug($assets->toSql()); $assets->orderBy('assets.id', 'ASC')->chunk(20, function ($assets) use ($handle, $customfields, $request) { $executionTime = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; diff --git a/resources/views/partials/forms/edit/category-select.blade.php b/resources/views/partials/forms/edit/category-select.blade.php index a5fd9471f3..684b8d76da 100644 --- a/resources/views/partials/forms/edit/category-select.blade.php +++ b/resources/views/partials/forms/edit/category-select.blade.php @@ -4,7 +4,7 @@ {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
- @if ($category_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))