diff --git a/lib/TrackingEntry.lib.php b/lib/TrackingEntry.lib.php index 430610b..5d73039 100644 --- a/lib/TrackingEntry.lib.php +++ b/lib/TrackingEntry.lib.php @@ -12,7 +12,11 @@ class TrackingEntry { $this->status = $status; $this->details = $details; $this->datetime = date("Y-m-d\TH:i:s", strtotime($datetime)); - $this->location = $location; + if (is_null($location)) { + $this->location = new Location(); + } else { + $this->location = $location; + } $this->iscontainerscan = $iscontainerscan; } diff --git a/lib/TrackingInfo.lib.php b/lib/TrackingInfo.lib.php index 2568ea4..60afc9c 100644 --- a/lib/TrackingInfo.lib.php +++ b/lib/TrackingInfo.lib.php @@ -76,6 +76,9 @@ class TrackingInfo { } public function toObject() { + if (is_null($this->service)) { + $this->service = new Service("", ""); + } $output = [ "status" => "OK", "code" => $this->getCode(), diff --git a/lib/Tracking_HelenaExpress.lib.php b/lib/Tracking_HelenaExpress.lib.php index ec605d4..9d7b602 100644 --- a/lib/Tracking_HelenaExpress.lib.php +++ b/lib/Tracking_HelenaExpress.lib.php @@ -29,12 +29,13 @@ class Tracking_HelenaExpress { $info->setCode($barcode->getCode()); $info->setCarrier($status->info->carrier); + $info->setService(new Service("", "Local Courier")); if (!empty($status->events)) { $current_status = new TrackingEntry( TrackingStatus::stringToStatus($status->events[0]->eventtype), $status->events[0]->text, - $status->events[0]->timestring + $status->events[0]->timestamp ); $info->setCurrentStatus($current_status); @@ -42,7 +43,7 @@ class Tracking_HelenaExpress { foreach ($status->events as $event) { - $info->appendHistoryEntry(new TrackingEntry(TrackingStatus::stringToStatus($event->eventtype), $event->text, $event->timestring)); + $info->appendHistoryEntry(new TrackingEntry(TrackingStatus::stringToStatus($event->eventtype), $event->text, $event->timestamp)); } return $info;