Merge remote-tracking branch 'origin/develop'
This commit is contained in:
@@ -799,12 +799,11 @@ class ReportsController extends Controller
|
||||
$checkout_start = Carbon::parse($request->input('checkout_date_start'))->startOfDay();
|
||||
$checkout_end = Carbon::parse($request->input('checkout_date_end', now()))->endOfDay();
|
||||
|
||||
$actionlogassets = Actionlog::where('action_type', '=', 'checkout')
|
||||
->where('item_type', 'LIKE', '%Asset%')
|
||||
->whereBetween('action_date', [$checkout_start, $checkout_end])
|
||||
->pluck('item_id');
|
||||
$actionlogassets = Actionlog::select('id')->where('action_type', '=', 'checkout')
|
||||
->where('item_type', '=', Asset::class)
|
||||
->whereBetween('action_date', [$checkout_start, $checkout_end]); // we are *not* doing ->get()...
|
||||
|
||||
$assets->whereIn('assets.id', $actionlogassets);
|
||||
$assets->whereIn('id', $actionlogassets); //...because this _should_ act as a 'subquery'
|
||||
}
|
||||
|
||||
if (($request->filled('checkin_date_start'))) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models\Labels;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\User;
|
||||
|
||||
class FieldOption
|
||||
{
|
||||
@@ -27,22 +28,19 @@ class FieldOption
|
||||
// assignedTo directly on the asset is a special case where
|
||||
// we want to avoid returning the property directly
|
||||
// and instead return the entity's presented name.
|
||||
if ($dataPath[0] === 'assignedTo') {
|
||||
if ($asset->relationLoaded('assignedTo')) {
|
||||
// If the "assignedTo" relationship was eager loaded then the way to get the
|
||||
// relationship changes from $asset->assignedTo to $asset->assigned.
|
||||
return $asset->assigned ? $asset->assigned->full_name : null;
|
||||
if (in_array($dataPath[0], ['assignedTo', 'displayName'])) {
|
||||
$assigned = $asset->relationLoaded('assignedTo') ? $asset->assigned : $asset->assignedTo;
|
||||
|
||||
if (!$assigned) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $asset->assignedTo ? $asset->assignedTo->full_name : null;
|
||||
}
|
||||
if ($dataPath[0] === 'displayName') {
|
||||
if ($asset->relationLoaded('assignedTo')) {
|
||||
|
||||
return $asset->assigned ? $asset->assigned->display_name : null;
|
||||
if ($dataPath[0] === 'displayName') {
|
||||
return $assigned->getRawOriginal('display_name') ?? $assigned->display_name;
|
||||
}
|
||||
|
||||
return $asset->assignedTo ? $asset->assignedTo->display_name : null;
|
||||
if ($assigned instanceof User) {
|
||||
return $assigned->full_name;
|
||||
}
|
||||
return $assigned->name ?? $assigned->display_name ?? null;
|
||||
}
|
||||
|
||||
// Handle Laravel's stupid Carbon datetime casting
|
||||
|
||||
@@ -449,7 +449,7 @@ trait Loggable
|
||||
|
||||
} catch (ServerException $e) {
|
||||
|
||||
Log::error('Teams webhook server error', [
|
||||
Log::warning('Teams webhook server error', [
|
||||
'endpoint' => $endpoint,
|
||||
'status' => $e->getResponse()?->getStatusCode(),
|
||||
'error' => $e->getMessage(),
|
||||
@@ -464,19 +464,28 @@ trait Loggable
|
||||
]);
|
||||
} catch (RequestException $e) {
|
||||
|
||||
Log::error('Teams webhook request failure', [
|
||||
Log::warning('Teams webhook request failure', [
|
||||
'endpoint' => $endpoint,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
Log::error('Teams webhook failed unexpectedly', [
|
||||
Log::warning('Teams webhook failed unexpectedly', [
|
||||
'endpoint' => $endpoint,
|
||||
'exception' => get_class($e),
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
Setting::getSettings()->notify(new AuditNotification($params));
|
||||
try {
|
||||
Setting::getSettings()->notify(new AuditNotification($params));
|
||||
} catch (Throwable $e) {
|
||||
Log::warning('Audit webhook notification failed', [
|
||||
'endpoint' => Setting::getSettings()->webhook_endpoint,
|
||||
'channel' => Setting::getSettings()->webhook_selected,
|
||||
'exception' => get_class($e),
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $log;
|
||||
|
||||
Reference in New Issue
Block a user