FIX: isVendida & isReservada para saber si está liberada la unidad

This commit is contained in:
2021-03-26 16:01:56 -03:00
parent 5850f14295
commit fa0395bc7b
2 changed files with 8 additions and 9 deletions

View File

@ -225,17 +225,16 @@ class Unidad extends Model
public function isReservada() {
if ($this->is_reservada == null) {
$this->is_reservada = false;
$cierres = $this->cierres();
if ($cierres) {
foreach ($cierres as $cierre) {
if ($cierre->isVigente()) {
$this->is_reservada = true;
if (!$this->isVendida()) {
$cierres = $this->cierres();
if ($cierres) {
foreach ($cierres as $cierre) {
if ($cierre->isVigente()) {
$this->is_reservada = true;
}
}
}
}
if (!$this->isVendida()) {
$this->is_reservada = true;
}
}
return $this->is_reservada;
}