Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2025-02-04 21:39:27 +00:00
commit 6cc2013102
6 changed files with 42 additions and 32 deletions

View file

@ -106,7 +106,13 @@ class CheckoutableListener
} }
} }
} catch (ClientException $e) { } catch (ClientException $e) {
Log::error("ClientException caught during checkin notification: " . $e->getMessage()); if (strpos($e->getMessage(), 'channel_not_found') !== false) {
Log::warning(Setting::getSettings()->webhook_selected." notification failed: " . $e->getMessage());
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_channel_not_found') );
}
else {
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
}
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail') ); return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail') );
} catch (Exception $e) { } catch (Exception $e) {
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
@ -156,7 +162,7 @@ class CheckoutableListener
$ccEmails = array_filter($adminCcEmailsArray); $ccEmails = array_filter($adminCcEmailsArray);
$mailable = $this->getCheckinMailType($event); $mailable = $this->getCheckinMailType($event);
$notifiable = $this->getNotifiables($event); $notifiable = $this->getNotifiables($event);
if ($event->checkedOutTo->locale){ if ($event->checkedOutTo?->locale) {
$mailable->locale($event->checkedOutTo->locale); $mailable->locale($event->checkedOutTo->locale);
} }
// Send email notifications // Send email notifications
@ -196,8 +202,14 @@ class CheckoutableListener
} }
} }
} catch (ClientException $e) { } catch (ClientException $e) {
Log::error("ClientException caught during checkin notification: " . $e->getMessage()); if (strpos($e->getMessage(), 'channel_not_found') !== false) {
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail')); Log::warning(Setting::getSettings()->webhook_selected." notification failed: " . $e->getMessage());
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_channel_not_found') );
}
else {
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail'));
}
} catch (Exception $e) { } catch (Exception $e) {
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
'error' => $e->getMessage(), 'error' => $e->getMessage(),

View file

@ -48,7 +48,7 @@ class AssetObserver
$changed = []; $changed = [];
foreach ($asset->getRawOriginal() as $key => $value) { foreach ($asset->getRawOriginal() as $key => $value) {
if ($asset->getRawOriginal()[$key] != $asset->getAttributes()[$key]) { if ((array_key_exists($key, $asset->getAttributes())) && ($asset->getRawOriginal()[$key] != $asset->getAttributes()[$key])) {
$changed[$key]['old'] = $asset->getRawOriginal()[$key]; $changed[$key]['old'] = $asset->getRawOriginal()[$key];
$changed[$key]['new'] = $asset->getAttributes()[$key]; $changed[$key]['new'] = $asset->getAttributes()[$key];
} }

View file

@ -116,12 +116,9 @@ class Label implements View
} }
} }
if ($template->getSupport2DBarcode()) { if ($template->getSupport2DBarcode()) {
$barcode2DType = $settings->label2_2d_type; $barcode2DType = $settings->label2_2d_type;
$barcode2DType = ($barcode2DType == 'default') ? if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
$settings->barcode_type :
$barcode2DType;
if (($barcode2DType != 'none') && (!is_null($barcode2DType))) {
switch ($settings->label2_2d_target) { switch ($settings->label2_2d_target) {
case 'ht_tag': case 'ht_tag':
$barcode2DTarget = route('ht/assetTag', $asset->asset_tag); $barcode2DTarget = route('ht/assetTag', $asset->asset_tag);

View file

@ -46,5 +46,6 @@ return [
'error_redirect' => 'ERROR: 301/302 :endpoint returns a redirect. For security reasons, we dont follow redirects. Please use the actual endpoint.', 'error_redirect' => 'ERROR: 301/302 :endpoint returns a redirect. For security reasons, we dont follow redirects. Please use the actual endpoint.',
'error_misc' => 'Something went wrong. :( ', 'error_misc' => 'Something went wrong. :( ',
'webhook_fail' => ' webhook notification failed: Check to make sure the URL is still valid.', 'webhook_fail' => ' webhook notification failed: Check to make sure the URL is still valid.',
'webhook_channel_not_found' => ' webhook channel not found.'
] ]
]; ];

View file

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

View file

@ -308,31 +308,31 @@
@else @else
<!-- Hidden version of new settings --> <!-- Hidden version of new settings -->
{{ Form::hidden('label2_template', old('label2_template', $setting->label2_template)) }} <input name="label2_template" type="hidden" value="{{ old('label2_template', $setting->label2_template) }}" />
{{ Form::hidden('label2_title', old('label2_title', $setting->label2_title)) }} <input name="label2_title" type="hidden" value="{{ old('label2_title', $setting->label2_title) }}" />
{{ Form::hidden('label2_asset_logo', old('label2_asset_logo', $setting->label2_asset_logo)) }} <input name="label2_asset_logo" type="hidden" value="{{ old('label2_asset_logo', $setting->label2_asset_logo) }}" />
{{ Form::hidden('label2_fields', old('label2_fields', $setting->label2_fields)) }} <input name="label2_fields" type="hidden" value="{{ old('label2_fields', $setting->label2_fields) }}" />
@endif @endif
@if ($setting->label2_enable && ($setting->label2_template != 'DefaultLabel')) @if ($setting->label2_enable && ($setting->label2_template != 'DefaultLabel'))
<!-- Hidden version of legacy settings --> <!-- Hidden version of legacy settings -->
{{ Form::hidden('labels_per_page', old('labels_per_page', $setting->labels_per_page)) }} <input name="labels_per_page" type="hidden" value="{{ old('labels_per_page', $setting->labels_per_page) }}" />
{{ Form::hidden('labels_fontsize', old('labels_fontsize', $setting->labels_fontsize)) }} <input name="labels_fontsize" type="hidden" value="{{ old('labels_fontsize', $setting->labels_fontsize) }}" />
{{ Form::hidden('labels_width', old('labels_width', $setting->labels_width)) }} <input name="labels_width" type="hidden" value="{{ old('labels_width', $setting->labels_width) }}" />
{{ Form::hidden('labels_height', old('labels_height', $setting->labels_height)) }} <input name="labels_height" type="hidden" value="{{ old('labels_height', $setting->labels_height) }}" />
{{ Form::hidden('labels_display_sgutter', old('labels_display_sgutter', $setting->labels_display_sgutter)) }} <input name="labels_display_sgutter" type="hidden" value="{{ old('labels_display_sgutter', $setting->labels_display_sgutter) }}" />
{{ Form::hidden('labels_display_bgutter', old('labels_display_bgutter', $setting->labels_display_bgutter)) }} <input name="labels_display_bgutter" type="hidden" value="{{ old('labels_display_bgutter', $setting->labels_display_bgutter) }}" />
{{ Form::hidden('labels_pmargin_top', old('labels_pmargin_top', $setting->labels_pmargin_top)) }} <input name="labels_pmargin_top" type="hidden" value="{{ old('labels_pmargin_top', $setting->labels_pmargin_top) }}" />
{{ Form::hidden('labels_pmargin_bottom', old('labels_pmargin_bottom', $setting->labels_pmargin_bottom)) }} <input name="labels_pmargin_bottom" type="hidden" value="{{ old('labels_pmargin_bottom', $setting->labels_pmargin_bottom) }}" />
{{ Form::hidden('labels_pmargin_left', old('labels_pmargin_left', $setting->labels_pmargin_left)) }} <input name="labels_pmargin_left" type="hidden" value="{{ old('labels_pmargin_left', $setting->labels_pmargin_left) }}" />
{{ Form::hidden('labels_pmargin_right', old('labels_pmargin_right', $setting->labels_pmargin_right)) }} <input name="labels_pmargin_right" type="hidden" value="{{ old('labels_pmargin_right', $setting->labels_pmargin_right) }}" />
{{ Form::hidden('labels_pagewidth', old('labels_pagewidth', $setting->labels_pagewidth)) }} <input name="labels_pagewidth" type="hidden" value="{{ old('labels_pagewidth', $setting->labels_pagewidth) }}" />
{{ Form::hidden('labels_pageheight', old('labels_pageheight', $setting->labels_pageheight)) }} <input name="labels_pageheight" type="hidden" value="{{ old('labels_pageheight', $setting->labels_pageheight) }}" />
{{ Form::hidden('labels_display_name', old('labels_display_name', $setting->labels_display_name)) }} <input name="labels_display_name" type="hidden" value="{{ old('labels_display_name', $setting->labels_display_name) }}" />
{{ Form::hidden('labels_display_serial', old('labels_display_serial', $setting->labels_display_serial)) }} <input name="labels_display_serial" type="hidden" value="{{ old('labels_display_serial', $setting->labels_display_serial) }}" />
{{ Form::hidden('labels_display_tag', old('labels_display_tag', $setting->labels_display_tag)) }} <input name="labels_display_tag" type="hidden" value="{{ old('labels_display_tag', $setting->labels_display_tag) }}" />
{{ Form::hidden('labels_display_model', old('labels_display_model', $setting->labels_display_model)) }} <input name="labels_display_model" type="hidden" value="{{ old('labels_display_model', $setting->labels_display_model) }}" />
{{ Form::hidden('labels_display_company_name', old('labels_display_company_name', $setting->labels_display_company_name)) }} <input name="labels_display_company_name" type="hidden" value="{{ old('labels_display_company_name', $setting->labels_display_company_name) }}" />
@else @else
<!-- Legacy settings --> <!-- Legacy settings -->
<style> <style>