Agregar datos propietario
This commit is contained in:
@ -63,24 +63,31 @@ class Propietario extends Ideal\Repository
|
||||
return $data['otro'] !== 0;
|
||||
})
|
||||
->setDefault(null));
|
||||
return $this->parseData(new Model\Venta\Propietario(), $data, $map);
|
||||
$model = $this->parseData(new Model\Venta\Propietario(), $data, $map);
|
||||
if (array_key_exists('email', $data)) {
|
||||
$model->datos->email = $data['email'];
|
||||
}
|
||||
if (array_key_exists('telefono', $data)) {
|
||||
$model->datos->telefono = $data['telefono'];
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function save(Define\Model $model): Define\Model
|
||||
{
|
||||
$this->saveNew(
|
||||
['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->contacto->rut ?? 0]
|
||||
['rut', 'dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'email', 'telefono', 'otro', 'representante'],
|
||||
[$model->rut, $model->dv, $model->nombres, $model->apellidos['paterno'], $model->apellidos['materno'], $model->datos?->direccion->id, $model->datos?->email, $model->datos?->telefono, $model->otro->rut ?? 0, $model->contacto->rut ?? 0]
|
||||
);
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function edit(Define\Model $model, array $new_data): Define\Model
|
||||
{
|
||||
return $this->update($model, ['dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'otro', 'representante'], $new_data);
|
||||
return $this->update($model, ['dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'email', 'telefono', 'otro', 'representante'], $new_data);
|
||||
}
|
||||
public function filterData(array $data): array
|
||||
{
|
||||
return array_intersect_key($data, array_flip(['rut', 'dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'representante']));
|
||||
return array_intersect_key($data, array_flip(['rut', 'dv', 'nombres', 'apellido_paterno', 'apellido_materno', 'direccion', 'email', 'telefono', 'otro', 'representante']));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user