Improve tracking
This commit is contained in:
parent
ed5e0f2af2
commit
9ca25fb222
@ -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;
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,9 @@ class TrackingInfo {
|
||||
}
|
||||
|
||||
public function toObject() {
|
||||
if (is_null($this->service)) {
|
||||
$this->service = new Service("", "");
|
||||
}
|
||||
$output = [
|
||||
"status" => "OK",
|
||||
"code" => $this->getCode(),
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user