Merge pull request #14908 from snipe/fixes/importer_audit_date

Fixes/importer audit date
This commit is contained in:
snipe 2024-06-19 11:12:12 +01:00 committed by GitHub
commit 98662c2a77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -102,7 +102,7 @@ class AssetImporter extends ItemImporter
$this->item['expected_checkin'] = trim($this->findCsvMatch($row, 'expected_checkin'));
$this->item['last_audit_date'] = trim($this->findCsvMatch($row, 'last_audit_date'));
$this->item['next_audit_date'] = trim($this->findCsvMatch($row, 'next_audit_date'));
$this->item['asset_eol_date'] = trim($this->findCsvMatch($row, 'next_audit_date'));
$this->item['asset_eol_date'] = trim($this->findCsvMatch($row, 'asset_eol_date'));
$this->item['asset_tag'] = $asset_tag;
// We need to save the user if it exists so that we can checkout to user later.

View file

@ -100,7 +100,7 @@ class Asset extends Depreciable
'last_checkout' => 'nullable|date_format:Y-m-d H:i:s',
'last_checkin' => 'nullable|date_format:Y-m-d H:i:s',
'expected_checkin' => 'nullable|date',
'last_audit_date' => 'nullable|date_format:Y-m-d H:i:s',
'last_audit_date' => 'nullable',
// 'next_audit_date' => 'nullable|date|after:last_audit_date',
'next_audit_date' => 'nullable|date',
'location_id' => 'nullable|exists:locations,id',
@ -984,6 +984,14 @@ class Asset extends Depreciable
);
}
protected function lastAuditDate(): Attribute
{
return Attribute::make(
get: fn ($value) => $value ? Carbon::parse($value)->format('Y-m-d H:i:s') : null,
set: fn ($value) => $value ? Carbon::parse($value)->format('Y-m-d H:i:s') : null,
);
}
protected function lastCheckout(): Attribute
{
return Attribute::make(