FIX: Cuando no hay cierres asociados

This commit is contained in:
2021-03-26 15:25:32 -03:00
parent 016bc51eb5
commit 5850f14295

View File

@ -226,11 +226,13 @@ class Unidad extends Model
if ($this->is_reservada == null) { if ($this->is_reservada == null) {
$this->is_reservada = false; $this->is_reservada = false;
$cierres = $this->cierres(); $cierres = $this->cierres();
if ($cierres) {
foreach ($cierres as $cierre) { foreach ($cierres as $cierre) {
if ($cierre->isVigente()) { if ($cierre->isVigente()) {
$this->is_reservada = true; $this->is_reservada = true;
} }
} }
}
if (!$this->isVendida()) { if (!$this->isVendida()) {
$this->is_reservada = true; $this->is_reservada = true;
} }