FIX: isVendida & isReservada para saber si está liberada la unidad
This commit is contained in:
@ -13,7 +13,7 @@ class Unidades {
|
|||||||
}
|
}
|
||||||
$unidades = $proyecto->unidades($id_tipo);
|
$unidades = $proyecto->unidades($id_tipo);
|
||||||
$unidades = array_filter($unidades, function($item) {
|
$unidades = array_filter($unidades, function($item) {
|
||||||
return !$item->isReservada();
|
return !$item->isVendida() and !$item->isReservada();
|
||||||
});
|
});
|
||||||
$unidades = array_map(function($item) {
|
$unidades = array_map(function($item) {
|
||||||
return $item->asArray();
|
return $item->asArray();
|
||||||
|
@ -225,17 +225,16 @@ class Unidad extends Model
|
|||||||
public function isReservada() {
|
public function isReservada() {
|
||||||
if ($this->is_reservada == null) {
|
if ($this->is_reservada == null) {
|
||||||
$this->is_reservada = false;
|
$this->is_reservada = false;
|
||||||
$cierres = $this->cierres();
|
if (!$this->isVendida()) {
|
||||||
if ($cierres) {
|
$cierres = $this->cierres();
|
||||||
foreach ($cierres as $cierre) {
|
if ($cierres) {
|
||||||
if ($cierre->isVigente()) {
|
foreach ($cierres as $cierre) {
|
||||||
$this->is_reservada = true;
|
if ($cierre->isVigente()) {
|
||||||
|
$this->is_reservada = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isVendida()) {
|
|
||||||
$this->is_reservada = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $this->is_reservada;
|
return $this->is_reservada;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user