|
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\Core\Tools; |
|
23
|
|
|
use FacturaScripts\Dinamic\Lib\AssetManager; |
|
|
|
|
|
|
24
|
|
|
use FacturaScripts\Dinamic\Model\NCFTipoPago; |
|
|
|
|
|
|
25
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\WebserviceDgii; |
|
26
|
|
|
|
|
27
|
|
|
class EditProveedor |
|
28
|
|
|
{ |
|
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
|
|
|
$ncfTipoPago = new NCFTipoPago(); |
|
37
|
|
|
$ncfTiposPago = $ncfTipoPago->findAllByTipopago('02'); |
|
38
|
|
|
$customValuesNTP = []; |
|
39
|
|
|
$customValuesNTP[] = ['value'=>'', 'title'=>'-----------']; |
|
40
|
|
|
foreach ($ncfTiposPago as $tipopago) { |
|
41
|
|
|
$customValuesNTP[] = ['value'=>$tipopago->codigo, 'title'=>$tipopago->descripcion]; |
|
42
|
|
|
} |
|
43
|
|
|
$columnToModifyNTP = $this->views['EditProveedor']->columnForName('ncf-payment-types'); |
|
|
|
|
|
|
44
|
|
|
if ($columnToModifyNTP) { |
|
45
|
|
|
$columnToModifyNTP->widget->setValuesFromArray($customValuesNTP); |
|
46
|
|
|
} |
|
47
|
|
|
}; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function execPreviousAction() |
|
51
|
|
|
{ |
|
52
|
|
|
return function ($action) { |
|
53
|
|
|
switch ($action) { |
|
54
|
|
|
case 'busca_rnc': |
|
55
|
|
|
$this->setTemplate(false); |
|
|
|
|
|
|
56
|
|
|
$consulta = new WebserviceDgii(); |
|
57
|
|
|
$rncNotFound = Tools::lang()->trans('rnc-not-found'); |
|
58
|
|
|
$respuesta = $consulta->getExternalAPI($_REQUEST['cifnif']); |
|
59
|
|
|
$registros = $respuesta->totalResults; |
|
60
|
|
|
if ($registros !== 0) { |
|
61
|
|
|
$resultado = $respuesta->entry[0]; |
|
62
|
|
|
if ($resultado) { |
|
63
|
|
|
$arrayResultado = []; |
|
64
|
|
|
$arrayResultado["RGE_RUC"] = $resultado->rnc; |
|
65
|
|
|
$arrayResultado["RGE_NOMBRE"] = $resultado->nombre; |
|
66
|
|
|
$arrayResultado["NOMBRE_COMERCIAL"] = $resultado->razonsocial; |
|
67
|
|
|
$arrayResultado["ESTATUS"] = $resultado->estado; |
|
68
|
|
|
echo json_encode($arrayResultado); |
|
69
|
|
|
} else { |
|
70
|
|
|
echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}'; |
|
71
|
|
|
} |
|
72
|
|
|
} else { |
|
73
|
|
|
echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}'; |
|
74
|
|
|
} |
|
75
|
|
|
break; |
|
76
|
|
|
default: |
|
77
|
|
|
break; |
|
78
|
|
|
} |
|
79
|
|
|
}; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
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