Skip to content

Commit

Permalink
Merge pull request #10952 from Godmartinz/fixes_double_updates
Browse files Browse the repository at this point in the history
fixes double updates from action log and history
  • Loading branch information
snipe committed Apr 21, 2022
2 parents 9a0219e + 9169406 commit ef7f21e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/Observers/AssetObserver.php
Expand Up @@ -17,12 +17,13 @@ class AssetObserver
*/
public function updating(Asset $asset)
{

// If the asset isn't being checked out or audited, log the update.
// (Those other actions already create log entries.)
if (($asset->getAttributes()['assigned_to'] == $asset->getOriginal()['assigned_to'])
&& ($asset->getAttributes()['next_audit_date'] == $asset->getOriginal()['next_audit_date'])
&& ($asset->getAttributes()['last_checkout'] == $asset->getOriginal()['last_checkout']))
$attributes = $asset->getAttributes();
$attributesOriginal = $asset->getOriginal();
// If the asset isn't being checked out or audited, log the update.
// (Those other actions already create log entries.)
if (($attributes['assigned_to'] == $attributesOriginal['assigned_to'])
&& ((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 = [];

Expand Down

0 comments on commit ef7f21e

Please sign in to comment.