Cambios revisados en controles

This commit is contained in:
2020-01-06 19:09:44 -03:00
parent 82beb3b1c4
commit affaf514fb
8 changed files with 27 additions and 6 deletions

View File

@ -15,6 +15,9 @@ class Model extends \Model
if (strpos(get_called_class(), 'Incoviba\\common\\') !== false) { if (strpos(get_called_class(), 'Incoviba\\common\\') !== false) {
return; return;
} }
if ($this->container->get('settings')->app->offline) {
return;
}
$user = Auth::User()->id; $user = Auth::User()->id;
$orm = $this->orm; $orm = $this->orm;
$ref = new \ReflectionObject($orm); $ref = new \ReflectionObject($orm);

View File

@ -24,7 +24,7 @@ class EstadoProyecto extends Model
} }
public function fecha() public function fecha()
{ {
return Carbon::parse($this->fecha, config('app.timezone')); return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
} }
} }
?> ?>

View File

@ -229,6 +229,9 @@ class Proyecto extends Model
} }
$ventas = $ventas->find_many(); $ventas = $ventas->find_many();
$this->ventas = $ventas; $this->ventas = $ventas;
foreach ($this->ventas as &$venta) {
$venta->setContainer($this->container);
}
} }
return $this->ventas; return $this->ventas;
} }
@ -249,6 +252,9 @@ class Proyecto extends Model
->find_many() ->find_many()
; ;
$this->resciliaciones = $resciliaciones; $this->resciliaciones = $resciliaciones;
foreach ($this->resciliaciones as &$venta) {
$venta->setContainer($this->container);
}
} }
return $this->resciliaciones; return $this->resciliaciones;
} }
@ -267,6 +273,9 @@ class Proyecto extends Model
->find_many() ->find_many()
; ;
$this->escrituras = $ventas; $this->escrituras = $ventas;
foreach ($this->escrituras as &$venta) {
$venta->setContainer($this->container);
}
} }
return $this->escrituras; return $this->escrituras;
} }
@ -291,6 +300,9 @@ class Proyecto extends Model
return $dif; return $dif;
}); });
$this->entregas = $entregas; $this->entregas = $entregas;
foreach ($this->entregas as &$venta) {
$venta->setContainer($this->container);
}
} }
return $this->entregas; return $this->entregas;
} }

View File

@ -69,7 +69,7 @@ class Cierre extends Model
public function fecha(\DateTime $fecha = null) public function fecha(\DateTime $fecha = null)
{ {
if ($fecha == null) { if ($fecha == null) {
return Carbon::parse($this->fecha, 'America/Santiago');//, config('app.timezone')); return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);//, config('app.timezone'));
} }
$this->fecha = $fecha->format('Y-m-d'); $this->fecha = $fecha->format('Y-m-d');
} }

View File

@ -56,7 +56,7 @@ class Pago extends Model
} }
public function fecha() public function fecha()
{ {
return Carbon::parse($this->fecha, config('app.timezone')); return Carbon::parse($this->fecha, $this->container->get('settings')->app->timezone);
} }
public function uf() public function uf()
{ {

View File

@ -21,7 +21,9 @@ class Propiedad extends Model
public function unidad() public function unidad()
{ {
return $this->belongs_to(Unidad::class, 'unidad_principal')->findOne(); $unidad = $this->belongs_to(Unidad::class, 'unidad_principal')->findOne();
$unidad->setContainer($this->container);
return $unidad;
} }
protected $unidades; protected $unidades;
public function unidades() { public function unidades() {

View File

@ -28,7 +28,9 @@ class Unidad extends Model
{ {
public function proyecto() public function proyecto()
{ {
return $this->belongs_to(Proyecto::class, 'proyecto')->findOne(); $proyecto = $this->belongs_to(Proyecto::class, 'proyecto')->findOne();
$proyecto->setContainer($this->container);
return $proyecto;
} }
protected $propiedad; protected $propiedad;
public function propiedad() public function propiedad()

View File

@ -48,7 +48,9 @@ class Venta extends Model
} }
public function propiedad() public function propiedad()
{ {
return $this->belongs_to(Propiedad::class, 'propiedad')->findOne(); $propiedad = $this->belongs_to(Propiedad::class, 'propiedad')->findOne();
$propiedad->setContainer($this->container);
return $propiedad;
} }
public function bonoPie() public function bonoPie()
{ {