Skip to content

A free open source IT asset/license management system

Added visual on the hardware view screen

snipe71b5bf2eefb3
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index b2c84497a4..b0ad2e0332 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -907,6 +907,23 @@ class Asset extends Depreciable
}
+
+ /**
+ * Determine whether this asset's next audit date is before the last audit date
+ *
+ * @return bool
+ * @since [v6.4.1]
+ * @author [A. Gianotto] [<[email protected]>]
+ * */
+ public function checkInvalidNextAuditDate()
+ {
+ if (($this->last_audit_date) && ($this->next_audit_date) && ($this->last_audit_date > $this->next_audit_date)) {
+ return true;
+ }
+ return false;
+ }
+
+
/**
* Checks for a category-specific EULA, and if that doesn't exist,
* checks for a settings level EULA
diff --git a/resources/lang/en-US/admin/hardware/message.php b/resources/lang/en-US/admin/hardware/message.php
index a9466f4451..32698b1c07 100644
--- a/resources/lang/en-US/admin/hardware/message.php
+++ b/resources/lang/en-US/admin/hardware/message.php
@@ -9,6 +9,7 @@ return [
'no_tag' => 'No asset tag provided.',
'does_not_exist_or_not_requestable' => 'That asset does not exist or is not requestable.',
'assoc_users' => 'This asset is currently checked out to a user and cannot be deleted. Please check the asset in first, and then try deleting again. ',
+ 'warning_audit_date_mismatch' => 'This asset\'s next audit date (:next_audit_date) is before the last audit date (:last_audit_date). Please update the next audit date.',
'create' => [
'error' => 'Asset was not created, please try again. :(',
diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php
index dfb1513936..589803d96c 100755
--- a/resources/views/hardware/view.blade.php
+++ b/resources/views/hardware/view.blade.php
@@ -19,6 +19,23 @@
</div>
@endif
+ @if ($asset->checkInvalidNextAuditDate())
+ <div class="col-md-12">
+ <div class="callout callout-warning">
+ <p><strong>{{ trans('general.warning',
+ [
+ 'warning' => trans('admin/hardware/message.warning_audit_date_mismatch',
+ [
+ 'last_audit_date' => Helper::getFormattedDateObject($asset->last_audit_date, 'date', false),
+ 'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date, 'date', false)
+ ]
+ )
+ ]
+ ) }}</strong></p>
+ </div>
+ </div>
+ @endif
+
@if ($asset->deleted_at!='')
<div class="col-md-12">
<div class="alert alert-danger">
@@ -237,7 +254,8 @@
</strong>
</div>
<div class="col-md-6">
- {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }}
+ {!! $asset->checkInvalidNextAuditDate() ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
+ {{ Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }}
@if ($audit_log->user)
(by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }})
@endif
@@ -254,6 +272,7 @@
</strong>
</div>
<div class="col-md-6">
+ {!! $asset->checkInvalidNextAuditDate() ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
{{ Helper::getFormattedDateObject($asset->next_audit_date, 'date', false) }}
</div>
</div>