mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
push
This commit is contained in:
parent
70a251de55
commit
951521dc81
|
@ -194,7 +194,8 @@ class Importer extends Component
|
|||
];
|
||||
|
||||
$this->assets_fields = [
|
||||
'asset_eol_date' => trans('general.eol'),
|
||||
//'asset_eol_date' => trans('general.eol'),
|
||||
'asset_eol_date' => 'asset_eol_date',
|
||||
'company' => trans('general.company'),
|
||||
'location' => trans('general.location'),
|
||||
'item_name' => trans('general.item_name_var', ['item' => trans('general.asset')]),
|
||||
|
@ -216,7 +217,7 @@ class Importer extends Component
|
|||
'manufacturer' => trans('general.manufacturer'),
|
||||
'order_number' => trans('general.order_number'),
|
||||
'image' => trans('general.importer.image_filename'),
|
||||
'asset_eol_date' => trans('admin/hardware/form.eol_date'),
|
||||
//'asset_eol_date' => trans('admin/hardware/form.eol_date'),
|
||||
/**
|
||||
* Checkout fields:
|
||||
* Assets can be checked out to other assets, people, or locations, but we currently
|
||||
|
|
|
@ -99,7 +99,14 @@ class ItemImporter extends Importer
|
|||
$this->log('Unable to parse date: '.$csvMatch);
|
||||
}
|
||||
} elseif ($this->createOrFetchAssetModel($row) != null) {
|
||||
if($eol = AssetModel::find($this->createOrFetchAssetModel($row))->eol) {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue