|
|
|
@ -39,6 +39,21 @@ class Machine implements JsonSerializable {
|
|
|
|
|
public function toArray() {
|
|
|
|
|
global $Strings;
|
|
|
|
|
if ($this->exists) {
|
|
|
|
|
$info = $this->machine;
|
|
|
|
|
// only show deleted if true
|
|
|
|
|
if (!$this->isDeleted()) {
|
|
|
|
|
unset($info["deleted"]);
|
|
|
|
|
}
|
|
|
|
|
$clientinfo = [];
|
|
|
|
|
if (!empty($this->getClientID())) {
|
|
|
|
|
$client = Clients::getClient($this->getClientID());
|
|
|
|
|
$clientinfo = [
|
|
|
|
|
"name" => $client->getName(),
|
|
|
|
|
"phone" => $client->getPhone(),
|
|
|
|
|
"billingaddress" => $client->getBillingAddress(),
|
|
|
|
|
"mailingaddress" => $client->getMailingAddress()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
return [
|
|
|
|
|
"status" => "OK",
|
|
|
|
|
"id" => $this->machineid,
|
|
|
|
@ -47,7 +62,8 @@ class Machine implements JsonSerializable {
|
|
|
|
|
"id" => $this->typeid,
|
|
|
|
|
"label" => $this->typelabel
|
|
|
|
|
],
|
|
|
|
|
"info" => $this->machine,
|
|
|
|
|
"clientinfo" => $clientinfo,
|
|
|
|
|
"info" => $info,
|
|
|
|
|
"events" => $this->events,
|
|
|
|
|
"components" => $this->components,
|
|
|
|
|
"formdata" => [
|
|
|
|
@ -65,8 +81,7 @@ class Machine implements JsonSerializable {
|
|
|
|
|
"clientid" => "select",
|
|
|
|
|
"privatenotes" => "textarea",
|
|
|
|
|
"publicnotes" => "textarea",
|
|
|
|
|
"type" => "select",
|
|
|
|
|
"deleted" => "hidden"
|
|
|
|
|
"type" => "select"
|
|
|
|
|
],
|
|
|
|
|
"labels" => [
|
|
|
|
|
"model" => $Strings->get("Model", false),
|
|
|
|
|