From ff1e9ebb53b0072ba95d0b7b08c24cb8da73492b Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 1 Oct 2024 13:11:46 -0300 Subject: [PATCH] Optimizaciones --- app/src/Repository/Venta/Pago.php | 2 +- app/src/Service/Venta/PropiedadUnidad.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/Repository/Venta/Pago.php b/app/src/Repository/Venta/Pago.php index 886cb86..38c2443 100644 --- a/app/src/Repository/Venta/Pago.php +++ b/app/src/Repository/Venta/Pago.php @@ -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'])); } } diff --git a/app/src/Service/Venta/PropiedadUnidad.php b/app/src/Service/Venta/PropiedadUnidad.php index 29000ec..2995983 100644 --- a/app/src/Service/Venta/PropiedadUnidad.php +++ b/app/src/Service/Venta/PropiedadUnidad.php @@ -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; } }