Brings back the „pending“ state when checking out (#5837)

When a user would get an asset checked out for them, and the assets category required acceptance of the asset, the „pending“ state would not get set.
This commit is contained in:
Till Deeke 2018-07-16 23:07:24 +02:00 committed by snipe
parent 0fb9f42ba4
commit dbd177576e

View file

@ -30,6 +30,7 @@ class Asset extends Depreciable
const ASSET = 'asset';
const USER = 'user';
const ACCEPTANCE_PENDING = 'pending';
/**
* Set static properties to determine which checkout/checkin handlers we should use
*/
@ -192,6 +193,17 @@ class Asset extends Depreciable
}
}
/**
* Does the user have to confirm that they accept the asset?
*
* If so, set the acceptance-status to "pending".
* This value is used in the unaccepted assets reports, for example
*
* @see https://github.com/snipe/snipe-it/issues/5772
*/
if ($this->requireAcceptance() && $target instanceof User) {
$this->accepted = self::ACCEPTANCE_PENDING;
}
if ($this->save()) {
$this->logCheckout($note, $target);