Skip to content

Commit ee85a39

Browse files
authored
Merge pull request #16316 from snipe/v8_final_merge
V8 final merge
2 parents 0501c5f + 6c2d367 commit ee85a39

File tree

1,002 files changed

+286860
-4952
lines changed

Some content is hidden

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

1,002 files changed

+286860
-4952
lines changed

.github/workflows/tests-mysql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
php-version:
28-
- "8.1"
2928
- "8.2"
3029
- "8.3"
30+
- "8.4"
3131

3232
name: PHP ${{ matrix.php-version }}
3333

.github/workflows/tests-postgres.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
php-version:
24-
- "8.1"
2524
- "8.2"
2625
- "8.3"
26+
- "8.4"
27+
2728

2829
name: PHP ${{ matrix.php-version }}
2930

.github/workflows/tests-sqlite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
php-version:
18-
- "8.1.1"
18+
- "8.3"
1919

2020
name: PHP ${{ matrix.php-version }}
2121

.upgrade_requirements.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"DOC3": "Please don't rely on these versions for planning upgrades unless you've fetched the most recent version",
55
"DOC4": "You should really just ignore it and run upgrade.php. Really",
66
"php_min_version": "8.1.0",
7-
"php_max_major_minor": "8.3",
8-
"php_max_wontwork": "8.4.0",
9-
"current_snipeit_version": "7.0"
7+
"php_max_major_minor": "8.4",
8+
"php_max_wontwork": "8.5.0",
9+
"current_snipeit_version": "8.0"
1010
}

Dockerfile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22
LABEL maintainer="Brady Wetherington <[email protected]>"
33

44
# No need to add `apt-get clean` here, reference:
@@ -14,16 +14,16 @@ RUN export DEBIAN_FRONTEND=noninteractive; \
1414
apt-utils \
1515
apache2 \
1616
apache2-bin \
17-
libapache2-mod-php8.1 \
18-
php8.1-curl \
19-
php8.1-ldap \
20-
php8.1-mysql \
21-
php8.1-gd \
22-
php8.1-xml \
23-
php8.1-mbstring \
24-
php8.1-zip \
25-
php8.1-bcmath \
26-
php8.1-redis \
17+
libapache2-mod-php8.3 \
18+
php8.3-curl \
19+
php8.3-ldap \
20+
php8.3-mysql \
21+
php8.3-gd \
22+
php8.3-xml \
23+
php8.3-mbstring \
24+
php8.3-zip \
25+
php8.3-bcmath \
26+
php8.3-redis \
2727
php-memcached \
2828
patch \
2929
curl \
@@ -41,7 +41,7 @@ libc-dev \
4141
libldap-common \
4242
pkg-config \
4343
libmcrypt-dev \
44-
php8.1-dev \
44+
php8.3-dev \
4545
ca-certificates \
4646
unzip \
4747
dnsutils \
@@ -53,16 +53,16 @@ RUN php go-pear.phar
5353

5454
RUN pecl install mcrypt
5555

56-
RUN bash -c "echo extension=/usr/lib/php/20210902/mcrypt.so > /etc/php/8.1/mods-available/mcrypt.ini"
56+
RUN bash -c "echo extension=/usr/lib/php/20210902/mcrypt.so > /etc/php/8.3/mods-available/mcrypt.ini"
5757

5858
RUN phpenmod mcrypt
5959
RUN phpenmod gd
6060
RUN phpenmod bcmath
6161

62-
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/8.1/apache2/php.ini
63-
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/8.1/cli/php.ini
62+
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/8.3/apache2/php.ini
63+
RUN sed -i 's/variables_order = .*/variables_order = "EGPCS"/' /etc/php/8.3/cli/php.ini
6464

65-
RUN useradd -m --uid 1000 --gid 50 docker
65+
RUN useradd -m --uid 10000 --gid 50 docker
6666

6767
RUN echo export APACHE_RUN_USER=docker >> /etc/apache2/envvars
6868
RUN echo export APACHE_RUN_GROUP=staff >> /etc/apache2/envvars

app/Events/NoteAdded.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

app/Exceptions/Handler.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,27 @@ public function render($request, Throwable $e)
122122
}
123123

124124

125+
// This is traaaaash but it handles models that are not found while using route model binding :(
126+
// The only alternative is to set that at *each* route, which is crazypants
127+
if ($e instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
128+
$model_name = last(explode('\\', $e->getModel()));
129+
$route = str_plural(strtolower(last(explode('\\', $e->getModel())))).'.index';
130+
131+
// Sigh.
132+
if ($route == 'assets.index') {
133+
$route = 'hardware.index';
134+
} elseif ($route == 'reporttemplates.index') {
135+
$route = 'reports/custom';
136+
} elseif ($route == 'assetmodels.index') {
137+
$route = 'models.index';
138+
} elseif ($route == 'predefinedkits.index') {
139+
$route = 'kits.index';
140+
}
141+
142+
return redirect()
143+
->route($route)
144+
->withError(trans('general.generic_model_not_found', ['model' => $model_name]));
145+
}
125146

