diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 0811e9ee57..5524de9cec 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -115,7 +115,7 @@ class CheckoutableListener } return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail') ); } catch (Exception $e) { - Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ + Log::warning(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ 'error' => $e->getMessage(), 'webhook_endpoint' => Setting::getSettings()->webhook_endpoint, 'event' => $event, @@ -211,7 +211,7 @@ class CheckoutableListener return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail')); } } catch (Exception $e) { - Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ + Log::warning(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ 'error' => $e->getMessage(), 'webhook_endpoint' => Setting::getSettings()->webhook_endpoint, 'event' => $event, diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index 31d9b74bbf..a14910208e 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -293,16 +293,22 @@ class Actionlog extends SnipeModel public function daysUntilNextAudit($monthInterval = 12, $asset = null) { $now = Carbon::now(); - $last_audit_date = $this->created_at; - $next_audit = $last_audit_date->addMonth($monthInterval); - $next_audit_days = $now->diffInDays($next_audit); + $last_audit_date = $this->created_at; // this is the action log's created at, not the asset itself + $next_audit = $last_audit_date->addMonth($monthInterval); // this actually *modifies* the $last_audit_date + $next_audit_days = round($now->diffInDays($next_audit, true)); + $override_default_next = $next_audit; // Override the default setting for interval if the asset has its own next audit date if (($asset) && ($asset->next_audit_date)) { - $override_default_next = \Carbon::parse($asset->next_audit_date); - $next_audit_days = $override_default_next->diffInDays($now); + $override_default_next = Carbon::parse($asset->next_audit_date); + $next_audit_days = round($override_default_next->diffInDays($now, true)); } + // Show as negative number if the next audit date is before the audit date we're looking at + if ($this->created_at > $override_default_next) { + $next_audit_days = '-'.$next_audit_days; + } + return $next_audit_days; } diff --git a/resources/views/reports/audit.blade.php b/resources/views/reports/audit.blade.php index 729fe4e015..3dc16137f1 100644 --- a/resources/views/reports/audit.blade.php +++ b/resources/views/reports/audit.blade.php @@ -35,13 +35,12 @@ {{ trans('admin/hardware/table.image') }} - {{ trans('general.audit') }} - {{ trans('general.admin') }} + {{ trans('general.created_by') }} {{ trans('general.item') }} {{ trans('general.location') }} + {{ trans('general.last_audit') }} {{ trans('general.next_audit_date') }} {{ trans('general.days_to_next_audit') }} - {{ trans('general.notes') }} diff --git a/upgrade.php b/upgrade.php index ecc424c792..bd1678534b 100644 --- a/upgrade.php +++ b/upgrade.php @@ -479,15 +479,6 @@ foreach ($unused_files as $unused_file) { } echo "\n"; -$config_clear = shell_exec('php artisan config:clear'); -$cache_clear = shell_exec('php artisan cache:clear'); -$route_clear = shell_exec('php artisan route:clear'); -$view_clear = shell_exec('php artisan view:clear'); -echo $success_icon.' '.trim($config_clear)."\n"; -echo $success_icon.' '.trim($cache_clear)."\n"; -echo $success_icon.' '.trim($route_clear)."\n"; -echo $success_icon.' '.trim($view_clear)."\n"; -echo "\n"; echo "\e[95m--------------------------------------------------------\n"; echo "STEP 6: Updating composer dependencies:\n"; @@ -497,13 +488,11 @@ echo "-- Running the app in ".$app_environment." mode.\n"; // Composer install if (file_exists('composer.phar')) { - echo "√ Local composer.phar detected, so we'll use that.\n\n"; + echo $success_icon." Local composer.phar detected, so we'll use that.\n\n"; echo "-- Updating local composer.phar\n\n"; $composer_update = shell_exec('php composer.phar self-update'); echo $composer_update."\n\n"; - - // Use --no-dev only if we are in production mode. // This will cause errors otherwise, if the user is in develop or local for their APP_ENV if ($app_environment == 'production') { @@ -511,10 +500,9 @@ if (file_exists('composer.phar')) { } else { $composer = shell_exec('php composer.phar install --prefer-source'); } + $composer_dump = shell_exec('php composer.phar dump'); - - } else { echo "-- We couldn't find a local composer.phar. No worries, trying globally.\n"; @@ -531,13 +519,20 @@ if (file_exists('composer.phar')) { $composer_dump = shell_exec('composer dump'); - } echo $composer_dump."\n"; echo $composer; - +$config_clear = shell_exec('php artisan config:clear'); +$cache_clear = shell_exec('php artisan cache:clear'); +$route_clear = shell_exec('php artisan route:clear'); +$view_clear = shell_exec('php artisan view:clear'); +echo $success_icon.' '.trim($config_clear)."\n"; +echo $success_icon.' '.trim($cache_clear)."\n"; +echo $success_icon.' '.trim($route_clear)."\n"; +echo $success_icon.' '.trim($view_clear)."\n"; +echo "\n"; echo "\e[95m--------------------------------------------------------\n"; echo "STEP 7: Putting application into maintenance mode: \n";