Issues (232)

Extension/Controller/EditFacturaCliente.php (7 issues)

1
<?php
2
/*
3
 * Copyright (C) 2020 Joe Nilson <[email protected]>
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as
7
 * published by the Free Software Foundation, either version 3 of the
8
 * License, or (at your option) any later version.
9
 *
10
 * This program 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
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Controller;
19
20
use Closure;
21
use FacturaScripts\Core\Tools;
22
use FacturaScripts\Dinamic\Lib\AssetManager;
0 ignored issues
show
The type FacturaScripts\Dinamic\Lib\AssetManager was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
use FacturaScripts\Dinamic\Model\NCFRango;
0 ignored issues
show
The type FacturaScripts\Dinamic\Model\NCFRango was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use FacturaScripts\Dinamic\Model\NCFTipo;
0 ignored issues
show
The type FacturaScripts\Dinamic\Model\NCFTipo was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
use FacturaScripts\Dinamic\Model\NCFTipoAnulacion;
0 ignored issues
show
The type FacturaScripts\Dinamic\Model\NCFTipoAnulacion was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\CommonFunctionsDominicanRepublic;
27
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\WebserviceDgii;
28
29
class EditFacturaCliente
30
{
31
    public function createViews(): Closure
32
    {
33
        return function () {
34
            parent::createViews();
35
            AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonModals.js');
0 ignored issues
show
The constant FS_ROUTE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
36
            AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js');
37
        };
38
    }
39
40
    public function execPreviousAction()
41
    {
42
        return function ($action) {
43
            switch ($action) {
44
                case 'busca_infocliente':
45
                    $this->setTemplate(false);
0 ignored issues
show
The method setTemplate() does not exist on FacturaScripts\Plugins\f...ller\EditFacturaCliente. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
                    $this->/** @scrutinizer ignore-call */ 
46
                           setTemplate(false);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
                    CommonFunctionsDominicanRepublic::ncfTipoCliente($_REQUEST['codcliente']);
47
                    break;
48
                case 'busca_tipo':
49
                    $this->setTemplate(false);
50
                    CommonFunctionsDominicanRepublic::ncfTipoComprobante($_REQUEST['tipodocumento']);
51
                    break;
52
                case 'busca_movimiento':
53
                    $this->setTemplate(false);
54
                    CommonFunctionsDominicanRepublic::ncfTipoMovimiento($_REQUEST['tipomovimiento']);
55
                    break;
56
                case 'busca_tipoanulacion':
57
                    $this->setTemplate(false);
58
                    CommonFunctionsDominicanRepublic::ncfTipoAnulacion($_REQUEST['tipoanulacion']);
59
                    break;
60
                case 'busca_pago':
61
                    $this->setTemplate(false);
62
                    CommonFunctionsDominicanRepublic::ncfTipoPago($_REQUEST['tipopago']);
63
                    break;
64
                case 'busca_correlativo':
65
                    $this->setTemplate(false);
66
                    CommonFunctionsDominicanRepublic::ncfCorrelativo($_REQUEST['tipocomprobante'], $this->empresa->idempresa);
0 ignored issues
show
Bug Best Practice introduced by
The property empresa does not exist on FacturaScripts\Plugins\f...ller\EditFacturaCliente. Did you maybe forget to declare it?
Loading history...
67
                    break;
68
                case 'busca_rnc':
69
                    $this->setTemplate(false);
70
                    $consulta = new WebserviceDgii();
71
                    $rncNotFound = Tools::lang()->trans('rnc-not-found');
72
                    $respuesta = $consulta->getExternalAPI($_REQUEST['cifnif']);
73
                    $registros = $respuesta->totalResults;
74
                    if ($registros !== 0) {
75
                        $resultado = $respuesta->entry[0];
76
                        if ($resultado) {
77
                            $arrayResultado = [];
78
                            $arrayResultado["RGE_RUC"] = $resultado->rnc;
79
                            $arrayResultado["RGE_NOMBRE"] = $resultado->nombre;
80
                            $arrayResultado["NOMBRE_COMERCIAL"] = $resultado->razonsocial;
81
                            $arrayResultado["ESTATUS"] = $resultado->estado;
82
                            echo json_encode($arrayResultado);
83
                        } else {
84
                            echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}';
85
                        }
86
                    } else {
87
                        echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}';
88
                    }
89
                    break;
90
                default:
91
                    break;
92
            }
93
            parent::execPreviousAction($action);
94
        };
95
    }
96
97
    public function ncftipo()
98
    {
99
        return function () {
100
            return NCFTipo::allVentas();
101
        };
102
    }
103
104
    public function ncftipoanulacion()
105
    {
106
        return function () {
107
            $tiposAnulacion = new NCFTipoAnulacion();
108
            return $tiposAnulacion->all();
109
        };
110
    }
111
}