Merge branch 'develop' into feature/cierres

This commit is contained in:
Juan Pablo Vial
2025-10-17 12:28:27 -03:00
3 changed files with 14 additions and 3 deletions

View File

@ -4,6 +4,8 @@ namespace Incoviba\Service\Venta;
use Exception;
use DateTimeImmutable;
use DateMalformedStringException;
use Incoviba\Exception\ServiceAction\Read;
use Incoviba\Exception\ServiceAction\Update;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Ideal;
use Incoviba\Common\Implement\Exception\EmptyResult;
@ -56,13 +58,15 @@ class Escritura extends Ideal\Service
/**
* @throws EmptyResult
* @throws Read
* @throws Update
*/
public function edit(int $venta_id, array $data): Model\Venta\Escritura
{
$venta = $this->ventaService->getById($venta_id);
$estado = $venta->currentEstado();
if (!in_array($estado->tipoEstadoVenta->descripcion, ['escriturando', 'firmado por inmobiliaria'])) {
throw new EmptyResult('');
throw new Update(__CLASS__);
}
try {
$data['fecha'] = (new DateTimeImmutable($data['fecha']))->format('Y-m-d');