126147

127148
if ($this->isHttpException($e) && (isset($statusCode)) && ($statusCode == '404' )) {

app/Helpers/Helper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,11 +1520,11 @@ static public function getRedirectOption($request, $id, $table, $item_id = null)
15201520
if ($redirect_option == 'target') {
15211521
switch ($checkout_to_type) {
15221522
case 'user':
1523-
return route('users.show', ['user' => $request->assigned_user]);
1523+
return route('users.show', $request->assigned_user);
15241524
case 'location':
1525-
return route('locations.show', ['location' => $request->assigned_location]);
1525+
return route('locations.show', $request->assigned_location);
15261526
case 'asset':
1527-
return route('hardware.show', ['hardware' => $request->assigned_asset]);
1527+
return route('hardware.show', $request->assigned_asset);
15281528
}
15291529
}
15301530
return redirect()->back()->with('error', trans('admin/hardware/message.checkout.error'));

app/Helpers/IconHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public static function icon($type) {
5959
return 'fas fa-cog';
6060
case 'angle-left':
6161
return 'fas fa-angle-left';
62+
case 'angle-right':
63+
return 'fas fa-angle-right';
6264
case 'warning':
6365
return 'fas fa-exclamation-triangle';
6466
case 'kits':
@@ -184,6 +186,8 @@ public static function icon($type) {
184186
return 'fa-regular fa-id-card';
185187
case 'department' :
186188
return 'fa-solid fa-building-user';
189+
case 'home' :
190+
return 'fa-solid fa-house';
187191
case 'note':
188192
case 'notes':
189193
return 'fas fa-sticky-note';

app/Http/Controllers/Accessories/AccessoriesController.php

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,10 @@ public function store(ImageUploadRequest $request) : RedirectResponse
9595
* @author [A. Gianotto] [<[email protected]>]
9696
* @param int $accessoryId
9797
*/
98-
public function edit($accessoryId = null) : View | RedirectResponse
98+
public function edit(Accessory $accessory) : View | RedirectResponse
9999
{
100-
101-
if ($item = Accessory::find($accessoryId)) {
102-
$this->authorize($item);
103-
return view('accessories.edit', compact('item'))->with('category_type', 'accessory');
104-
}
105-
106-
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist'));
107-
100+
$this->authorize('update', Accessory::class);
101+
return view('accessories.edit')->with('item', $accessory)->with('category_type', 'accessory');
108102
}
109103

110104
/**
@@ -114,19 +108,12 @@ public function edit($accessoryId = null) : View | RedirectResponse
114108
* @param int $accessoryId
115109
* @since [v6.0]
116110
*/
117-
public function getClone($accessoryId = null) : View | RedirectResponse
111+
public function getClone(Accessory $accessory) : View | RedirectResponse
118112
{
119113

120114
$this->authorize('create', Accessory::class);
121115

122-
// Check if the asset exists
123-
if (is_null($accessory_to_clone = Accessory::find($accessoryId))) {
124-
// Redirect to the asset management page
125-
return redirect()->route('accessories.index')
126-
->with('error', trans('admin/accessories/message.does_not_exist', ['id' => $accessoryId]));
127-
}
128-
129-
$accessory = clone $accessory_to_clone;
116+
$accessory = clone $accessory;
130117
$accessory->id = null;
131118
$accessory->location_id = null;
132119

@@ -142,9 +129,9 @@ public function getClone($accessoryId = null) : View | RedirectResponse
142129
* @param ImageUploadRequest $request
143130
* @param int $accessoryId
144131
*/
145-
public function update(ImageUploadRequest $request, $accessoryId = null) : RedirectResponse
132+
public function update(ImageUploadRequest $request, Accessory $accessory) : RedirectResponse
146133
{
147-
if ($accessory = Accessory::withCount('checkouts as checkouts_count')->find($accessoryId)) {
134+
if ($accessory = Accessory::withCount('checkouts as checkouts_count')->find($accessory->id)) {
148135

149136
$this->authorize($accessory);
150137

@@ -231,14 +218,10 @@ public function destroy($accessoryId) : RedirectResponse
231218
* @see AccessoriesController::getDataView() method that generates the JSON response
232219
* @since [v1.0]
233220
*/
234-
public function show($accessoryID = null) : View | RedirectResponse
221+
public function show(Accessory $accessory) : View | RedirectResponse
235222
{
236-
$accessory = Accessory::withCount('checkouts as checkouts_count')->find($accessoryID);
223+
$accessory = Accessory::withCount('checkouts as checkouts_count')->find($accessory->id);
237224
$this->authorize('view', $accessory);
238-
if (isset($accessory->id)) {
239-
return view('accessories.view', compact('accessory'));
240-
}
241-
242-
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist', ['id' => $accessoryID]));
225+
return view('accessories.view', compact('accessory'));
243226
}
244227
}

0 commit comments

Comments
 (0)