mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Misc assetLoc error checks
This commit is contained in:
parent
772785f9b5
commit
6186c324b5
|
@ -266,17 +266,23 @@ class Asset extends Depreciable
|
||||||
throw new \Exception("Asset assignment Loop for Asset ID: ".$first_asset->id);
|
throw new \Exception("Asset assignment Loop for Asset ID: ".$first_asset->id);
|
||||||
}
|
}
|
||||||
$assigned_to=Asset::find($this->assigned_to); //have to do this this way because otherwise it errors
|
$assigned_to=Asset::find($this->assigned_to); //have to do this this way because otherwise it errors
|
||||||
return $assigned_to->assetLoc(); // Recurse until we have a final location
|
if ($assigned_to) {
|
||||||
|
return $assigned_to->assetLoc();
|
||||||
|
} // Recurse until we have a final location
|
||||||
}
|
}
|
||||||
if ($this->assignedType() == self::LOCATION) {
|
if ($this->assignedType() == self::LOCATION) {
|
||||||
|
if ($this->assignedTo) {
|
||||||
return $this->assignedTo;
|
return $this->assignedTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if ($this->assignedType() == self::USER) {
|
if ($this->assignedType() == self::USER) {
|
||||||
if (!$this->assignedTo->userLoc) {
|
if (($this->assignedTo) && $this->assignedTo->userLoc) {
|
||||||
|
return $this->assignedTo->userLoc;
|
||||||
|
}
|
||||||
//this makes no sense
|
//this makes no sense
|
||||||
return $this->defaultLoc;
|
return $this->defaultLoc;
|
||||||
}
|
|
||||||
return $this->assignedTo->userLoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue