1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (C) 2020 Joe Nilson <joenilson at gmail dot com> |
4
|
|
|
* |
5
|
|
|
* fsRepublicaDominicana is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* |
10
|
|
|
* fsRepublicaDominicana is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
* GNU Lesser General Public License for more details. |
14
|
|
|
* |
15
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
16
|
|
|
* along with fsRepublicaDominicana. If not, see <http://www.gnu.org/licenses/>. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Controller; |
20
|
|
|
|
21
|
|
|
use Closure; |
22
|
|
|
use FacturaScripts\Dinamic\Lib\AssetManager; |
|
|
|
|
23
|
|
|
use FacturaScripts\Dinamic\Model\NCFTipo; |
|
|
|
|
24
|
|
|
use FacturaScripts\Dinamic\Model\NCFTipoPago; |
|
|
|
|
25
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\WebserviceDgii; |
26
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoMovimiento; |
27
|
|
|
|
28
|
|
|
class EditCliente |
29
|
|
|
{ |
30
|
|
|
public function createViews(): Closure |
31
|
|
|
{ |
32
|
|
|
return function () { |
33
|
|
|
AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonModals.js'); |
|
|
|
|
34
|
|
|
AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js'); |
35
|
|
|
AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/BusquedaRNCDGII.js'); |
36
|
|
|
$ncfTipo = new NCFTipo(); |
37
|
|
|
$ncfTipos = $ncfTipo->allFor('ventas', 'suma'); |
38
|
|
|
$customValues = []; |
39
|
|
|
$customValues[] = ['value'=>'', 'title'=>'-----------']; |
40
|
|
|
foreach ($ncfTipos as $tipo) { |
41
|
|
|
$customValues[] = ['value'=>$tipo->tipocomprobante, 'title'=>$tipo->descripcion]; |
42
|
|
|
} |
43
|
|
|
$columnToModify = $this->views['EditCliente']->columnForName('tipocomprobante'); |
|
|
|
|
44
|
|
|
if ($columnToModify) { |
45
|
|
|
$columnToModify->widget->setValuesFromArray($customValues); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
$ncfTipoPago = new NCFTipoPago(); |
49
|
|
|
$ncfTiposPago = $ncfTipoPago->findAllByTipopago('01'); |
50
|
|
|
$customValuesNTP = []; |
51
|
|
|
$customValuesNTP[] = ['value'=>'', 'title'=>'-----------']; |
52
|
|
|
foreach ($ncfTiposPago as $tipopago) { |
53
|
|
|
$customValuesNTP[] = ['value'=>$tipopago->codigo, 'title'=>$tipopago->descripcion]; |
54
|
|
|
} |
55
|
|
|
$columnToModifyNTP = $this->views['EditCliente']->columnForName('ncf-payment-types'); |
56
|
|
|
if ($columnToModifyNTP) { |
57
|
|
|
$columnToModifyNTP->widget->setValuesFromArray($customValuesNTP); |
58
|
|
|
} |
59
|
|
|
}; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function execPreviousAction() |
63
|
|
|
{ |
64
|
|
|
return function ($action) { |
65
|
|
|
switch ($action) { |
66
|
|
|
case 'busca_rnc': |
67
|
|
|
$this->setTemplate(false); |
|
|
|
|
68
|
|
|
$consulta = new WebserviceDgii(); |
69
|
|
|
$rncNotFound = self::toolBox()->i18n()->trans('rnc-not-found'); |
|
|
|
|
70
|
|
|
$respuesta = $consulta->getExternalAPI($_REQUEST['cifnif']); |
71
|
|
|
$registros = $respuesta->totalResults; |
72
|
|
|
if ($registros !== 0) { |
73
|
|
|
$resultado = $respuesta->entry[0]; |
74
|
|
|
if ($resultado) { |
75
|
|
|
$arrayResultado = []; |
76
|
|
|
$arrayResultado["RGE_RUC"] = $resultado->rnc; |
77
|
|
|
$arrayResultado["RGE_NOMBRE"] = $resultado->nombre; |
78
|
|
|
$arrayResultado["NOMBRE_COMERCIAL"] = $resultado->razonsocial; |
79
|
|
|
$arrayResultado["ESTATUS"] = $resultado->estado; |
80
|
|
|
echo json_encode($arrayResultado); |
81
|
|
|
} else { |
82
|
|
|
echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}'; |
83
|
|
|
} |
84
|
|
|
} else { |
85
|
|
|
echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}'; |
86
|
|
|
} |
87
|
|
|
break; |
88
|
|
|
default: |
89
|
|
|
break; |
90
|
|
|
} |
91
|
|
|
}; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths