FIX: Venta nueva no se ingresaba
This commit is contained in:
@ -1,28 +1,37 @@
|
||||
<?php
|
||||
namespace Incoviba\Service\Venta;
|
||||
|
||||
use Incoviba\Common\Ideal\Service;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Repository;
|
||||
use Incoviba\Model;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Propietario
|
||||
class Propietario extends Service
|
||||
{
|
||||
public function __construct(
|
||||
LoggerInterface $logger,
|
||||
protected Repository\Venta\Propietario $propietarioRepository,
|
||||
protected Repository\Direccion $direccionRepository
|
||||
) {}
|
||||
) {
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
public function addPropietario(array $data): Model\Venta\Propietario
|
||||
{
|
||||
$direccion = $this->addDireccion($data);
|
||||
$data['direccion'] = $direccion->id;
|
||||
$data['dv'] = 'i';
|
||||
|
||||
if (str_contains($data['rut'], '-')) {
|
||||
$data['rut'] = explode('-', $data['rut'])[0];
|
||||
list($rut, $dv) = explode('-', $data['rut']);
|
||||
$data['rut'] = $rut;
|
||||
$data['dv'] = $dv;
|
||||
}
|
||||
|
||||
$fields = array_fill_keys([
|
||||
'rut',
|
||||
'dv',
|
||||
'nombres',
|
||||
'apellido_paterno',
|
||||
'apellido_materno',
|
||||
|
Reference in New Issue
Block a user