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 = array_filter($unidades, function($item) {
|
||||
return !$item->isReservada();
|
||||
return !$item->isVendida() and !$item->isReservada();
|
||||
});
|
||||
$unidades = array_map(function($item) {
|
||||
return $item->asArray();
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user