Optimizaciones
This commit is contained in:
@ -119,6 +119,6 @@ WHERE venta_id = ?";
|
|||||||
}
|
}
|
||||||
public function filterData(array $data): array
|
public function filterData(array $data): array
|
||||||
{
|
{
|
||||||
return array_intersect_key($data, array_fill_keys(['valor', 'banco', 'tipo', 'identificador', 'fecha', 'uf', 'pagador', 'asociado'], 0));
|
return array_intersect_key($data, array_flip(['valor', 'banco', 'tipo', 'identificador', 'fecha', 'uf', 'pagador', 'asociado']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,16 +46,15 @@ class PropiedadUnidad
|
|||||||
return $this->process($this->propiedadUnidadRepository->edit($propiedadUnidad, $data));
|
return $this->process($this->propiedadUnidadRepository->edit($propiedadUnidad, $data));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function process($unidad): Model\Venta\PropiedadUnidad
|
protected function process(Model\Venta\PropiedadUnidad $unidad): Model\Venta\PropiedadUnidad
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$unidad->precios = $this->precioService->getByUnidad($unidad->id);
|
$unidad->precios = $this->precioService->getByUnidad($unidad->id);
|
||||||
$unidad->currentPrecio = $this->precioService->getVigenteByUnidad($unidad->id);
|
$unidad->currentPrecio = $this->precioService->getVigenteByUnidad($unidad->id);
|
||||||
if ($unidad->valor === 0) {
|
if ($unidad->valor === 0 or $unidad->valor === null) {
|
||||||
$unidad->valor = $unidad->currentPrecio->valor;
|
$unidad->valor = $unidad->currentPrecio->valor;
|
||||||
}
|
}
|
||||||
} catch (EmptyResult) {
|
} catch (EmptyResult) {}
|
||||||
}
|
|
||||||
return $unidad;
|
return $unidad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user