Skip to content

A free open source IT asset/license management system

fixes action_date for check-in not including H:i:s

Godfrey M5d0a1ebb7a92
diff --git a/app/Http/Controllers/Assets/AssetCheckinController.php b/app/Http/Controllers/Assets/AssetCheckinController.php
index e1a30b30cc..ea7313ad06 100644
--- a/app/Http/Controllers/Assets/AssetCheckinController.php
+++ b/app/Http/Controllers/Assets/AssetCheckinController.php
@@ -106,11 +106,12 @@ class AssetCheckinController extends Controller
$asset->location_id = e($request->get('location_id'));
}
- $checkin_at = date('Y-m-d');
- if ($request->filled('checkin_at')) {
- $checkin_at = $request->input('checkin_at');
+ $checkin_at = date('Y-m-d H:i:s');
+ if (($request->filled('checkin_at')) && ($request->get('checkin_at') != date('Y-m-d'))) {
+ $checkin_at = $request->get('checkout_at');
}
+
if(!empty($asset->licenseseats->all())){
foreach ($asset->licenseseats as $seat){
$seat->assigned_to = null;
diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php
index 3609298ac7..fe3a407288 100644
--- a/app/Models/Loggable.php
+++ b/app/Models/Loggable.php
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Models\Setting;
use App\Notifications\AuditNotification;
+use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
trait Loggable
@@ -115,6 +116,10 @@ trait Loggable
$log->note = $note;
$log->action_date = $action_date;
+ if (! $log->action_date) {
+ $log->action_date = date('Y-m-d H:i:s');
+ }
+
if (Auth::user()) {
$log->user_id = Auth::user()->id;
}