FIX: Venta nueva no se ingresaba

This commit is contained in:
Juan Pablo Vial
2024-02-13 17:59:46 -03:00
parent ba0d4073d7
commit e542615128
5 changed files with 51 additions and 16 deletions

View File

@ -22,7 +22,7 @@ class Propietario extends Ideal\Repository
public function create(?array $data = null): Define\Model
{
$map = (new Implement\Repository\MapperParser(['dv', 'nombres']))
$map = (new Implement\Repository\MapperParser(['rut', 'dv', 'nombres']))
->register('apellido_paterno', (new Implement\Repository\Mapper())
->setProperty('apellidos')
->setFunction(function($data) {
@ -64,8 +64,8 @@ class Propietario extends Ideal\Repository
public function save(Define\Model $model): Define\Model
{
$model->rut = $this->saveNew(
['dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'otro', 'representante'],
[$model->dv, $model->nombres, $model->apellidos['paterno'], $model->apellidos['materno'], $model->datos->direccion->id, $model->otro->rut ?? 0, $model->representante->rut ?? 0]
['rut', 'dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'otro', 'representante'],
[$model->rut, $model->dv, $model->nombres, $model->apellidos['paterno'], $model->apellidos['materno'], $model->datos->direccion->id, $model->otro->rut ?? 0, $model->representante->rut ?? 0]
);
return $model;
}