mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-13 17:14:10 -08:00
Merge pull request #11290 from inietov/fixes/asset_observer_fails_checkout_on_creating
Fixes observer fails when creating and assigning a new asset
This commit is contained in:
commit
166f526302
|
@ -19,12 +19,21 @@ class AssetObserver
|
||||||
{
|
{
|
||||||
$attributes = $asset->getAttributes();
|
$attributes = $asset->getAttributes();
|
||||||
$attributesOriginal = $asset->getRawOriginal();
|
$attributesOriginal = $asset->getRawOriginal();
|
||||||
|
$same_checkout_counter = false;
|
||||||
|
$same_checkin_counter = false;
|
||||||
|
|
||||||
|
if (array_key_exists('checkout_counter', $attributes) && array_key_exists('checkout_counter', $attributesOriginal)){
|
||||||
|
$same_checkout_counter = (($attributes['checkout_counter'] == $attributesOriginal['checkout_counter']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('checkin_counter', $attributes) && array_key_exists('checkin_counter', $attributesOriginal)){
|
||||||
|
$same_checkin_counter = (($attributes['checkin_counter'] == $attributesOriginal['checkin_counter']));
|
||||||
|
}
|
||||||
|
|
||||||
// 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 (($attributes['assigned_to'] == $attributesOriginal['assigned_to'])
|
if (($attributes['assigned_to'] == $attributesOriginal['assigned_to'])
|
||||||
&& ($attributes['checkout_counter'] == $attributesOriginal['checkout_counter'])
|
&& ($same_checkout_counter) && ($same_checkin_counter)
|
||||||
&& ($attributes['checkin_counter'] == $attributesOriginal['checkin_counter'])
|
|
||||||
&& ((isset( $attributes['next_audit_date']) ? $attributes['next_audit_date'] : null) == (isset($attributesOriginal['next_audit_date']) ? $attributesOriginal['next_audit_date']: null))
|
&& ((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']))
|
&& ($attributes['last_checkout'] == $attributesOriginal['last_checkout']))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue