mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Only add an update log message if the asset isn’t being checked in or out
This commit is contained in:
parent
b02148f59e
commit
932e25ca9b
|
@ -587,9 +587,9 @@ class AssetsController extends Controller
|
|||
$settings = Setting::getSettings();
|
||||
$this->authorize('view', $asset);
|
||||
|
||||
if (isset($asset->id)) {
|
||||
if (isset($asset)) {
|
||||
|
||||
if ($asset->assetloc) {
|
||||
if (!is_null($asset->assetloc)) {
|
||||
$use_currency = $asset->assetloc->currency;
|
||||
} else {
|
||||
|
||||
|
|
|
@ -278,6 +278,8 @@ class Asset extends Depreciable
|
|||
return $this->assignedTo->assetloc(); // Recurse until we have a final location
|
||||
} elseif ($this->assignedType() == self::LOCATION) {
|
||||
return $this->assignedTo();
|
||||
} elseif (!$this->assignedTo) {
|
||||
return $this->defaultLoc();
|
||||
} elseif ($this->assignedType() == self::USER) {
|
||||
return $this->assignedTo->userLoc();
|
||||
}
|
||||
|
|
|
@ -15,14 +15,21 @@ class AssetObserver
|
|||
* @param Asset $asset
|
||||
* @return void
|
||||
*/
|
||||
public function updated(Asset $asset)
|
||||
public function updating(Asset $asset)
|
||||
{
|
||||
$logAction = new Actionlog();
|
||||
$logAction->item_type = Asset::class;
|
||||
$logAction->item_id = $asset->id;
|
||||
$logAction->created_at = date("Y-m-d H:i:s");
|
||||
$logAction->user_id = Auth::id();
|
||||
$logAction->logaction('update');
|
||||
|
||||
if (($asset->getAttributes()['assigned_to'] == $asset->getOriginal()['assigned_to'])
|
||||
&& ($asset->getAttributes()['last_checkout'] == $asset->getOriginal()['last_checkout'])
|
||||
&& ($asset->getAttributes()['status_id'] == $asset->getOriginal()['status_id']))
|
||||
{
|
||||
$logAction = new Actionlog();
|
||||
$logAction->item_type = Asset::class;
|
||||
$logAction->item_id = $asset->id;
|
||||
$logAction->created_at = date("Y-m-d H:i:s");
|
||||
$logAction->user_id = Auth::id();
|
||||
$logAction->logaction('update');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue