Merge branch 'develop' into feature/cierres
This commit is contained in:
@ -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');
|
||||
|
||||
Reference in New Issue
Block a user