Se considera casos de que no existe promesas
This commit is contained in:
@ -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();
|
||||||
|
Reference in New Issue
Block a user