Skip to content

Commit 6cc2013

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 5ac6caf + 39ce7b7 commit 6cc2013

File tree

6 files changed

+42
-32
lines changed

6 files changed

+42
-32
lines changed

app/Listeners/CheckoutableListener.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ public function onCheckedOut($event)
106106
}
107107
}
108108
} catch (ClientException $e) {
109-
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
109+
if (strpos($e->getMessage(), 'channel_not_found') !== false) {
110+
Log::warning(Setting::getSettings()->webhook_selected." notification failed: " . $e->getMessage());
111+
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_channel_not_found') );
112+
}
113+
else {
114+
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
115+
}
110116
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail') );
111117
} catch (Exception $e) {
112118
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
@@ -156,7 +162,7 @@ public function onCheckedIn($event)
156162
$ccEmails = array_filter($adminCcEmailsArray);
157163
$mailable = $this->getCheckinMailType($event);
158164
$notifiable = $this->getNotifiables($event);
159-
if ($event->checkedOutTo->locale){
165+
if ($event->checkedOutTo?->locale) {
160166
$mailable->locale($event->checkedOutTo->locale);
161167
}
162168
// Send email notifications
@@ -196,8 +202,14 @@ public function onCheckedIn($event)
196202
}
197203
}
198204
} catch (ClientException $e) {
199-
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
200-
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail'));
205+
if (strpos($e->getMessage(), 'channel_not_found') !== false) {
206+
Log::warning(Setting::getSettings()->webhook_selected." notification failed: " . $e->getMessage());
207+
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_channel_not_found') );
208+
}
209+
else {
210+
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
211+
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail'));
212+
}
201213
} catch (Exception $e) {
202214
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
203215
'error' => $e->getMessage(),

app/Observers/AssetObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function updating(Asset $asset)
4848
$changed = [];
4949

5050
foreach ($asset->getRawOriginal() as $key => $value) {
51-
if ($asset->getRawOriginal()[$key] != $asset->getAttributes()[$key]) {
51+
if ((array_key_exists($key, $asset->getAttributes())) && ($asset->getRawOriginal()[$key] != $asset->getAttributes()[$key])) {
5252
$changed[$key]['old'] = $asset->getRawOriginal()[$key];
5353
$changed[$key]['new'] = $asset->getAttributes()[$key];
5454
}

app/View/Label.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,9 @@ public function render(callable $callback = null)
116116
}
117117
}
118118

119-
if ($template->getSupport2DBarcode()) {
119+
if ($template->getSupport2DBarcode()) {
120120
$barcode2DType = $settings->label2_2d_type;
121-
$barcode2DType = ($barcode2DType == 'default') ?
122-
$settings->barcode_type :
123-
$barcode2DType;
124-
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
121+
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
125122
switch ($settings->label2_2d_target) {
126123
case 'ht_tag':
127124
$barcode2DTarget = route('ht/assetTag', $asset->asset_tag);

resources/lang/en-US/admin/settings/message.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
'error_redirect' => 'ERROR: 301/302 :endpoint returns a redirect. For security reasons, we don’t follow redirects. Please use the actual endpoint.',
4747
'error_misc' => 'Something went wrong. :( ',
4848
'webhook_fail' => ' webhook notification failed: Check to make sure the URL is still valid.',
49+
'webhook_channel_not_found' => ' webhook channel not found.'
4950
]
5051
];

resources/views/settings/backups.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</a>
1313

1414
<form method="POST" style="display: inline">
15-
{{ Form::hidden('_token', csrf_token()) }}
15+
@csrf
1616
<button class="btn btn-primary {{ (config('app.lock_passwords')) ? ' disabled': '' }}">{{ trans('admin/settings/general.generate_backup') }}</button>
1717
</form>
1818

resources/views/settings/labels.blade.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -308,31 +308,31 @@ class="table table-striped snipe-table"
308308
@else
309309

310310
<!-- Hidden version of new settings -->
311-
{{ Form::hidden('label2_template', old('label2_template', $setting->label2_template)) }}
312-
{{ Form::hidden('label2_title', old('label2_title', $setting->label2_title)) }}
313-
{{ Form::hidden('label2_asset_logo', old('label2_asset_logo', $setting->label2_asset_logo)) }}
314-
{{ Form::hidden('label2_fields', old('label2_fields', $setting->label2_fields)) }}
311+
<input name="label2_template" type="hidden" value="{{ old('label2_template', $setting->label2_template) }}" />
312+
<input name="label2_title" type="hidden" value="{{ old('label2_title', $setting->label2_title) }}" />
313+
<input name="label2_asset_logo" type="hidden" value="{{ old('label2_asset_logo', $setting->label2_asset_logo) }}" />
314+
<input name="label2_fields" type="hidden" value="{{ old('label2_fields', $setting->label2_fields) }}" />
315315
@endif
316316

317317
@if ($setting->label2_enable && ($setting->label2_template != 'DefaultLabel'))
318318
<!-- Hidden version of legacy settings -->
319-
{{ Form::hidden('labels_per_page', old('labels_per_page', $setting->labels_per_page)) }}
320-
{{ Form::hidden('labels_fontsize', old('labels_fontsize', $setting->labels_fontsize)) }}
321-
{{ Form::hidden('labels_width', old('labels_width', $setting->labels_width)) }}
322-
{{ Form::hidden('labels_height', old('labels_height', $setting->labels_height)) }}
323-
{{ Form::hidden('labels_display_sgutter', old('labels_display_sgutter', $setting->labels_display_sgutter)) }}
324-
{{ Form::hidden('labels_display_bgutter', old('labels_display_bgutter', $setting->labels_display_bgutter)) }}
325-
{{ Form::hidden('labels_pmargin_top', old('labels_pmargin_top', $setting->labels_pmargin_top)) }}
326-
{{ Form::hidden('labels_pmargin_bottom', old('labels_pmargin_bottom', $setting->labels_pmargin_bottom)) }}
327-
{{ Form::hidden('labels_pmargin_left', old('labels_pmargin_left', $setting->labels_pmargin_left)) }}
328-
{{ Form::hidden('labels_pmargin_right', old('labels_pmargin_right', $setting->labels_pmargin_right)) }}
329-
{{ Form::hidden('labels_pagewidth', old('labels_pagewidth', $setting->labels_pagewidth)) }}
330-
{{ Form::hidden('labels_pageheight', old('labels_pageheight', $setting->labels_pageheight)) }}
331-
{{ Form::hidden('labels_display_name', old('labels_display_name', $setting->labels_display_name)) }}
332-
{{ Form::hidden('labels_display_serial', old('labels_display_serial', $setting->labels_display_serial)) }}
333-
{{ Form::hidden('labels_display_tag', old('labels_display_tag', $setting->labels_display_tag)) }}
334-
{{ Form::hidden('labels_display_model', old('labels_display_model', $setting->labels_display_model)) }}
335-
{{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }}
319+
<input name="labels_per_page" type="hidden" value="{{ old('labels_per_page', $setting->labels_per_page) }}" />
320+
<input name="labels_fontsize" type="hidden" value="{{ old('labels_fontsize', $setting->labels_fontsize) }}" />
321+
<input name="labels_width" type="hidden" value="{{ old('labels_width', $setting->labels_width) }}" />
322+
<input name="labels_height" type="hidden" value="{{ old('labels_height', $setting->labels_height) }}" />
323+
<input name="labels_display_sgutter" type="hidden" value="{{ old('labels_display_sgutter', $setting->labels_display_sgutter) }}" />
324+
<input name="labels_display_bgutter" type="hidden" value="{{ old('labels_display_bgutter', $setting->labels_display_bgutter) }}" />
325+
<input name="labels_pmargin_top" type="hidden" value="{{ old('labels_pmargin_top', $setting->labels_pmargin_top) }}" />
326+
<input name="labels_pmargin_bottom" type="hidden" value="{{ old('labels_pmargin_bottom', $setting->labels_pmargin_bottom) }}" />
327+
<input name="labels_pmargin_left" type="hidden" value="{{ old('labels_pmargin_left', $setting->labels_pmargin_left) }}" />
328+
<input name="labels_pmargin_right" type="hidden" value="{{ old('labels_pmargin_right', $setting->labels_pmargin_right) }}" />
329+
<input name="labels_pagewidth" type="hidden" value="{{ old('labels_pagewidth', $setting->labels_pagewidth) }}" />
330+
<input name="labels_pageheight" type="hidden" value="{{ old('labels_pageheight', $setting->labels_pageheight) }}" />
331+
<input name="labels_display_name" type="hidden" value="{{ old('labels_display_name', $setting->labels_display_name) }}" />
332+
<input name="labels_display_serial" type="hidden" value="{{ old('labels_display_serial', $setting->labels_display_serial) }}" />
333+
<input name="labels_display_tag" type="hidden" value="{{ old('labels_display_tag', $setting->labels_display_tag) }}" />
334+
<input name="labels_display_model" type="hidden" value="{{ old('labels_display_model', $setting->labels_display_model) }}" />
335+
<input name="labels_display_company_name" type="hidden" value="{{ old('labels_display_company_name', $setting->labels_display_company_name) }}" />
336336
@else
337337
<!-- Legacy settings -->
338338
<style>

0 commit comments

Comments
 (0)