Merge pull request #13756 from spencerrlongg/bug/label_logo_fix

Fixed #13652 - Labels Using Wrong Logo
This commit is contained in:
snipe 2023-10-17 19:45:20 +01:00 committed by GitHub
commit 3e54a9d561
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View file

@ -92,6 +92,10 @@ class Setting extends Model
'google_client_secret',
];
protected $casts = [
'label2_asset_logo' => 'boolean',
];
/**
* Get the app settings.
* Cache is expired on Setting model saved in EventServiceProvider.

View file

@ -103,19 +103,12 @@ class Label implements View
$logo = null;
// Should we be trying to use a logo at all?
if ($settings->label2_asset_logo='1') {
// If we don't have a company image, fall back to the general site label image
if (!empty($settings->label_logo)) {
$logo = Storage::disk('public')->path('/'.e($settings->label_logo));
}
// If we have a company logo, use that first
if (($asset->company) && ($asset->company->image!='')) {
$logo = Storage::disk('public')->path('companies/'.e($asset->company->image));
}
// Should we use the assets assigned company logo? (A.K.A. "Is `Labels > Use Asset Logo` enabled?"), and do we have a company logo?
if ($settings->label2_asset_logo && $asset->company && $asset->company->image!='') {
$logo = Storage::disk('public')->path('companies/'.e($asset->company->image));
} elseif (!empty($settings->label_logo)) {
// Use the general site label logo, if available
$logo = Storage::disk('public')->path('/'.e($settings->label_logo));
}
if (!empty($logo)) {