Merge pull request #10811 from inietov/fixes/CarbonExceptions_InvalidFormatException_DateTime

Fixes Carbon\Exceptions\InvalidFormatException: DateTime::__construct(): Failed to parse time string
This commit is contained in:
snipe 2022-03-10 10:40:46 -08:00 committed by GitHub
commit dadc80d558
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,14 +46,22 @@ class LicenseImporter extends ItemImporter
$license = new License; $license = new License;
} }
$asset_tag = $this->item['asset_tag'] = $this->findCsvMatch($row, 'asset_tag'); // used for checkout out to an asset. $asset_tag = $this->item['asset_tag'] = $this->findCsvMatch($row, 'asset_tag'); // used for checkout out to an asset.
$this->item['expiration_date'] = $this->findCsvMatch($row, 'expiration_date');
$this->item["expiration_date"] = null;
if ($this->findCsvMatch($row, "expiration_date")!='') {
$this->item["expiration_date"] = date("Y-m-d 00:00:01", strtotime($this->findCsvMatch($row, "expiration_date")));
}
$this->item['license_email'] = $this->findCsvMatch($row, "license_email"); $this->item['license_email'] = $this->findCsvMatch($row, "license_email");
$this->item['license_name'] = $this->findCsvMatch($row, "license_name"); $this->item['license_name'] = $this->findCsvMatch($row, "license_name");
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained'); $this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order'); $this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable'); $this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
$this->item['seats'] = $this->findCsvMatch($row, 'seats'); $this->item['seats'] = $this->findCsvMatch($row, 'seats');
$this->item['termination_date'] = $this->findCsvMatch($row, 'termination_date');
$this->item["termination_date"] = null;
if ($this->findCsvMatch($row, "termination_date")!='') {
$this->item["termination_date"] = date("Y-m-d 00:00:01", strtotime($this->findCsvMatch($row, "termination_date")));
}
if ($editingLicense) { if ($editingLicense) {
$license->update($this->sanitizeItemForUpdating($license)); $license->update($this->sanitizeItemForUpdating($license));