Skip to content

Commit 381890b

Browse files
committed
Merge branch 'develop' into laravel_v9
2 parents 71fa6d7 + e25dc42 commit 381890b

File tree

93 files changed

+1322
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1322
-262
lines changed

.all-contributorsrc

+18
Original file line numberDiff line numberDiff line change
@@ -2889,6 +2889,24 @@
28892889
"avatar_url": "https://avatars.githubusercontent.com/u/570639?v=4",
28902890
"profile": "https://github.com/Mezzle",
28912891
"contributions": []
2892+
},
2893+
{
2894+
"login": "dboth",
2895+
"name": "dboth",
2896+
"avatar_url": "https://avatars.githubusercontent.com/u/5731963?v=4",
2897+
"profile": "http://dboth.de",
2898+
"contributions": [
2899+
"code"
2900+
]
2901+
},
2902+
{
2903+
"login": "zacharyfleck",
2904+
"name": "Zachary Fleck",
2905+
"avatar_url": "https://avatars.githubusercontent.com/u/87536651?v=4",
2906+
"profile": "https://github.com/zacharyfleck",
2907+
"contributions": [
2908+
"code"
2909+
]
28922910
}
28932911
]
28942912
}

.github/workflows/docker-alpine.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
context: .
7878
file: ./Dockerfile.alpine
79-
platforms: linux/amd64
79+
platforms: linux/amd64,linux/arm64
8080
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
8181
# but we ONLY do an image push to DockerHub if it's NOT a PR
8282
push: ${{ github.event_name != 'pull_request' }}

.github/workflows/docker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
context: .
7878
file: ./Dockerfile
79-
platforms: linux/amd64
79+
platforms: linux/amd64,linux/arm64
8080
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
8181
# but we ONLY do an image push to DockerHub if it's NOT a PR
8282
push: ${{ github.event_name != 'pull_request' }}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
![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)
2-
[![All Contributors](https://img.shields.io/badge/all_contributors-318-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)
2+
[![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)
33

44
## Snipe-IT - Open Source Asset Management System
55

@@ -144,7 +144,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
144144
| [<img src="https://avatars.githubusercontent.com/u/32363424?v=4" width="110px;"/><br /><sub>Peace</sub>](https://github.com/julian-piehl)<br />[💻](https://github.com/snipe/snipe-it/commits?author=julian-piehl "Code") | [<img src="https://avatars.githubusercontent.com/u/231528?v=4" width="110px;"/><br /><sub>Kyle Gordon</sub>](https://github.com/kylegordon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=kylegordon "Code") | [<img src="https://avatars.githubusercontent.com/u/53009155?v=4" width="110px;"/><br /><sub>Katharina Drexel</sub>](http://www.bfh.ch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sunflowerbofh "Code") | [<img src="https://avatars.githubusercontent.com/u/1931963?v=4" width="110px;"/><br /><sub>David Sferruzza</sub>](https://david.sferruzza.fr/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dsferruzza "Code") | [<img src="https://avatars.githubusercontent.com/u/19511639?v=4" width="110px;"/><br /><sub>Rick Nelson</sub>](https://github.com/rnelsonee)<br />[💻](https://github.com/snipe/snipe-it/commits?author=rnelsonee "Code") | [<img src="https://avatars.githubusercontent.com/u/94169344?v=4" width="110px;"/><br /><sub>BasO12</sub>](https://github.com/BasO12)<br />[💻](https://github.com/snipe/snipe-it/commits?author=BasO12 "Code") | [<img src="https://avatars.githubusercontent.com/u/111710123?v=4" width="110px;"/><br /><sub>Vautia</sub>](https://github.com/Vautia)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Vautia "Code") |
145145
| [<img src="https://avatars.githubusercontent.com/u/28321?v=4" width="110px;"/><br /><sub>Chris Hartjes</sub>](http://www.littlehart.net/atthekeyboard)<br />[💻](https://github.com/snipe/snipe-it/commits?author=chartjes "Code") | [<img src="https://avatars.githubusercontent.com/u/2404584?v=4" width="110px;"/><br /><sub>geo-chen</sub>](https://github.com/geo-chen)<br />[💻](https://github.com/snipe/snipe-it/commits?author=geo-chen "Code") | [<img src="https://avatars.githubusercontent.com/u/6006620?v=4" width="110px;"/><br /><sub>Phan Nguyen</sub>](https://github.com/nh314)<br />[💻](https://github.com/snipe/snipe-it/commits?author=nh314 "Code") | [<img src="https://avatars.githubusercontent.com/u/115993812?v=4" width="110px;"/><br /><sub>Iisakki Jaakkola</sub>](https://github.com/StarlessNights)<br />[💻](https://github.com/snipe/snipe-it/commits?author=StarlessNights "Code") | [<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="110px;"/><br /><sub>Ikko Ashimine</sub>](https://bandism.net/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=eltociear "Code") | [<img src="https://avatars.githubusercontent.com/u/56871540?v=4" width="110px;"/><br /><sub>Lukas Fehling</sub>](https://github.com/lukasfehling)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lukasfehling "Code") | [<img src="https://avatars.githubusercontent.com/u/1975990?v=4" width="110px;"/><br /><sub>Fernando Almeida</sub>](https://github.com/fernando-almeida)<br />[💻](https://github.com/snipe/snipe-it/commits?author=fernando-almeida "Code") |
146146
| [<img src="https://avatars.githubusercontent.com/u/116301219?v=4" width="110px;"/><br /><sub>akemidx</sub>](https://github.com/akemidx)<br />[💻](https://github.com/snipe/snipe-it/commits?author=akemidx "Code") | [<img src="https://avatars.githubusercontent.com/u/144778?v=4" width="110px;"/><br /><sub>Oguz Bilgic</sub>](http://oguz.site)<br />[💻](https://github.com/snipe/snipe-it/commits?author=oguzbilgic "Code") | [<img src="https://avatars.githubusercontent.com/u/9262438?v=4" width="110px;"/><br /><sub>Scooter Crawford</sub>](https://github.com/scoo73r)<br />[💻](https://github.com/snipe/snipe-it/commits?author=scoo73r "Code") | [<img src="https://avatars.githubusercontent.com/u/5957345?v=4" width="110px;"/><br /><sub>subdriven</sub>](https://github.com/subdriven)<br />[💻](https://github.com/snipe/snipe-it/commits?author=subdriven "Code") | [<img src="https://avatars.githubusercontent.com/u/658865?v=4" width="110px;"/><br /><sub>Andrew Savinykh</sub>](https://github.com/AndrewSav)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AndrewSav "Code") | [<img src="https://avatars.githubusercontent.com/u/1155067?v=4" width="110px;"/><br /><sub>Tadayuki Onishi</sub>](https://kenchan0130.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=kenchan0130 "Code") | [<img src="https://avatars.githubusercontent.com/u/112496896?v=4" width="110px;"/><br /><sub>Florian</sub>](https://github.com/floschoepfer)<br />[💻](https://github.com/snipe/snipe-it/commits?author=floschoepfer "Code") |
147-
| [<img src="https://avatars.githubusercontent.com/u/7305753?v=4" width="110px;"/><br /><sub>Spencer Long</sub>](http://spencerlong.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=spencerrlongg "Code") | [<img src="https://avatars.githubusercontent.com/u/1141514?v=4" width="110px;"/><br /><sub>Marcus Moore</sub>](https://github.com/marcusmoore)<br />[💻](https://github.com/snipe/snipe-it/commits?author=marcusmoore "Code") | [<img src="https://avatars.githubusercontent.com/u/570639?v=4" width="110px;"/><br /><sub>Martin Meredith</sub>](https://github.com/Mezzle)<br /> |
147+
| [<img src="https://avatars.githubusercontent.com/u/7305753?v=4" width="110px;"/><br /><sub>Spencer Long</sub>](http://spencerlong.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=spencerrlongg "Code") | [<img src="https://avatars.githubusercontent.com/u/1141514?v=4" width="110px;"/><br /><sub>Marcus Moore</sub>](https://github.com/marcusmoore)<br />[💻](https://github.com/snipe/snipe-it/commits?author=marcusmoore "Code") | [<img src="https://avatars.githubusercontent.com/u/570639?v=4" width="110px;"/><br /><sub>Martin Meredith</sub>](https://github.com/Mezzle)<br /> | [<img src="https://avatars.githubusercontent.com/u/5731963?v=4" width="110px;"/><br /><sub>dboth</sub>](http://dboth.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dboth "Code") | [<img src="https://avatars.githubusercontent.com/u/87536651?v=4" width="110px;"/><br /><sub>Zachary Fleck</sub>](https://github.com/zacharyfleck)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zacharyfleck "Code") |
148148
<!-- ALL-CONTRIBUTORS-LIST:END -->
149149

150150
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

app/Console/Commands/CheckoutLicenseToAllUsers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function handle()
5656
return false;
5757
}
5858

59-
$users = User::whereNull('deleted_at')->where('autoassign_licenses', '==', 1)->with('licenses')->get();
59+
$users = User::whereNull('deleted_at')->where('autoassign_licenses', '=', 1)->with('licenses')->get();
6060

6161
if ($users->count() > $license->getAvailSeatsCountAttribute()) {
6262
$this->info('You do not have enough free seats to complete this task, so we will check out as many as we can. ');

app/Console/Commands/CreateAdmin.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ class CreateAdmin extends Command
2020
* @property string $password
2121
* @property boolean $activated
2222
* @property boolean $show_in_list
23+
* @property boolean $autoassign_licenses
2324
* @property \Illuminate\Support\Carbon|null $created_at
2425
* @property mixed $created_by
2526
*/
2627

2728

2829

29-
protected $signature = 'snipeit:create-admin {--first_name=} {--last_name=} {--email=} {--username=} {--password=} {show_in_list?}';
30+
protected $signature = 'snipeit:create-admin {--first_name=} {--last_name=} {--email=} {--username=} {--password=} {show_in_list?} {autoassign_licenses?}';
3031

3132
/**
3233
* The console command description.
@@ -54,6 +55,9 @@ public function handle()
5455
$email = $this->option('email');
5556
$password = $this->option('password');
5657
$show_in_list = $this->argument('show_in_list');
58+
$autoassign_licenses = $this->argument('autoassign_licenses');
59+
60+
5761

5862
if (($first_name == '') || ($last_name == '') || ($username == '') || ($email == '') || ($password == '')) {
5963
$this->info('ERROR: All fields are required.');
@@ -70,6 +74,11 @@ public function handle()
7074
if ($show_in_list == 'false') {
7175
$user->show_in_list = 0;
7276
}
77+
78+
if ($autoassign_licenses == 'false') {
79+
$user->autoassign_licenses = 0;
80+
}
81+
7382
if ($user->save()) {
7483
$this->info('New user created');
7584
$user->groups()->attach(1);

app/Console/Commands/LdapSync.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function handle()
6262
$ldap_result_phone = Setting::getSettings()->ldap_phone_field;
6363
$ldap_result_jobtitle = Setting::getSettings()->ldap_jobtitle;
6464
$ldap_result_country = Setting::getSettings()->ldap_country;
65+
$ldap_result_location = Setting::getSettings()->ldap_location;
6566
$ldap_result_dept = Setting::getSettings()->ldap_dept;
6667
$ldap_result_manager = Setting::getSettings()->ldap_manager;
6768
$ldap_default_group = Setting::getSettings()->ldap_default_group;
@@ -209,8 +210,11 @@ public function handle()
209210
$item['country'] = $results[$i][$ldap_result_country][0] ?? '';
210211
$item['department'] = $results[$i][$ldap_result_dept][0] ?? '';
211212
$item['manager'] = $results[$i][$ldap_result_manager][0] ?? '';
213+
$item['location'] = $results[$i][$ldap_result_location][0] ?? '';
212214

213-
215+
$location = Location::firstOrCreate([
216+
'name' => $item['location'],
217+
]);
214218
$department = Department::firstOrCreate([
215219
'name' => $item['department'],
216220
]);
@@ -236,6 +240,7 @@ public function handle()
236240
$user->jobtitle = $item['jobtitle'];
237241
$user->country = $item['country'];
238242
$user->department_id = $department->id;
243+
$user->location_id = $location->id;
239244

240245
if($item['manager'] != null) {
241246
// Check Cache first

app/Http/Controllers/Accessories/AccessoriesController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function store(ImageUploadRequest $request)
7777
$accessory->manufacturer_id = request('manufacturer_id');
7878
$accessory->model_number = request('model_number');
7979
$accessory->purchase_date = request('purchase_date');
80-
$accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
80+
$accessory->purchase_cost = request('purchase_cost');
8181
$accessory->qty = request('qty');
8282
$accessory->user_id = Auth::user()->id;
8383
$accessory->supplier_id = request('supplier_id');
@@ -180,7 +180,7 @@ public function update(ImageUploadRequest $request, $accessoryId = null)
180180
$accessory->order_number = request('order_number');
181181
$accessory->model_number = request('model_number');
182182
$accessory->purchase_date = request('purchase_date');
183-
$accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost'));
183+
$accessory->purchase_cost = request('purchase_cost');
184184
$accessory->qty = request('qty');
185185
$accessory->supplier_id = request('supplier_id');
186186
$accessory->notes = request('notes');

app/Http/Controllers/Api/AssetMaintenancesController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function store(Request $request)
118118
$assetMaintenance = new AssetMaintenance();
119119
$assetMaintenance->supplier_id = $request->input('supplier_id');
120120
$assetMaintenance->is_warranty = $request->input('is_warranty');
121-
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
121+
$assetMaintenance->cost = $request->input('cost');
122122
$assetMaintenance->notes = e($request->input('notes'));
123123
$asset = Asset::find(e($request->input('asset_id')));
124124

@@ -175,7 +175,7 @@ public function update(Request $request, $assetMaintenanceId = null)
175175

176176
$assetMaintenance->supplier_id = e($request->input('supplier_id'));
177177
$assetMaintenance->is_warranty = e($request->input('is_warranty'));
178-
$assetMaintenance->cost = Helper::ParseCurrency($request->input('cost'));
178+
$assetMaintenance->cost = $request->input('cost');
179179
$assetMaintenance->notes = e($request->input('notes'));
180180

181181
$asset = Asset::find(request('asset_id'));

app/Http/Controllers/Api/AssetsController.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,16 @@ public function store(ImageUploadRequest $request)
550550
$asset->depreciate = '0';
551551
$asset->status_id = $request->get('status_id', 0);
552552
$asset->warranty_months = $request->get('warranty_months', null);
553-
$asset->purchase_cost = Helper::ParseCurrency($request->get('purchase_cost')); // this is the API's store method, so I don't know that I want to do this? Confusing. FIXME (or not?!)
553+
$asset->purchase_cost = $request->get('purchase_cost');
554+
$asset->asset_eol_date = $request->get('asset_eol_date', $asset->present()->eol_date());
554555
$asset->purchase_date = $request->get('purchase_date', null);
555556
$asset->assigned_to = $request->get('assigned_to', null);
556557
$asset->supplier_id = $request->get('supplier_id');
557558
$asset->requestable = $request->get('requestable', 0);
558559
$asset->rtd_location_id = $request->get('rtd_location_id', null);
559560
$asset->location_id = $request->get('rtd_location_id', null);
560561

562+
561563
/**
562564
* this is here just legacy reasons. Api\AssetController
563565
* used image_source once to allow encoded image uploads.

app/Http/Controllers/Api/ManufacturersController.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class ManufacturersController extends Controller
2323
public function index(Request $request)
2424
{
2525
$this->authorize('view', Manufacturer::class);
26-
$allowed_columns = ['id', 'name', 'url', 'support_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'assets_count', 'consumables_count', 'components_count', 'licenses_count'];
26+
$allowed_columns = ['id', 'name', 'url', 'support_url', 'support_email', 'warranty_lookup_url', 'support_phone', 'created_at', 'updated_at', 'image', 'assets_count', 'consumables_count', 'components_count', 'licenses_count'];
2727

2828
$manufacturers = Manufacturer::select(
29-
['id', 'name', 'url', 'support_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'deleted_at']
29+
['id', 'name', 'url', 'support_url', 'warranty_lookup_url', 'support_email', 'support_phone', 'created_at', 'updated_at', 'image', 'deleted_at']
3030
)->withCount('assets as assets_count')->withCount('licenses as licenses_count')->withCount('consumables as consumables_count')->withCount('accessories as accessories_count');
3131

3232
if ($request->input('deleted') == 'true') {
@@ -49,6 +49,10 @@ public function index(Request $request)
4949
$manufacturers->where('support_url', '=', $request->input('support_url'));
5050
}
5151

52+
if ($request->filled('warranty_lookup_url')) {
53+
$manufacturers->where('warranty_lookup_url', '=', $request->input('warranty_lookup_url'));
54+
}
55+
5256
if ($request->filled('support_phone')) {
5357
$manufacturers->where('support_phone', '=', $request->input('support_phone'));
5458
}

app/Http/Controllers/Api/UsersController.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function index(Request $request)
7171
'users.start_date',
7272
'users.end_date',
7373
'users.vip',
74+
'users.autoassign_licenses',
7475

7576
])->with('manager', 'groups', 'userloc', 'company', 'department', 'assets', 'licenses', 'accessories', 'consumables', 'createdBy',)
7677
->withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count');
@@ -187,6 +188,10 @@ public function index(Request $request)
187188
$users->has('accessories', '=', $request->input('accessories_count'));
188189
}
189190

191+
if ($request->filled('autoassign_licenses')) {
192+
$users->where('autoassign_licenses', '=', $request->input('autoassign_licenses'));
193+
}
194+
190195
if ($request->filled('search')) {
191196
$users = $users->TextSearch($request->input('search'));
192197
}
@@ -259,6 +264,7 @@ public function index(Request $request)
259264
'vip',
260265
'start_date',
261266
'end_date',
267+
'autoassign_licenses',
262268
];
263269

264270
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
@@ -356,7 +362,7 @@ public function store(SaveUserRequest $request)
356362
$user->permissions = $permissions_array;
357363
}
358364

359-
$tmp_pass = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 20);
365+
$tmp_pass = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 40);
360366
$user->password = bcrypt($request->get('password', $tmp_pass));
361367

362368
app('App\Http\Requests\ImageUploadRequest')->handleImages($user, 600, 'image', 'avatars', 'avatar');

0 commit comments

Comments
 (0)