Se considera casos de que no existe promesas

This commit is contained in:
2019-12-30 11:15:56 -03:00
parent 5790b4c861
commit ac11a65d70

View File

@ -311,9 +311,12 @@ class Cierre extends Model
if ($this->promesa == null) { if ($this->promesa == null) {
$propiedad = model(Propiedad::class)->where('unidad_principal', $this->unidadPrincipal()->unidad)->findOne(); $propiedad = model(Propiedad::class)->where('unidad_principal', $this->unidadPrincipal()->unidad)->findOne();
if (!$propiedad) { if (!$propiedad) {
return false; $this->promesa = false;
} }
$this->promesa = model(Venta::class)->where('propiedad', $propiedad->id)->where('estado', 1)->findOne(); $this->promesa = model(Venta::class)->where('propiedad', $propiedad->id)->where('estado', 1)->findOne();
if (!$this->promesa) {
$this->promesa = false;
}
if ($this->promesa != null and $this->propietario == 0) { if ($this->promesa != null and $this->propietario == 0) {
$this->propietario = $this->promesa->propietario; $this->propietario = $this->promesa->propietario;
$this->save(); $this->save();