From 6fa4d1252d9aa54cef4b3c3721e988bf54ec1392 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 10 Jun 2016 05:00:49 -0700 Subject: [PATCH] Fixes purchase date if no purchase date given --- app/Console/Commands/ObjectImportCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/ObjectImportCommand.php b/app/Console/Commands/ObjectImportCommand.php index 29583e8831..2ed05f7758 100644 --- a/app/Console/Commands/ObjectImportCommand.php +++ b/app/Console/Commands/ObjectImportCommand.php @@ -113,7 +113,12 @@ class ObjectImportCommand extends Command { $item_status_name = $this->array_smart_fetch($row, "status"); $item["item_name"] = $this->array_smart_fetch($row, "item name"); - $item["purchase_date"] = date("Y-m-d 00:00:01", strtotime($this->array_smart_fetch($row, "purchase date"))); + if ($this->array_smart_fetch($row, "purchase date")!='') { + $item["purchase_date"] = date("Y-m-d 00:00:01", strtotime($this->array_smart_fetch($row, "purchase date"))); + } else { + $item["purchase_date"] = null; + } + $item["purchase_cost"] = $this->array_smart_fetch($row, "purchase cost"); $item["order_number"] = $this->array_smart_fetch($row, "order number"); $item["notes"] = $this->array_smart_fetch($row, "notes");