From 5754f0aa3f94057991dce519f43e010ba1cd2dc5 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 18 Feb 2021 14:21:19 -0800 Subject: [PATCH] Revert "Added logic to handle the CLI importer. (#9088)" This reverts commit 2e2d087639ba9ba915c1e28bba5f2b6f19a4fdbf. --- app/Importer/AssetImporter.php | 2 +- app/Models/Asset.php | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index 09f0b1d372..bdc254cb06 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -121,7 +121,7 @@ class AssetImporter extends ItemImporter // If we have a target to checkout to, lets do so. if(isset($target)) { - $asset->fresh()->checkOut($target, $this->user_id); + $asset->fresh()->checkOut($target); } return; } diff --git a/app/Models/Asset.php b/app/Models/Asset.php index aaec5edd58..f84c2ca707 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -279,7 +279,7 @@ class Asset extends Depreciable * @since [v3.0] * @return boolean */ - public function checkOut($target, $admin_id = null, $checkout_at = null, $expected_checkin = null, $note = null, $name = null, $location = null) + public function checkOut($target, $admin = null, $checkout_at = null, $expected_checkin = null, $note = null, $name = null, $location = null) { if (!$target) { return false; @@ -313,14 +313,9 @@ class Asset extends Depreciable } if ($this->save()) { - if(isset($admin_id)){ - $checkedOutBy = User::find($admin_id); - event(new CheckoutableCheckedOut($this, $target, $checkedOutBy, $note)); - } else { - event(new CheckoutableCheckedOut($this, $target, Auth::user(), $note)); - } - + event(new CheckoutableCheckedOut($this, $target, Auth::user(), $note)); + $this->increment('checkout_counter', 1); return true; }