joenilson /
fsRepublicaDominicana
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Copyright (C) 2020 joenilson. |
||||||
| 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\Extension\Model; |
||||||
| 22 | |||||||
| 23 | use Cassandra\Date; |
||||||
| 24 | use Closure; |
||||||
| 25 | use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 26 | use FacturaScripts\Core\Tools; |
||||||
| 27 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 28 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 29 | use FacturaScripts\Dinamic\Model\NCFTipoMovimiento; |
||||||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\NCFTipoMovimiento 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 Loading history...
|
|||||||
| 30 | use FacturaScripts\Dinamic\Model\Cliente; |
||||||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
FacturaScripts\Plugins\f...Extension\Model\Cliente. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
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 Loading history...
|
|||||||
| 31 | use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\DGII\CommonModelFunctions; |
||||||
| 32 | |||||||
| 33 | /** |
||||||
| 34 | * Description of FacturaCliente |
||||||
| 35 | * |
||||||
| 36 | * @author joenilson |
||||||
| 37 | */ |
||||||
| 38 | class FacturaCliente |
||||||
| 39 | { |
||||||
| 40 | /** |
||||||
| 41 | * @var Date |
||||||
| 42 | */ |
||||||
| 43 | public $ncffechavencimiento; |
||||||
| 44 | /** |
||||||
| 45 | * @var string |
||||||
| 46 | */ |
||||||
| 47 | public $tipocomprobante; |
||||||
| 48 | /** |
||||||
| 49 | * @var string |
||||||
| 50 | */ |
||||||
| 51 | public $numeroncf; |
||||||
| 52 | /** |
||||||
| 53 | * |
||||||
| 54 | * @var string |
||||||
| 55 | */ |
||||||
| 56 | public $ncftipopago; |
||||||
| 57 | /** |
||||||
| 58 | * |
||||||
| 59 | * @var string |
||||||
| 60 | */ |
||||||
| 61 | public $ncftipomovimiento; |
||||||
| 62 | /** |
||||||
| 63 | * |
||||||
| 64 | * @var string |
||||||
| 65 | */ |
||||||
| 66 | public $ncftipoanulacion; |
||||||
| 67 | |||||||
| 68 | /** |
||||||
| 69 | * @var string |
||||||
| 70 | */ |
||||||
| 71 | public $facturarectnumero2; |
||||||
| 72 | |||||||
| 73 | public $ecf_trackid = null; |
||||||
| 74 | |||||||
| 75 | public $ecf_estado_dgii = null; |
||||||
| 76 | |||||||
| 77 | public $ecf_codigo_seguridad = null; |
||||||
| 78 | |||||||
| 79 | /** |
||||||
| 80 | * @var \DateTime |
||||||
| 81 | */ |
||||||
| 82 | public $ecf_fecha_firma = null; |
||||||
| 83 | |||||||
| 84 | public $ecf_pdf_firmado = null; |
||||||
| 85 | public $ecf_xml_firmado = null; |
||||||
| 86 | |||||||
| 87 | public function saveBefore(): Closure |
||||||
| 88 | { |
||||||
| 89 | return function () { |
||||||
| 90 | if (null !== $this->codigorect && $this->idfactura === null) { |
||||||
| 91 | $this->cleanRefundData(); |
||||||
| 92 | } |
||||||
| 93 | $cliente = new Cliente(); |
||||||
| 94 | $actualCliente = $cliente::find($this->codcliente); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 95 | |||||||
| 96 | if (null === $actualCliente) { |
||||||
| 97 | Tools::log()->error("no-customer-found"); |
||||||
| 98 | return false; |
||||||
| 99 | } |
||||||
| 100 | |||||||
| 101 | $actualCliente->idempresa = Tools::settings('default', 'idempresa'); |
||||||
| 102 | $this->tipocomprobante = $this->tipocomprobante ?? $actualCliente->tipocomprobante; |
||||||
| 103 | $this->tipocomprobante = $_REQUEST['tipocomprobanter'] ?? $this->tipocomprobante; |
||||||
| 104 | $this->ecf_fecha_firma = $_REQUEST['ecf_fecha_firma'] ?? NULL; |
||||||
| 105 | if ($this->tipocomprobante !== '' && \in_array($this->numeroncf, ['', null], true)) { |
||||||
| 106 | $tipocomprobante = "02"; |
||||||
| 107 | if (($this->tipocomprobante !== null) === true) { |
||||||
| 108 | $tipocomprobante = $this->tipocomprobante; |
||||||
| 109 | } elseif (($this->tipocomprobante === null) === true) { |
||||||
| 110 | $tipocomprobante = $actualCliente->tipocomprobante; |
||||||
| 111 | } |
||||||
| 112 | |||||||
| 113 | $ncfrango = new NCFRango(); |
||||||
| 114 | if (!CommonModelFunctions::setCFRango($actualCliente, $ncfrango, $tipocomprobante, $this)) return false; |
||||||
| 115 | |||||||
| 116 | $arrayNCFTypes = ['03','04']; |
||||||
| 117 | if (in_array($this->tipocomprobante, $arrayNCFTypes) === true) { |
||||||
| 118 | $this->ncftipoanulacion = $_REQUEST['ncftipoanulacionr'] ?? $this->ncftipoanulacion; |
||||||
| 119 | $this->ncffechavencimiento = $_REQUEST['ncffechavencimientor'] ?? $this->ncffechavencimiento; |
||||||
| 120 | } |
||||||
| 121 | } |
||||||
| 122 | $this->ncffechavencimiento = ($this->ncffechavencimiento === '') ? null : $this->ncffechavencimiento; |
||||||
| 123 | return $this; |
||||||
| 124 | }; |
||||||
| 125 | } |
||||||
| 126 | |||||||
| 127 | public function all(): Closure |
||||||
| 128 | { |
||||||
| 129 | return function () { |
||||||
| 130 | $this->facturarectnumero2 = ''; |
||||||
| 131 | if ($this->idfacturarect !== '') { |
||||||
|
0 ignored issues
–
show
|
|||||||
| 132 | $facturaRectificativa = $this->get($this->idfacturarect); |
||||||
|
0 ignored issues
–
show
The method
get() does not exist on FacturaScripts\Plugins\f...on\Model\FacturaCliente.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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...
|
|||||||
| 133 | $this->loadFromData(['facturarectnumero2' => 'SI' ]); |
||||||
|
0 ignored issues
–
show
The method
loadFromData() does not exist on FacturaScripts\Plugins\f...on\Model\FacturaCliente.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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...
|
|||||||
| 134 | $this->facturarectnumero2 = $facturaRectificativa->numero2; |
||||||
| 135 | } else { |
||||||
| 136 | $this->loadFromData(['facturarectnumero2' => 'NO HAY']); |
||||||
| 137 | } |
||||||
| 138 | return $this; |
||||||
| 139 | }; |
||||||
| 140 | } |
||||||
| 141 | |||||||
| 142 | public function descripcionTipoComprobante(): Closure |
||||||
| 143 | { |
||||||
| 144 | return function () { |
||||||
| 145 | $ncftipocomprobante = new NCFTipo(); |
||||||
| 146 | $ncftipocomprobante->load($this->tipocomprobante); |
||||||
| 147 | return $ncftipocomprobante->descripcion; |
||||||
| 148 | }; |
||||||
| 149 | } |
||||||
| 150 | protected function cleanRefundData() |
||||||
| 151 | { |
||||||
| 152 | return function () { |
||||||
| 153 | $this->numeroncf = ''; |
||||||
| 154 | $this->tipocomprobante = null; |
||||||
| 155 | $this->ncffechavencimiento = null; |
||||||
| 156 | $this->ncftipomovimiento = null; |
||||||
| 157 | $this->ncftipopago = null; |
||||||
| 158 | }; |
||||||
| 159 | } |
||||||
| 160 | } |
||||||
| 161 |
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