Put asset EOL date back in the Item Importer

I have no idea why this is necessary

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-05-31 00:16:16 +01:00
parent f4d530b4b1
commit 3a0f7eca54

View file

@ -79,6 +79,18 @@ class ItemImporter extends Importer
$this->item['purchase_date'] = date('Y-m-d', strtotime($this->findCsvMatch($row, 'purchase_date')));
}
$this->item['asset_eol_date'] = null;
if ($this->findCsvMatch($row, 'asset_eol_date') != '') {
$csvMatch = $this->findCsvMatch($row, 'asset_eol_date');
\Log::warning('EOL Date for $csvMatch is '.$csvMatch);
try {
$this->item['asset_eol_date'] = CarbonImmutable::parse($csvMatch)->format('Y-m-d');
} catch (\Exception $e) {
Log::info($e->getMessage());
$this->log('Unable to parse date: '.$csvMatch);
}
}
$this->item['qty'] = $this->findCsvMatch($row, 'quantity');
$this->item['requestable'] = $this->findCsvMatch($row, 'requestable');
@ -369,7 +381,6 @@ class ItemImporter extends Importer
if ($status->save()) {
$this->log('Status '.$asset_statuslabel_name.' was created');
return $status->id;
}