Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Oct 17, 2023
2 parents 73ec849 + f2bc7d6 commit a6d3886
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 3 additions & 1 deletion app/Importer/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,11 @@ protected function createOrFetchUser($row, $type = 'user')
$user_array['email'] = User::generateEmailFromFullName($user_array['full_name']);
}

// Get some variables for $user_formatted_array in case we need them later
$user_formatted_array = User::generateFormattedNameFromFullName($user_array['full_name'], Setting::getSettings()->username_format);

if (empty($user_array['first_name'])) {
// Get some fields for first name and last name based off of full name
$user_formatted_array = User::generateFormattedNameFromFullName($user_array['full_name'], Setting::getSettings()->username_format);
$user_array['first_name'] = $user_formatted_array['first_name'];
$user_array['last_name'] = $user_formatted_array['last_name'];
}
Expand Down
4 changes: 4 additions & 0 deletions app/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 6 additions & 13 deletions app/View/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,12 @@ public function render(callable $callback = null)

$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)) {
Expand Down

0 comments on commit a6d3886

Please sign in to comment.