mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
viola
This commit is contained in:
parent
951521dc81
commit
0368b9df43
|
@ -98,17 +98,6 @@ class ItemImporter extends Importer
|
||||||
Log::info($e->getMessage());
|
Log::info($e->getMessage());
|
||||||
$this->log('Unable to parse date: '.$csvMatch);
|
$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');
|
$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)) {
|
} elseif (!is_null($asset->asset_eol_date) && is_null($asset->purchase_date)) {
|
||||||
$asset->eol_explicit = true;
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue