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; |
||
0 ignored issues
–
show
|
|||
24 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
25 | use FacturaScripts\Core\Base\InitClass; |
||
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\InitClass 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
26 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
27 | use FacturaScripts\Dinamic\Model\Cliente; |
||
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\Cliente 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
28 | use FacturaScripts\Dinamic\Model\EstadoDocumento; |
||
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\EstadoDocumento 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
29 | use FacturaScripts\Dinamic\Model\FacturaCliente; |
||
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\FacturaCliente 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
30 | use FacturaScripts\Dinamic\Model\Proveedor; |
||
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\Proveedor 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
31 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
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; |
||
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\AjaxForms\SalesFooterHTML 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
39 | use FacturaScripts\Core\Base\AjaxForms\PurchasesFooterHTML; |
||
0 ignored issues
–
show
The type
FacturaScripts\Core\Base...rms\PurchasesFooterHTML 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
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'); |
||
0 ignored issues
–
show
|
|||
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