This commit is contained in:
Juan Pablo Vial
2025-03-03 14:57:22 -03:00
parent d165440483
commit 8f16f33a1e
56 changed files with 749 additions and 105 deletions

View File

@ -129,6 +129,13 @@ class Unidad extends Ideal\Repository
->where("a.`descripcion` LIKE ? AND tu.`descripcion` = ? AND (pu.`id` IS NULL OR `venta`.`id` IS NULL OR tev.`activa` = 0)");
return $this->fetchMany($query, [$descripcion, $tipo]);
}
/**
* @param string $descripcion
* @param string $tipo
* @return array
* @throws Implement\Exception\EmptyResult
*/
public function fetchDisponiblesIdsByDescripcionAndTipo(string $descripcion, string $tipo): array
{
$query = $this->connection->getQueryBuilder()
@ -141,7 +148,11 @@ class Unidad extends Ideal\Repository
LEFT OUTER JOIN (SELECT ev1.* FROM `estado_venta` ev1 JOIN (SELECT MAX(`id`) as 'id', `venta` FROM `estado_venta`) ev0 ON ev0.`id` = ev1.`id`) ev ON ev.`venta` = `venta`.`id`
LEFT OUTER JOIN `tipo_estado_venta` tev ON tev.`id` = ev.`estado`")
->where("a.`descripcion` LIKE ? AND tu.`descripcion` = ? AND (pu.`id` IS NULL OR `venta`.`id` IS NULL OR tev.`activa` = 0)");
return $this->connection->execute($query, [$descripcion, $tipo])->fetchAll(PDO::FETCH_ASSOC);
try {
return $this->connection->execute($query, [$descripcion, $tipo])->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $exception) {
throw new Implement\Exception\EmptyResult($query, $exception);
}
}
public function fetchByIdForSearch(int $unidad_id): array
{