Skip to content

Commit

Permalink
Merge pull request #10812 from inietov/fixes/CarbonExceptions_Invalid…
Browse files Browse the repository at this point in the history
…FormatException_DateTime_develop

Fixes Carbon\Exceptions\InvalidFormatException: DateTime::__construct(): Failed to parse time string develop
  • Loading branch information
snipe authored Mar 10, 2022
2 parents d06ef4b + cdc0805 commit 8984b3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/Importer/AssetImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ public function createAssetIfNotExists(array $row)
$item['rtd_location_id'] = $this->item['location_id'];
}

$item['last_audit_date'] = null;
if (isset($this->item['last_audit_date'])) {
$item['last_audit_date'] = $this->item['last_audit_date'];
}

$item['next_audit_date'] = null;
if (isset($this->item['next_audit_date'])) {
$item['next_audit_date'] = $this->item['next_audit_date'];
}
Expand Down
12 changes: 10 additions & 2 deletions app/Importer/LicenseImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,22 @@ public function createLicenseIfNotExists(array $row)
$license = new License;
}
$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_name'] = $this->findCsvMatch($row, 'license_name');
$this->item['maintained'] = $this->findCsvMatch($row, 'maintained');
$this->item['purchase_order'] = $this->findCsvMatch($row, 'purchase_order');
$this->item['reassignable'] = $this->findCsvMatch($row, 'reassignable');
$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) {
$license->update($this->sanitizeItemForUpdating($license));
Expand Down

0 comments on commit 8984b3a

Please sign in to comment.