Optimizaciones

This commit is contained in:
Juan Pablo Vial
2024-10-01 13:11:46 -03:00
parent 599880ae27
commit ff1e9ebb53
2 changed files with 4 additions and 5 deletions

View File

@ -119,6 +119,6 @@ WHERE venta_id = ?";
}
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']));
}
}

View File

@ -46,16 +46,15 @@ class PropiedadUnidad
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 {
$unidad->precios = $this->precioService->getByUnidad($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;
}
} catch (EmptyResult) {
}
} catch (EmptyResult) {}
return $unidad;
}
}