mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
fixed last audit date + test
This commit is contained in:
parent
1d4a7a7b02
commit
cec84b857b
|
@ -645,6 +645,9 @@ class AssetsController extends Controller
|
|||
if ($request->has('rtd_location_id') && !$request->has('location_id')) {
|
||||
$asset->location_id = $request->validated()['rtd_location_id'];
|
||||
}
|
||||
if ($request->input('last_audit_date')) {
|
||||
$asset->last_audit_date = Carbon::parse($request->input('last_audit_date'))->startOfDay()->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* this is here just legacy reasons. Api\AssetController
|
||||
|
|
|
@ -60,7 +60,7 @@ class AssetUpdateTest extends TestCase
|
|||
'asset_tag' => 'random_string',
|
||||
'assigned_user' => $userAssigned->id,
|
||||
'company_id' => $company->id,
|
||||
'last_audit_date' => '2023-09-03',
|
||||
'last_audit_date' => '2023-09-03 12:23:45',
|
||||
'location_id' => $location->id,
|
||||
'model_id' => $model->id,
|
||||
'name' => 'A New Asset',
|
||||
|
@ -98,6 +98,7 @@ class AssetUpdateTest extends TestCase
|
|||
$this->assertTrue($updatedAsset->assetstatus->is($status));
|
||||
$this->assertTrue($updatedAsset->supplier->is($supplier));
|
||||
$this->assertEquals(10, $updatedAsset->warranty_months);
|
||||
$this->assertEquals('2023-09-03 00:00:00', $updatedAsset->last_audit_date->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
public function testAssetEolDateIsCalculatedIfPurchaseDateUpdated()
|
||||
|
|
Loading…
Reference in a new issue