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; |
|
|
|
|
24
|
|
|
use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
|
|
|
|
25
|
|
|
use FacturaScripts\Core\Base\InitClass; |
|
|
|
|
26
|
|
|
use FacturaScripts\Dinamic\Lib\AssetManager; |
|
|
|
|
27
|
|
|
use FacturaScripts\Dinamic\Model\Cliente; |
|
|
|
|
28
|
|
|
use FacturaScripts\Dinamic\Model\EstadoDocumento; |
|
|
|
|
29
|
|
|
use FacturaScripts\Dinamic\Model\FacturaCliente; |
|
|
|
|
30
|
|
|
use FacturaScripts\Dinamic\Model\Proveedor; |
|
|
|
|
31
|
|
|
use FacturaScripts\Dinamic\Model\FacturaProveedor; |
|
|
|
|
32
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFRango; |
33
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipo; |
34
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoAnulacion; |
35
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoMovimiento; |
36
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoPago; |
37
|
|
|
|
38
|
|
|
use FacturaScripts\Core\Base\AjaxForms\SalesFooterHTML; |
|
|
|
|
39
|
|
|
use FacturaScripts\Core\Base\AjaxForms\PurchasesFooterHTML; |
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Description of Init |
43
|
|
|
* |
44
|
|
|
* @author Joe Zegarra |
45
|
|
|
*/ |
46
|
|
|
class Init extends InitClass |
47
|
|
|
{ |
48
|
|
|
public function init(): void |
49
|
|
|
{ |
50
|
|
|
$this->loadExtension(new Extension\Model\Cliente()); |
51
|
|
|
$this->loadExtension(new Extension\Model\FacturaCliente()); |
52
|
|
|
$this->loadExtension(new Extension\Model\FacturaProveedor()); |
53
|
|
|
$this->loadExtension(new Extension\Model\Producto()); |
54
|
|
|
$this->loadExtension(new Extension\Controller\EditCliente()); |
55
|
|
|
$this->loadExtension(new Extension\Controller\EditProveedor()); |
56
|
|
|
$this->loadExtension(new Extension\Controller\EditFacturaCliente()); |
57
|
|
|
$this->loadExtension(new Extension\Controller\EditFacturaProveedor()); |
58
|
|
|
AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js'); |
|
|
|
|
59
|
|
|
SalesFooterHTML::addMod(new Mod\SalesFooterMod()); |
60
|
|
|
PurchasesFooterHTML::addMod(new Mod\PurchasesFooterMod()); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
private function actualizarEstados(): void |
64
|
|
|
{ |
65
|
|
|
$arrayDocumentos = [ |
66
|
|
|
'FacturaCliente', |
67
|
|
|
'FacturaProveedor', |
68
|
|
|
'AlbaranCliente', |
69
|
|
|
'AlbaranProveedor', |
70
|
|
|
'PedidoCliente', |
71
|
|
|
'PedidoProveedor' |
72
|
|
|
]; |
73
|
|
|
$estados = new EstadoDocumento(); |
74
|
|
|
|
75
|
|
|
foreach ($arrayDocumentos as $documento) { |
76
|
|
|
$lista = $estados->all( |
77
|
|
|
[ |
78
|
|
|
new DataBaseWhere('nombre', 'Anulada'), |
79
|
|
|
new DataBaseWhere('tipodoc', $documento) |
80
|
|
|
] |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
if (count($lista) === 0) { |
84
|
|
|
$nuevoDocumento = new EstadoDocumento(); |
85
|
|
|
$nuevoDocumento->nombre = 'Anulada'; |
86
|
|
|
$nuevoDocumento->tipodoc = $documento; |
87
|
|
|
$nuevoDocumento->icon = 'fas fa-handshake-slash'; |
88
|
|
|
$nuevoDocumento->editable = false; |
89
|
|
|
$nuevoDocumento->bloquear = true; |
90
|
|
|
$nuevoDocumento->actualizastock = 0; |
91
|
|
|
$nuevoDocumento->predeterminado = false; |
92
|
|
|
$nuevoDocumento->save(); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
private function actualizarNumeroNCF(): void |
98
|
|
|
{ |
99
|
|
|
$dataBase = new DataBase(); |
100
|
|
|
$dataBase->exec("UPDATE facturascli SET numeroncf = numero2 WHERE numero2 != '' and tipocomprobante != '' AND numeroncf is null;"); |
101
|
|
|
$dataBase->exec("UPDATE facturasprov SET numeroncf = numproveedor WHERE numproveedor != '' and tipocomprobante != '' AND numeroncf is null;"); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function update() |
105
|
|
|
{ |
106
|
|
|
new NCFTipoPago(); |
107
|
|
|
new NCFTipoAnulacion(); |
108
|
|
|
new NCFTipoMovimiento(); |
109
|
|
|
new NCFTipo(); |
110
|
|
|
new NCFRango(); |
111
|
|
|
new Cliente(); |
112
|
|
|
new FacturaCliente(); |
113
|
|
|
new Proveedor(); |
114
|
|
|
new FacturaProveedor(); |
115
|
|
|
$this->actualizarEstados(); |
116
|
|
|
$this->actualizarNumeroNCF(); |
117
|
|
|
} |
118
|
|
|
} |
119
|
|
|
|
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