From 0d5c9efd6890283508aa71d6fdb6fca7c15b26d3 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Wed, 3 Jul 2024 17:20:26 -0400 Subject: [PATCH] FIX: Mostrar unidad principal en busqueda --- app/src/Controller/API/Search.php | 4 ---- app/src/Repository/Venta.php | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/Controller/API/Search.php b/app/src/Controller/API/Search.php index ae76f3b..4270b3c 100644 --- a/app/src/Controller/API/Search.php +++ b/app/src/Controller/API/Search.php @@ -107,10 +107,6 @@ class Search } catch (Exception\EmptyRedis) { try { $venta = $ventaService->getById($venta_id); - /*$output['venta'] = [ - 'id' => $venta->id, - '' - ];*/ $output['venta'] = $venta; $this->saveRedis($redisService, $redisKey, $output['venta']); } catch (Exception\EmptyResult) {} diff --git a/app/src/Repository/Venta.php b/app/src/Repository/Venta.php index 00941dc..540e0ed 100644 --- a/app/src/Repository/Venta.php +++ b/app/src/Repository/Venta.php @@ -2,6 +2,7 @@ namespace Incoviba\Repository; use PDO; +use Psr\Log\LoggerInterface; use Incoviba\Common\Ideal; use Incoviba\Common\Define; use Incoviba\Common\Implement; @@ -12,6 +13,7 @@ class Venta extends Ideal\Repository { public function __construct( Define\Connection $connection, + protected LoggerInterface $logger, protected Venta\Propietario $propietarioRepository, protected Venta\Propiedad $propiedadRepository, protected Service\Venta\Pie $pieService, @@ -373,7 +375,8 @@ class Venta extends Ideal\Repository ->joined('JOIN (SELECT ev1.* FROM estado_venta ev1 JOIN (SELECT MAX(id) AS id, venta FROM estado_venta GROUP BY venta) ev0 ON ev0.id = ev1.id) ev ON ev.venta = venta.id') ->joined('JOIN tipo_estado_venta tev ON ev.estado = tev.id') ->where('venta.id = ?') - ->group('venta.id'); + ->order('tu.orden') + ->limit(1); return $this->connection->execute($query, [$venta_id])->fetch(PDO::FETCH_ASSOC); } public function fetchByIdForList(int $venta_id): array