Issues (232)

Extension/Controller/EditFacturaProveedor.php (8 issues)

1
<?php
2
/*
3
 * Copyright (C) 2021 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\Base\DataBase\DataBaseWhere;
0 ignored issues
show
The type FacturaScripts\Core\Base\DataBase\DataBaseWhere 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...
22
use FacturaScripts\Core\Tools;
23
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...
24
use FacturaScripts\Dinamic\Model\FacturaProveedor;
0 ignored issues
show
The type FacturaScripts\Dinamic\Model\FacturaProveedor 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\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...
26
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...
27
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\CommonFunctionsDominicanRepublic;
28
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\WebserviceDgii;
29
30
class EditFacturaProveedor
31
{
32
    public function createViews(): Closure
33
    {
34
        return function () {
35
            parent::createViews();
36
            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...
37
            AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js');
38
        };
39
    }
40
41
    public function execPreviousAction()
42
    {
43
        return function ($action) {
44
            switch ($action) {
45
                case 'busca_tipo':
46
                    $this->setTemplate(false);
0 ignored issues
show
The method setTemplate() does not exist on FacturaScripts\Plugins\f...er\EditFacturaProveedor. ( Ignorable by Annotation )

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

46
                    $this->/** @scrutinizer ignore-call */ 
47
                           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...
47
                    CommonFunctionsDominicanRepublic::ncfTipoComprobante($_REQUEST['tipodocumento']);
48
                    break;
49
                case 'busca_movimiento':
50
                    $this->setTemplate(false);
51
                    CommonFunctionsDominicanRepublic::ncfTipoMovimiento($_REQUEST['tipomovimiento']);
52
                    break;
53
                case 'busca_tipoanulacion':
54
                    $this->setTemplate(false);
55
                    CommonFunctionsDominicanRepublic::ncfTipoAnulacion($_REQUEST['tipoanulacion']);
56
                    break;
57
                case 'busca_pago':
58
                    $this->setTemplate(false);
59
                    CommonFunctionsDominicanRepublic::ncfTipoPago($_REQUEST['tipopago']);
60
                    break;
61
                case "verifica_documento":
62
                    $this->setTemplate(false);
63
                    CommonFunctionsDominicanRepublic::verifyDocument($_REQUEST['ncf'],$_REQUEST['proveedor']);
64
                    break;
65
                case 'busca_correlativo':
66
                    $this->setTemplate(false);
67
                    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...er\EditFacturaProveedor. Did you maybe forget to declare it?
Loading history...
68
                    break;
69
                case 'busca_rnc':
70
                    $this->setTemplate(false);
71
                    $consulta = new WebserviceDgii();
72
                    $rncNotFound = Tools::lang()->trans('rnc-not-found');
73
                    $respuesta = $consulta->getExternalAPI($_REQUEST['cifnif']);
74
                    $registros = $respuesta->totalResults;
75
                    if ($registros !== 0) {
76
                        $resultado = $respuesta->entry[0];
77
                        if ($resultado) {
78
                            $arrayResultado = [];
79
                            $arrayResultado["RGE_RUC"] = $resultado->rnc;
80
                            $arrayResultado["RGE_NOMBRE"] = $resultado->nombre;
81
                            $arrayResultado["NOMBRE_COMERCIAL"] = $resultado->razonsocial;
82
                            $arrayResultado["ESTATUS"] = $resultado->estado;
83
                            echo json_encode($arrayResultado);
84
                        } else {
85
                            echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}';
86
                        }
87
                    } else {
88
                        echo '{"RGE_ERROR": "true", "message": "'.$rncNotFound.'"}';
89
                    }
90
                    break;
91
                default:
92
                    break;
93
            }
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
}