fixes double updates from action log and history

This commit is contained in:
Godfrey M 2022-04-18 11:30:24 -07:00
parent 9a0219eff7
commit 91694064fb

View file

@ -17,12 +17,13 @@ class AssetObserver
*/ */
public function updating(Asset $asset) public function updating(Asset $asset)
{ {
$attributes = $asset->getAttributes();
// If the asset isn't being checked out or audited, log the update. $attributesOriginal = $asset->getOriginal();
// (Those other actions already create log entries.) // If the asset isn't being checked out or audited, log the update.
if (($asset->getAttributes()['assigned_to'] == $asset->getOriginal()['assigned_to']) // (Those other actions already create log entries.)
&& ($asset->getAttributes()['next_audit_date'] == $asset->getOriginal()['next_audit_date']) if (($attributes['assigned_to'] == $attributesOriginal['assigned_to'])
&& ($asset->getAttributes()['last_checkout'] == $asset->getOriginal()['last_checkout'])) && ((isset( $attributes['next_audit_date']) ? $attributes['next_audit_date'] : null) == (isset($attributesOriginal['next_audit_date']) ? $attributesOriginal['next_audit_date']: null))
&& ($attributes['last_checkout'] == $attributesOriginal['last_checkout']))
{ {
$changed = []; $changed = [];