Skip to content

Commit 5455abf

Browse files
committed
Fix for importer
1 parent 3460016 commit 5455abf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/commands/ImportCommand.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ public function fire()
123123
$user_asset_notes = '';
124124
}
125125

126-
if (array_key_exists('9',$row)) {
127-
$user_asset_purchase_date = date("Y-m-d 00:00:01", strtotime($row[10]));
126+
if (array_key_exists('10',$row)) {
127+
if ($row[10]!='') {
128+
$user_asset_purchase_date = date("Y-m-d 00:00:01", strtotime($row[10]));
129+
} else {
130+
$user_asset_purchase_date = '';
131+
}
128132
} else {
129133
$user_asset_purchase_date = '';
130134
}
@@ -314,7 +318,11 @@ public function fire()
314318
$asset->rtd_location_id = $location->id;
315319
$asset->user_id = 1;
316320
$asset->status_id = $status_id;
317-
$asset->purchase_date = $user_asset_purchase_date;
321+
if ($user_asset_purchase_date!='') {
322+
$asset->purchase_date = $user_asset_purchase_date;
323+
} else {
324+
$asset->purchase_date = NULL;
325+
}
318326
$asset->notes = e($user_asset_notes);
319327

320328
if ($asset->save()) {

0 commit comments

Comments
 (0)