viola
This commit is contained in:
@@ -98,17 +98,6 @@ class ItemImporter extends Importer
|
||||
Log::info($e->getMessage());
|
||||
$this->log('Unable to parse date: '.$csvMatch);
|
||||
}
|
||||
} elseif ($this->createOrFetchAssetModel($row) != null) {
|
||||
if(AssetModel::find($this->createOrFetchAssetModel($row))->eol && $this->findCsvMatch($row, 'purchase_date') != '') {
|
||||
$eol = AssetModel::find($this->createOrFetchAssetModel($row))->eol;
|
||||
$months = CarbonImmutable::parse($this->findCsvMatch($row, 'asset_eol_date'))->diffInMonths($this->findCsvMatch($row, 'purchase_date'));
|
||||
if($months != $eol) {
|
||||
$this->item['eol_explicit'] = true;
|
||||
} else {
|
||||
$this->item['eol_explicit'] = false;
|
||||
}
|
||||
$this->item['asset_eol_date'] = CarbonImmutable::parse($this->findCsvMatch($row, 'purchase_date'))->addMonths($eol)->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
$this->item['qty'] = $this->findCsvMatch($row, 'quantity');
|
||||
|
||||
@@ -140,7 +140,9 @@ class AssetObserver
|
||||
} elseif (!is_null($asset->asset_eol_date) && is_null($asset->purchase_date)) {
|
||||
$asset->eol_explicit = true;
|
||||
}
|
||||
|
||||
if ((!is_null($asset->asset_eol_date)) && (!is_null($asset->purchase_date)) && (is_null($asset->model->eol))) {
|
||||
$asset->eol_explicit = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user