Completed
Push — master ( 542744...262806 )
by Joe Nilson
02:06 queued 02:06
created
Labels
Severity
1
<?php
2
/*
3
 * Copyright (C) 2020 Joe Zegarra.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 3 of the License, or (at your option) any later version.
9
 *
10
 * This library 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 GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA 02110-1301  USA
19
 */
20
21
namespace FacturaScripts\Plugins\fsRepublicaDominicana;
22
23
use FacturaScripts\Core\Base\DataBase\DataBaseWhere;
24
use FacturaScripts\Core\Base\InitClass;
25
use FacturaScripts\Dinamic\Lib\AssetManager;
26
use FacturaScripts\Dinamic\Model\Cliente;
27
use FacturaScripts\Dinamic\Model\EstadoDocumento;
28
use FacturaScripts\Dinamic\Model\FacturaCliente;
29
use FacturaScripts\Dinamic\Model\Proveedor;
30
use FacturaScripts\Dinamic\Model\FacturaProveedor;
31
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFRango;
32
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipo;
33
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoAnulacion;
34
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoMovimiento;
35
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoPago;
36
use FFacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFDGIIDB;
0 ignored issues
show
The type FFacturaScripts\Plugins\...inicana\Model\NCFDGIIDB 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...
37
38
/**
39
 * Description of Init
40
 *
41
 * @author Joe Zegarra
42
 */
43
class Init extends InitClass
44
{
45
    public function init()
46
    {
47
        $this->loadExtension(new Extension\Model\Cliente());
48
        $this->loadExtension(new Extension\Model\FacturaCliente());
49
        $this->loadExtension(new Extension\Model\FacturaProveedor());
50
        $this->loadExtension(new Extension\Model\Producto());
51
        $this->loadExtension(new Extension\Controller\EditCliente());
52
        $this->loadExtension(new Extension\Controller\EditProveedor());
53
        $this->loadExtension(new Extension\Controller\EditFacturaCliente());
54
        $this->loadExtension(new Extension\Controller\EditFacturaProveedor());
55
        AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js');
56
    }
57
58
    private function ActualizarEstados()
59
    {
60
        $arrayDocumentos = [
61
            'FacturaCliente',
62
            'FacturaProveedor',
63
            'AlbaranCliente',
64
            'AlbaranProveedor',
65
            'PedidoCliente',
66
            'PedidoProveedor'
67
        ];
68
        $estados = new EstadoDocumento();
69
70
        foreach ($arrayDocumentos as $documento) {
71
            $lista = $estados->all(
72
                [
73
                    new DataBaseWhere('nombre', 'Anulada'),
74
                    new DataBaseWhere('tipodoc', $documento)
75
                ]
76
            );
77
78
            if (count($lista) === 0) {
79
                $nuevoDocumento = new EstadoDocumento();
80
                $nuevoDocumento->nombre = 'Anulada';
81
                $nuevoDocumento->tipodoc = $documento;
82
                $nuevoDocumento->icon = 'fas fa-handshake-slash';
83
                $nuevoDocumento->editable = false;
84
                $nuevoDocumento->bloquear = true;
85
                $nuevoDocumento->actualizastock = 0;
86
                $nuevoDocumento->predeterminado = false;
87
                $nuevoDocumento->save();
88
            }
89
        }
90
    }
91
    
92
    public function update()
93
    {
94
        new NCFTipoPago();
95
        new NCFTipoAnulacion();
96
        new NCFTipoMovimiento();
97
        new NCFTipo();
98
        new NCFRango();
99
        new Cliente();
100
        new FacturaCliente();
101
        new Proveedor();
102
        new FacturaProveedor();
103
        new NCFDGIIDB();
104
        $this->ActualizarEstados();
105
    }
106
}
107