FIX: Precio Unidad no existe en venta y facturacion

This commit is contained in:
2023-12-13 13:28:19 -03:00
parent 94906eea8c
commit 1ba53c9e12
3 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@ class Unidad extends Ideal\Model
public array $precios = [];
public ?Precio $currentPrecio = null;
public function precio(DateTimeInterface $dateTime): Precio
public function precio(DateTimeInterface $dateTime): ?Precio
{
if ($this->currentPrecio !== null and $dateTime > $this->currentPrecio->current->fecha) {
return $this->currentPrecio;
@ -41,9 +41,6 @@ class Unidad extends Ideal\Model
return $min->current->fecha < $precio->current->fecha ? $min : $precio;
});
}
if ($precio === null) {
throw new EmptyResult('SELECT * FROM precio WHERE unidad = ? AND fecha = ?');
}
return $precio;
}