Merge pull request #10861 from andreaci/develop

next_audit_date error on saving asset
This commit is contained in:
snipe 2022-03-23 18:44:21 +00:00 committed by GitHub
commit edcf109b0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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