Completed
Pull Request — master (#63)
by
unknown
01:49
created
lib/Sii/EnvioDte.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     /**
44 44
      * Método que agrega un DTE al listado que se enviará
45
-     * @param DTE Objeto del DTE
45
+     * @param DTE Dte del DTE
46 46
      * @return =true si se pudo agregar el DTE o =false si no se agregó por exceder el límite de un envío
47 47
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
48 48
      * @version 2015-12-11
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     /**
396 396
      * Método que determina el estado de validación sobre el envío
397 397
      * @param datos Arreglo con datos para hacer las validaciones
398
-     * @return Código del estado de la validación
398
+     * @return integer del estado de la validación
399 399
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
400 400
      * @version 2019-07-03
401 401
      */
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -135,8 +135,9 @@  discard block
 block discarded – undo
135 135
     public function generar()
136 136
     {
137 137
         // si ya se había generado se entrega directamente
138
-        if ($this->xml_data)
139
-            return $this->xml_data;
138
+        if ($this->xml_data) {
139
+                    return $this->xml_data;
140
+        }
140 141
         // si no hay DTEs para generar entregar falso
141 142
         if (!isset($this->dtes[0])) {
142 143
             \sasco\LibreDTE\Log::write(
@@ -185,8 +186,9 @@  discard block
 block discarded – undo
185 186
         $SubTotDTE = [];
186 187
         $subtotales = [];
187 188
         foreach ($this->dtes as &$DTE) {
188
-            if (!isset($subtotales[$DTE->getTipo()]))
189
-                $subtotales[$DTE->getTipo()] = 0;
189
+            if (!isset($subtotales[$DTE->getTipo()])) {
190
+                            $subtotales[$DTE->getTipo()] = 0;
191
+            }
190 192
             $subtotales[$DTE->getTipo()]++;
191 193
         }
192 194
         foreach ($subtotales as $tipo => $subtotal) {
@@ -301,8 +303,9 @@  discard block
 block discarded – undo
301 303
     {
302 304
         $fecha = '9999-12-31';
303 305
         foreach ($this->getDocumentos() as $Dte) {
304
-            if ($Dte->getFechaEmision() < $fecha)
305
-                $fecha = $Dte->getFechaEmision();
306
+            if ($Dte->getFechaEmision() < $fecha) {
307
+                            $fecha = $Dte->getFechaEmision();
308
+            }
306 309
         }
307 310
         return $fecha;
308 311
     }
@@ -316,8 +319,9 @@  discard block
 block discarded – undo
316 319
     {
317 320
         $fecha = '0000-01-01';
318 321
         foreach ($this->getDocumentos() as $Dte) {
319
-            if ($Dte->getFechaEmision() > $fecha)
320
-                $fecha = $Dte->getFechaEmision();
322
+            if ($Dte->getFechaEmision() > $fecha) {
323
+                            $fecha = $Dte->getFechaEmision();
324
+            }
321 325
         }
322 326
         return $fecha;
323 327
     }
@@ -371,8 +375,9 @@  discard block
 block discarded – undo
371 375
         $DTEs = $this->xml->getElementsByTagName('DTE');
372 376
         foreach ($DTEs as $nodo_dte) {
373 377
             $e = $nodo_dte->getElementsByTagName('RUTEmisor')->item(0)->nodeValue;
374
-            if (is_numeric($emisor))
375
-                $e = substr($e, 0, -2);
378
+            if (is_numeric($emisor)) {
379
+                            $e = substr($e, 0, -2);
380
+            }
376 381
             $d = (int)$nodo_dte->getElementsByTagName('TipoDTE')->item(0)->nodeValue;
377 382
             $f = (int)$nodo_dte->getElementsByTagName('Folio')->item(0)->nodeValue;
378 383
             if ($folio == $f and $dte == $d and $emisor == $e) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 {
33 33
 
34 34
     private $dtes = []; ///< Objetos con los DTE que se enviarán
35
-    private $config = [ // 0: DTE, 1: boleta
35
+    private $config = [// 0: DTE, 1: boleta
36 36
         'SubTotDTE_max' => [20, 2], ///< máxima cantidad de tipos de documentos en el envío
37 37
         'DTE_max' => [2000, 1000], ///< máxima cantidad de DTE en un envío
38 38
         'tipos' => ['EnvioDTE', 'EnvioBOLETA'], ///< Tag para el envío, según si son Boletas o no
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
     public function agregar(Dte $DTE)
51 51
     {
52 52
         // determinar el tipo del envío (DTE o boleta)
53
-        if ($this->tipo === null) {
53
+        if ($this->tipo===null) {
54 54
             $this->tipo = (int)$DTE->esBoleta();
55 55
         }
56 56
         // validar que el tipo de documento sea del tipo que se espera
57
-        else if ((int)$DTE->esBoleta() != $this->tipo) {
57
+        else if ((int)$DTE->esBoleta()!=$this->tipo) {
58 58
             return false;
59 59
         }
60 60
         //
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                 'RutEnvia' => $Dte->getEmisor(),
222 222
                 'RutReceptor' => $Dte->getReceptor(),
223 223
                 'FchResol' => date('Y-m-d'),
224
-                'NroResol' => ($Dte->getCertificacion()?'0':'').'9999',
224
+                'NroResol' => ($Dte->getCertificacion() ? '0' : '').'9999',
225 225
             ]);
226 226
             if (!parent::loadXML($this->generar())) {
227 227
                 return false;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     {
302 302
         $fecha = '9999-12-31';
303 303
         foreach ($this->getDocumentos() as $Dte) {
304
-            if ($Dte->getFechaEmision() < $fecha)
304
+            if ($Dte->getFechaEmision()<$fecha)
305 305
                 $fecha = $Dte->getFechaEmision();
306 306
         }
307 307
         return $fecha;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $fecha = '0000-01-01';
318 318
         foreach ($this->getDocumentos() as $Dte) {
319
-            if ($Dte->getFechaEmision() > $fecha)
319
+            if ($Dte->getFechaEmision()>$fecha)
320 320
                 $fecha = $Dte->getFechaEmision();
321 321
         }
322 322
         return $fecha;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                 $e = substr($e, 0, -2);
376 376
             $d = (int)$nodo_dte->getElementsByTagName('TipoDTE')->item(0)->nodeValue;
377 377
             $f = (int)$nodo_dte->getElementsByTagName('Folio')->item(0)->nodeValue;
378
-            if ($folio == $f and $dte == $d and $emisor == $e) {
378
+            if ($folio==$f and $dte==$d and $emisor==$e) {
379 379
                 return new Dte($nodo_dte->C14N(), false); // cargar DTE sin normalizar
380 380
             }
381 381
         }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $SignatureValue = trim(str_replace(["\n", ' ', "\t"], '', $Signatures->item($Signatures->length-1)->getElementsByTagName('SignatureValue')->item(0)->nodeValue));
434 434
         $X509Certificate = trim(str_replace(["\n", ' ', "\t"], '', $Signatures->item($Signatures->length-1)->getElementsByTagName('X509Certificate')->item(0)->nodeValue));
435 435
         $X509Certificate = '-----BEGIN CERTIFICATE-----'."\n".wordwrap($X509Certificate, 64, "\n", true)."\n".'-----END CERTIFICATE-----';
436
-        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate) === 1 ? true : false;
436
+        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate)===1 ? true : false;
437 437
         return $valid and $DigestValue===base64_encode(sha1($SetDTE, true));
438 438
     }
439 439
 
Please login to merge, or discard this patch.
lib/XML.php 3 patches
Doc Comments   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      * Método que genera nodos XML a partir de un arreglo
53 53
      * @param data Arreglo con los datos que se usarán para generar XML
54 54
      * @param namespace Arreglo con el espacio de nombres para el XML que se generará (URI y prefijo)
55
-     * @param parent DOMElement padre para los elementos, o =null para que sea la raíz
56
-     * @return Objeto \sasco\LibreDTE\XML
55
+     * @param parent \DOMElement padre para los elementos, o =null para que sea la raíz
56
+     * @return XML \sasco\LibreDTE\XML
57 57
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
58 58
      * @version 2017-10-22
59 59
      */
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     /**
154 154
      * Método para realizar consultas XPATH al documento XML
155 155
      * @param expression Expresión XPath a ejecutar
156
-     * @return DOMNodeList
156
+     * @return \DOMNodeList
157 157
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
158 158
      * @version 2015-08-05
159 159
      */
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      * Método que cuenta los nodos con el mismo nombre hijos de un DOMElement
284 284
      * No sirve usar: $dom->getElementsByTagName($tagName)->length ya que esto
285 285
      * entrega todos los nodos con el nombre, sean hijos, nietos, etc.
286
-     * @return Cantidad de nodos hijos con el mismo nombre en el DOMElement
286
+     * @return integer de nodos hijos con el mismo nombre en el DOMElement
287 287
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
288 288
      * @version 2015-09-07
289 289
      */
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 
325 325
     /**
326 326
      * Método que entrega el nombre del archivo del schema del XML
327
-     * @return Nombre del schema o bien =false si no se encontró
327
+     * @return string del schema o bien =false si no se encontró
328 328
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
329 329
      * @version 2015-12-14
330 330
      */
@@ -366,6 +366,7 @@  discard block
 block discarded – undo
366 366
      * respeta el estándar y las requiere convertidas
367 367
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
368 368
      * @version 2017-01-20
369
+     * @param string $xml
369 370
      */
370 371
     private function fixEntities($xml)
371 372
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     private function utf2iso($string)
199 199
     {
200
-        return mb_detect_encoding($string, ['UTF-8', 'ISO-8859-1']) != 'ISO-8859-1' ? utf8_decode($string) : $string;
200
+        return mb_detect_encoding($string, ['UTF-8', 'ISO-8859-1'])!='ISO-8859-1' ? utf8_decode($string) : $string;
201 201
     }
202 202
 
203 203
     /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         }
241 241
         // si existen nodos hijos se agregan
242 242
         if ($dom->hasChildNodes()) {
243
-            foreach($dom->childNodes as $child) {
243
+            foreach ($dom->childNodes as $child) {
244 244
                 if ($child instanceof \DOMText) {
245 245
                     $textContent = trim($child->textContent);
246 246
                     if ($textContent!="") {
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $newXML = '';
373 373
         $n_letras = strlen($xml);
374 374
         $convertir = false;
375
-        for ($i=0; $i<$n_letras; ++$i) {
375
+        for ($i = 0; $i<$n_letras; ++$i) {
376 376
             if ($xml[$i]=='>')
377 377
                 $convertir = true;
378 378
             if ($xml[$i]=='<')
Please login to merge, or discard this patch.
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -120,8 +120,9 @@  discard block
 block discarded – undo
120 120
     private function sanitize($txt)
121 121
     {
122 122
         // si no se paso un texto o bien es un número no se hace nada
123
-        if (!$txt or is_numeric($txt))
124
-            return $txt;
123
+        if (!$txt or is_numeric($txt)) {
124
+                    return $txt;
125
+        }
125 126
         // convertir "predefined entities" de XML
126 127
         $txt = str_replace(
127 128
             ['&amp;', '&#38;', '&lt;', '&#60;', '&gt;', '&#62', '&quot;', '&#34;', '&apos;', '&#39;'],
@@ -174,8 +175,9 @@  discard block
 block discarded – undo
174 175
     {
175 176
         if ($xpath) {
176 177
             $node = $this->xpath($xpath)->item(0);
177
-            if (!$node)
178
-                return false;
178
+            if (!$node) {
179
+                            return false;
180
+            }
179 181
             $xml = $this->utf2iso($node->C14N());
180 182
             $xml = $this->fixEntities($xml);
181 183
         } else {
@@ -250,8 +252,7 @@  discard block
 block discarded – undo
250 252
                             $array[$dom->tagName]['@value'] = $textContent;
251 253
                         }
252 254
                     }
253
-                }
254
-                else if ($child instanceof \DOMElement) {
255
+                } else if ($child instanceof \DOMElement) {
255 256
                     $nodos_gemelos = $this->countTwins($dom, $child->tagName);
256 257
                     // agregar nodo hijo directamente, ya que es el único nodo hijo con el mismo nombre de tag
257 258
                     if ($nodos_gemelos==1) {
@@ -307,8 +308,9 @@  discard block
 block discarded – undo
307 308
     public function getErrors()
308 309
     {
309 310
         $errors = [];
310
-        foreach (libxml_get_errors() as $e)
311
-            $errors[] = $e->message;
311
+        foreach (libxml_get_errors() as $e) {
312
+                    $errors[] = $e->message;
313
+        }
312 314
         return $errors;
313 315
     }
314 316
 
@@ -331,8 +333,9 @@  discard block
 block discarded – undo
331 333
     public function getSchema()
332 334
     {
333 335
         $schemaLocation = $this->documentElement->getAttribute('xsi:schemaLocation');
334
-        if (!$schemaLocation or strpos($schemaLocation, ' ')===false)
335
-            return false;
336
+        if (!$schemaLocation or strpos($schemaLocation, ' ')===false) {
337
+                    return false;
338
+        }
336 339
         list($uri, $xsd) = explode(' ', $schemaLocation);
337 340
         return $xsd;
338 341
     }
@@ -373,10 +376,12 @@  discard block
 block discarded – undo
373 376
         $n_letras = strlen($xml);
374 377
         $convertir = false;
375 378
         for ($i=0; $i<$n_letras; ++$i) {
376
-            if ($xml[$i]=='>')
377
-                $convertir = true;
378
-            if ($xml[$i]=='<')
379
-                $convertir = false;
379
+            if ($xml[$i]=='>') {
380
+                            $convertir = true;
381
+            }
382
+            if ($xml[$i]=='<') {
383
+                            $convertir = false;
384
+            }
380 385
             if ($convertir) {
381 386
                 $l = $xml[$i]=='\'' ? '&apos;' : ($xml[$i]=='"' ? '&quot;' : $xml[$i]);
382 387
             } else {
Please login to merge, or discard this patch.
lib/Sii/Aduana.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -852,8 +852,7 @@
 block discarded – undo
852 852
             $valor = $codigo['CantBultos'].' '.$valor;
853 853
             if (!empty($codigo['IdContainer'])) {
854 854
                 $valor .= ' ('.$codigo['IdContainer'].' / '.$codigo['Sello'].' / '.$codigo['EmisorSello'].')';
855
-            }
856
-            else if (!empty($codigo['Marcas'])) {
855
+            } else if (!empty($codigo['Marcas'])) {
857 856
                 $valor .= ' ('.$codigo['Marcas'].')';
858 857
             }
859 858
         } else {
Please login to merge, or discard this patch.
lib/Sii/RegistroCompraVenta.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     ]; ///< Tipos de transacciones o caracterizaciones/clasificaciones de las compras
64 64
 
65 65
     public static $estados_ok = [
66
-        7,  // Evento registrado previamente
67
-        8,  // Pasados 8 días después de la recepción no es posible registrar reclamos o eventos
66
+        7, // Evento registrado previamente
67
+        8, // Pasados 8 días después de la recepción no es posible registrar reclamos o eventos
68 68
         27, // No se puede registrar un evento (acuse de recibo, reclamo o aceptación de contenido) de un DTE pagado al contado o gratuito
69 69
     ]; ///< Código de estado de respuesta de la asignación de estado que son considerados como OK
70 70
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::REQUEST_ERROR_SOAP, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::REQUEST_ERROR_SOAP, $msg));
243 243
             return false;
244 244
         }
245
-        for ($i=0; $i<$retry; $i++) {
245
+        for ($i = 0; $i<$retry; $i++) {
246 246
             try {
247 247
                 $body = call_user_func_array([$soap, $request], $args);
248 248
                 break;
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     /**
79 79
      * Constructor, obtiene el token de la sesión y lo guarda
80
-     * @param Firma Objeto con la firma electrónica
80
+     * @param Firma \sasco\LibreDTE\FirmaElectronica con la firma electrónica
81 81
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
82 82
      * @version 2017-08-28
83 83
      */
@@ -119,6 +119,8 @@  discard block
 block discarded – undo
119 119
      * Método que entrega los eventos asociados a un DTE
120 120
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
121 121
      * @version 2017-08-28
122
+     * @param string $dte
123
+     * @param string $folio
122 124
      */
123 125
     public function listarEventosHistDoc($rut, $dv, $dte, $folio)
124 126
     {
@@ -206,10 +208,10 @@  discard block
 block discarded – undo
206 208
 
207 209
     /**
208 210
      * Método para realizar una solicitud al servicio web del SII
209
-     * @param request Nombre de la función que se ejecutará en el servicio web
211
+     * @param request string de la función que se ejecutará en el servicio web
210 212
      * @param args Argumentos que se pasarán al servicio web
211
-     * @param retry Intentos que se realizarán como máximo para obtener respuesta
212
-     * @return Objeto o String con la respuesta (depende servicio web)
213
+     * @param retry integer que se realizarán como máximo para obtener respuesta
214
+     * @return string o String con la respuesta (depende servicio web)
213 215
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
214 216
      * @version 2020-02-12
215 217
      */
Please login to merge, or discard this patch.
lib/Sii/Dte/PDF/Dte.php 3 patches
Doc Comments   +32 added lines, -28 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * Método que asigna la ubicación del logo de la empresa
81 81
      * @param logo URI del logo (puede ser local o en una URL)
82
-     * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta
82
+     * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta
83 83
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
84 84
      * @version 2016-08-04
85 85
      */
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      * contínuo de 80mm
323 323
      * @param dte Arreglo con los datos del XML (tag Documento)
324 324
      * @param timbre String XML con el tag TED del DTE
325
-     * @param width Ancho del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm)
325
+     * @param width integer del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm)
326 326
      * @author Pablo Reyes (https://github.com/pabloxp)
327 327
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
328 328
      * @version 2019-10-06
@@ -480,10 +480,11 @@  discard block
 block discarded – undo
480 480
      *  - Dirección casa central del emisor
481 481
      *  - Dirección sucursales
482 482
      * @param emisor Arreglo con los datos del emisor (tag Emisor del XML)
483
-     * @param x Posición horizontal de inicio en el PDF
484
-     * @param y Posición vertical de inicio en el PDF
485
-     * @param w Ancho de la información del emisor
486
-     * @param w_img Ancho máximo de la imagen
483
+     * @param x integer horizontal de inicio en el PDF
484
+     * @param y integer vertical de inicio en el PDF
485
+     * @param w integer de la información del emisor
486
+     * @param w_img integer máximo de la imagen
487
+     * @param integer $font_size
487 488
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
488 489
      * @version 2019-11-22
489 490
      */
@@ -592,11 +593,13 @@  discard block
 block discarded – undo
592 593
      * @param rut RUT del emisor
593 594
      * @param tipo Código o glosa del tipo de documento
594 595
      * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor
595
-     * @param x Posición horizontal de inicio en el PDF
596
-     * @param y Posición vertical de inicio en el PDF
597
-     * @param w Ancho de la información del emisor
596
+     * @param x integer horizontal de inicio en el PDF
597
+     * @param y integer vertical de inicio en el PDF
598
+     * @param w integer de la información del emisor
599
+     * @param integer $font_size
598 600
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
599 601
      * @version 2019-08-05
602
+     * @return integer
600 603
      */
601 604
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
602 605
     {
@@ -628,7 +631,7 @@  discard block
 block discarded – undo
628 631
      * Método que agrega los datos de la emisión del DTE que no son los dato del
629 632
      * receptor
630 633
      * @param IdDoc Información general del documento
631
-     * @param x Posición horizontal de inicio en el PDF
634
+     * @param x integer horizontal de inicio en el PDF
632 635
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
633 636
      * @version 2017-06-15
634 637
      */
@@ -716,7 +719,7 @@  discard block
 block discarded – undo
716 719
     /**
717 720
      * Método que agrega los datos del receptor
718 721
      * @param receptor Arreglo con los datos del receptor (tag Receptor del XML)
719
-     * @param x Posición horizontal de inicio en el PDF
722
+     * @param x integer horizontal de inicio en el PDF
720 723
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
721 724
      * @version 2019-10-06
722 725
      */
@@ -803,7 +806,7 @@  discard block
 block discarded – undo
803 806
      * Método que agrega los datos del traslado
804 807
      * @param IndTraslado
805 808
      * @param Transporte
806
-     * @param x Posición horizontal de inicio en el PDF
809
+     * @param x integer horizontal de inicio en el PDF
807 810
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
808 811
      * @version 2016-08-03
809 812
      */
@@ -883,7 +886,7 @@  discard block
 block discarded – undo
883 886
     /**
884 887
      * Método que agrega las referencias del documento
885 888
      * @param referencias Arreglo con las referencias del documento (tag Referencia del XML)
886
-     * @param x Posición horizontal de inicio en el PDF
889
+     * @param x integer horizontal de inicio en el PDF
887 890
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
888 891
      * @version 2017-09-25
889 892
      */
@@ -920,7 +923,7 @@  discard block
 block discarded – undo
920 923
     /**
921 924
      * Método que agrega el detalle del documento
922 925
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
923
-     * @param x Posición horizontal de inicio en el PDF
926
+     * @param x integer horizontal de inicio en el PDF
924 927
      * @param y Posición vertical de inicio en el PDF
925 928
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
926 929
      * @version 2019-07-09
@@ -1020,7 +1023,7 @@  discard block
 block discarded – undo
1020 1023
     /**
1021 1024
      * Método que agrega el detalle del documento
1022 1025
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
1023
-     * @param x Posición horizontal de inicio en el PDF
1026
+     * @param x integer horizontal de inicio en el PDF
1024 1027
      * @param y Posición vertical de inicio en el PDF
1025 1028
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1026 1029
      * @author Pablo Reyes (https://github.com/pabloxp)
@@ -1064,7 +1067,7 @@  discard block
 block discarded – undo
1064 1067
      * Método que agrega el subtotal del DTE
1065 1068
      * @param detalle Arreglo con los detalles del documentos para poder
1066 1069
      * calcular subtotal
1067
-     * @param x Posición horizontal de inicio en el PDF
1070
+     * @param x integer horizontal de inicio en el PDF
1068 1071
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1069 1072
      * @version 2016-08-17
1070 1073
      */
@@ -1090,7 +1093,7 @@  discard block
 block discarded – undo
1090 1093
     /**
1091 1094
      * Método que agrega los descuentos y/o recargos globales del documento
1092 1095
      * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML)
1093
-     * @param x Posición horizontal de inicio en el PDF
1096
+     * @param x integer horizontal de inicio en el PDF
1094 1097
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1095 1098
      * @version 2018-05-29
1096 1099
      */
@@ -1118,7 +1121,7 @@  discard block
 block discarded – undo
1118 1121
     /**
1119 1122
      * Método que agrega los pagos del documento
1120 1123
      * @param pagos Arreglo con los pagos del documento
1121
-     * @param x Posición horizontal de inicio en el PDF
1124
+     * @param x integer horizontal de inicio en el PDF
1122 1125
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1123 1126
      * @version 2016-07-24
1124 1127
      */
@@ -1276,9 +1279,10 @@  discard block
 block discarded – undo
1276 1279
      *  - Se imprime en el tamaño mínimo: 2x5 cms
1277 1280
      *  - En el lado de abajo con margen izquierdo mínimo de 2 cms
1278 1281
      * @param timbre String con los datos del timbre
1279
-     * @param x Posición horizontal de inicio en el PDF
1280
-     * @param y Posición vertical de inicio en el PDF
1281
-     * @param w Ancho del timbre
1282
+     * @param x integer horizontal de inicio en el PDF
1283
+     * @param y integer vertical de inicio en el PDF
1284
+     * @param w integer del timbre
1285
+     * @param string $position
1282 1286
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1283 1287
      * @version 2019-10-06
1284 1288
      */
@@ -1316,10 +1320,10 @@  discard block
 block discarded – undo
1316 1320
 
1317 1321
     /**
1318 1322
      * Método que agrega el acuse de rebido
1319
-     * @param x Posición horizontal de inicio en el PDF
1320
-     * @param y Posición vertical de inicio en el PDF
1321
-     * @param w Ancho del acuse de recibo
1322
-     * @param h Alto del acuse de recibo
1323
+     * @param x integer horizontal de inicio en el PDF
1324
+     * @param y integer vertical de inicio en el PDF
1325
+     * @param w integer del acuse de recibo
1326
+     * @param h integer del acuse de recibo
1323 1327
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1324 1328
      * @version 2019-10-06
1325 1329
      */
@@ -1347,10 +1351,10 @@  discard block
 block discarded – undo
1347 1351
 
1348 1352
     /**
1349 1353
      * Método que agrega el acuse de rebido
1350
-     * @param x Posición horizontal de inicio en el PDF
1354
+     * @param x integer horizontal de inicio en el PDF
1351 1355
      * @param y Posición vertical de inicio en el PDF
1352
-     * @param w Ancho del acuse de recibo
1353
-     * @param h Alto del acuse de recibo
1356
+     * @param w integer del acuse de recibo
1357
+     * @param h integer del acuse de recibo
1354 1358
      * @author Pablo Reyes (https://github.com/pabloxp)
1355 1359
      * @version 2015-11-17
1356 1360
      */
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         parent::__construct();
75 75
         $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE');
76
-        $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo;
76
+        $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo;
77 77
     }
78 78
 
79 79
     /**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $this->Ln();
183 183
         // datos del documento
184 184
         $y = [];
185
-        $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null);
185
+        $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null);
186 186
         $y[] = $this->agregarReceptor($dte['Encabezado']);
187 187
         $this->setY(max($y));
188 188
         $this->agregarTraslado(
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]);
232 232
         $x = 1;
233 233
         $y = 5;
234
-        $this->SetXY($x,$y);
234
+        $this->SetXY($x, $y);
235 235
         // agregar datos del documento
236 236
         $this->setFont('', '', 8);
237 237
         $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2);
@@ -345,15 +345,15 @@  discard block
 block discarded – undo
345 345
             $dte['Encabezado']['IdDoc']['TipoDTE'],
346 346
             $dte['Encabezado']['IdDoc']['Folio'],
347 347
             $dte['Encabezado']['Emisor']['CmnaOrigen'],
348
-            $x_start, $y_start, $width-($x_start*4), 10,
349
-            [0,0,0]
348
+            $x_start, $y_start, $width-($x_start * 4), 10,
349
+            [0, 0, 0]
350 350
         );
351
-        $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]);
351
+        $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]);
352 352
         // datos del documento
353 353
         $this->SetY($y);
354 354
         $this->Ln();
355 355
         $this->setFont('', '', 8);
356
-        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false);
356
+        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false);
357 357
         $this->agregarReceptor($dte['Encabezado'], $x_start, $offset);
358 358
         $this->agregarTraslado(
359 359
             !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null,
@@ -423,14 +423,14 @@  discard block
 block discarded – undo
423 423
             2,
424 424
             45,
425 425
             9,
426
-            [0,0,0]
426
+            [0, 0, 0]
427 427
         );
428
-        $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0,0,0], $y[0]);
428
+        $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0, 0, 0], $y[0]);
429 429
         $this->SetY(max($y));
430 430
         $this->Ln();
431 431
         // datos del documento
432 432
         $this->setFont('', '', 8);
433
-        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false);
433
+        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false);
434 434
         $this->agregarReceptor($dte['Encabezado'], $x_start, $offset);
435 435
         $this->agregarTraslado(
436 436
             !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null,
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         if ($this->cedible and !in_array($dte['Encabezado']['IdDoc']['TipoDTE'], $this->sinAcuseRecibo)) {
463 463
             $this->agregarAcuseRecibo(63, $y+6, 45, 40, 15);
464 464
             $this->setFont('', 'B', 8);
465
-            $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52?' CON SU FACTURA':''), $x_start, $this->y+1, 'L');
465
+            $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52 ? ' CON SU FACTURA' : ''), $x_start, $this->y+1, 'L');
466 466
         }
467 467
         // si el alto no se pasó, entonces es con autocálculo, se elimina esta página y se pasa el alto
468 468
         // que se logró determinar para crear la página con el alto correcto
@@ -493,16 +493,16 @@  discard block
 block discarded – undo
493 493
         // logo del documento
494 494
         if (isset($this->logo)) {
495 495
             // logo centrado (papel continuo)
496
-            if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') {
496
+            if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') {
497 497
                 $logo_w = null;
498 498
                 $logo_y = null;
499 499
                 $logo_position = 'C';
500 500
                 $logo_next_pointer = 'N';
501 501
             }
502 502
             // logo a la derecha (posicion=0) o arriba (posicion=1)
503
-            else if (empty($this->logo['posicion']) or $this->logo['posicion'] == 1) {
503
+            else if (empty($this->logo['posicion']) or $this->logo['posicion']==1) {
504 504
                 $logo_w = !$this->logo['posicion'] ? $w_img : null;
505
-                $logo_y = $this->logo['posicion'] ? $w_img/2 : null;
505
+                $logo_y = $this->logo['posicion'] ? $w_img / 2 : null;
506 506
                 $logo_position = '';
507 507
                 $logo_next_pointer = 'T';
508 508
             }
@@ -521,17 +521,17 @@  discard block
 block discarded – undo
521 521
                 $logo_w,
522 522
                 $logo_y,
523 523
                 'PNG',
524
-                (isset($emisor['url'])?$emisor['url']:''),
524
+                (isset($emisor['url']) ? $emisor['url'] : ''),
525 525
                 $logo_next_pointer,
526 526
                 2,
527 527
                 300,
528 528
                 $logo_position
529 529
             );
530
-            if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') {
530
+            if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') {
531 531
                 $w += 40;
532 532
             } else {
533 533
                 if ($this->logo['posicion']) {
534
-                    $this->SetY($this->y + ($w_img/2));
534
+                    $this->SetY($this->y+($w_img / 2));
535 535
                     $w += 40;
536 536
                 } else {
537 537
                     $x = $this->x+3;
@@ -544,19 +544,19 @@  discard block
 block discarded – undo
544 544
         // agregar datos del emisor
545 545
         if ($agregarDatosEmisor) {
546 546
             $this->setFont('', 'B', $font_size ? $font_size : 14);
547
-            $this->SetTextColorArray($color===null?[32, 92, 144]:$color);
548
-            $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
547
+            $this->SetTextColorArray($color===null ? [32, 92, 144] : $color);
548
+            $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
549 549
             $this->setFont('', 'B', $font_size ? $font_size : 9);
550
-            $this->SetTextColorArray([0,0,0]);
551
-            $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
550
+            $this->SetTextColorArray([0, 0, 0]);
551
+            $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
552 552
             $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null;
553 553
             $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna);
554
-            $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
554
+            $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
555 555
             if (!empty($emisor['Sucursal'])) {
556
-                $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
556
+                $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
557 557
             }
558 558
             if (!empty($this->casa_matriz)) {
559
-                $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
559
+                $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
560 560
             }
561 561
             $contacto = [];
562 562
             if (!empty($emisor['Telefono'])) {
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
                 $contacto[] = $emisor['CorreoEmisor'];
572 572
             }
573 573
             if ($contacto) {
574
-                $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
574
+                $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
575 575
             }
576 576
         }
577 577
         return $this->y;
@@ -601,12 +601,12 @@  discard block
 block discarded – undo
601 601
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
602 602
     {
603 603
         if ($color===null) {
604
-            $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0];
604
+            $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0];
605 605
         }
606 606
         $this->SetTextColorArray($color);
607 607
         // colocar rut emisor, glosa documento y folio
608 608
         list($rut, $dv) = explode('-', $rut);
609
-        $this->setFont ('', 'B', $font_size ? $font_size : 15);
609
+        $this->setFont('', 'B', $font_size ? $font_size : 15);
610 610
         $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w);
611 611
         $this->setFont('', 'B', $font_size ? $font_size : 12);
612 612
         $this->MultiTexto($this->getTipo($tipo, $folio), $x, null, 'C', $w);
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
         if ($tipo) {
620 620
             $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w);
621 621
         }
622
-        $this->SetTextColorArray([0,0,0]);
622
+        $this->SetTextColorArray([0, 0, 0]);
623 623
         $this->Ln();
624 624
         return $this->y;
625 625
     }
@@ -733,10 +733,10 @@  discard block
 block discarded – undo
733 733
         }
734 734
         if (!empty($receptor['RznSocRecep'])) {
735 735
             $this->setFont('', 'B', null);
736
-            $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10?'Razón social':'Razón soc.'), $x);
736
+            $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10 ? 'Razón social' : 'Razón soc.'), $x);
737 737
             $this->Texto(':', $x+$offset);
738 738
             $this->setFont('', '', null);
739
-            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0);
739
+            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
740 740
         }
741 741
         if (!empty($receptor['GiroRecep'])) {
742 742
             $this->setFont('', 'B', null);
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
             $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : (
754 754
                 !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : ''
755 755
             );
756
-            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2);
756
+            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2);
757 757
         }
758 758
         if (!empty($receptor['Extranjero']['Nacionalidad'])) {
759 759
             $this->setFont('', 'B', null);
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
             $this->Texto('Cód. recep.', $x);
795 795
             $this->Texto(':', $x+$offset);
796 796
             $this->setFont('', '', null);
797
-            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0);
797
+            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
798 798
         }
799 799
         return $this->GetY();
800 800
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     {
892 892
         if (!isset($referencias[0]))
893 893
             $referencias = [$referencias];
894
-        foreach($referencias as $r) {
894
+        foreach ($referencias as $r) {
895 895
             $texto = $r['NroLinRef'].' - ';
896 896
             if (!empty($r['TpoDocRef'])) {
897 897
                 $texto .= $this->getTipo($r['TpoDocRef']).' ';
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
             // quitar columnas
944 944
             foreach ($item as $col => $valor) {
945 945
                 if ($col=='DscItem' and !empty($item['DscItem'])) {
946
-                    $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': ';
946
+                    $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': ';
947 947
                     if ($html) {
948 948
                         $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>';
949 949
                     } else {
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
             }
992 992
             $item = array_merge($item_default, $item);
993 993
             // si hay código de item se extrae su valor
994
-            if (!empty($item['CdgItem']['VlrCodigo'])){
994
+            if (!empty($item['CdgItem']['VlrCodigo'])) {
995 995
                 $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
996 996
             }
997 997
             // dar formato a números
@@ -1034,9 +1034,9 @@  discard block
 block discarded – undo
1034 1034
         $this->SetY($this->getY()+1);
1035 1035
         $p1x = $x;
1036 1036
         $p1y = $this->y;
1037
-        $p2x = $this->getPageWidth() - 2;
1038
-        $p2y = $p1y;  // Use same y for a straight line
1039
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1037
+        $p2x = $this->getPageWidth()-2;
1038
+        $p2y = $p1y; // Use same y for a straight line
1039
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1040 1040
         $this->Line($p1x, $p1y, $p2x, $p2y, $style);
1041 1041
         $this->Texto($this->detalle_cols['NmbItem']['title'], $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1042 1042
         $this->Texto($this->detalle_cols['PrcItem']['title'], $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
@@ -1047,13 +1047,13 @@  discard block
 block discarded – undo
1047 1047
             $detalle = [$detalle];
1048 1048
         }
1049 1049
         $this->SetY($this->getY()+2);
1050
-        foreach($detalle as  &$d) {
1050
+        foreach ($detalle as  &$d) {
1051 1051
             $item = $d['NmbItem'];
1052 1052
             if ($descripcion and !empty($d['DscItem'])) {
1053 1053
                 $item .= ': '.$d['DscItem'];
1054 1054
             }
1055 1055
             $this->MultiTexto($item, $x+$offsets[0], $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1056
-            $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1056
+            $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1057 1057
             $this->Texto($this->num($d['QtyItem']), $x+$offsets[2], $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
1058 1058
             $this->Texto($this->num($d['MontoItem']), $x+$offsets[3], $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']);
1059 1059
         }
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
         if (!isset($detalle[0])) {
1074 1074
             $detalle = [$detalle];
1075 1075
         }
1076
-        foreach($detalle as  &$d) {
1076
+        foreach ($detalle as  &$d) {
1077 1077
             if (!empty($d['MontoItem'])) {
1078 1078
                 $subtotal += $d['MontoItem'];
1079 1079
             }
@@ -1099,16 +1099,16 @@  discard block
 block discarded – undo
1099 1099
         if (!isset($descuentosRecargos[0])) {
1100 1100
             $descuentosRecargos = [$descuentosRecargos];
1101 1101
         }
1102
-        foreach($descuentosRecargos as $dr) {
1102
+        foreach ($descuentosRecargos as $dr) {
1103 1103
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1104 1104
             if (!empty($dr['IndExeDR'])) {
1105 1105
                 $tipo .= ' EX';
1106 1106
             }
1107 1107
             $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']);
1108 1108
             if ($this->papelContinuo) {
1109
-                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x);
1109
+                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x);
1110 1110
             } else {
1111
-                $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100);
1111
+                $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100);
1112 1112
                 $this->Texto($valor, 177, null, 'R', 22);
1113 1113
             }
1114 1114
             $this->Ln();
@@ -1128,8 +1128,8 @@  discard block
 block discarded – undo
1128 1128
             $pagos = [$pagos];
1129 1129
         $this->Texto('Pago(s) programado(s):', $x);
1130 1130
         $this->Ln();
1131
-        foreach($pagos as $p) {
1132
-            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x);
1131
+        foreach ($pagos as $p) {
1132
+            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x);
1133 1133
             $this->Ln();
1134 1134
         }
1135 1135
     }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
             if (!isset($ImptoReten[0])) {
1181 1181
                 $ImptoReten = [$ImptoReten];
1182 1182
             }
1183
-            foreach($ImptoReten as $i) {
1183
+            foreach ($ImptoReten as $i) {
1184 1184
                 $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp'];
1185 1185
                 if (!empty($i['TasaImp'])) {
1186 1186
                     $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $';
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
                 'vpadding' => 0,
1294 1294
                 'module_width' => 1, // width of a single module in points
1295 1295
                 'module_height' => 1, // height of a single module in points
1296
-                'fgcolor' => [0,0,0],
1296
+                'fgcolor' => [0, 0, 0],
1297 1297
                 'bgcolor' => false, // [255,255,255]
1298
-                'position' => $position === null ? ($this->papelContinuo ? 'C' : 'S') : $position,
1298
+                'position' => $position===null ? ($this->papelContinuo ? 'C' : 'S') : $position,
1299 1299
             ];
1300 1300
             $ecl = version_compare(phpversion(), '7.0.0', '<') ? -1 : $this->ecl;
1301 1301
             $this->write2DBarcode($timbre, 'PDF417,,'.$ecl, $x_timbre, $y, $w, 0, $style, 'B');
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
     protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40, $line = 25)
1327 1327
     {
1328 1328
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1329
-        $this->SetTextColorArray([0,0,0]);
1329
+        $this->SetTextColorArray([0, 0, 0]);
1330 1330
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1331 1331
         $this->setFont('', 'B', 10);
1332 1332
         $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1356,9 +1356,9 @@  discard block
 block discarded – undo
1356 1356
      */
1357 1357
     protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40)
1358 1358
     {
1359
-        $this->SetTextColorArray([0,0,0]);
1359
+        $this->SetTextColorArray([0, 0, 0]);
1360 1360
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1361
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1361
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1362 1362
         $this->Line($x, $y+22, $w+3, $y+22, $style);
1363 1363
         //$this->setFont('', 'B', 10);
1364 1364
         //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
         $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y;
1389 1389
         $y += 48;
1390 1390
         $this->setFont('', 'B', $font_size);
1391
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R');
1391
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R');
1392 1392
     }
1393 1393
 
1394 1394
     /**
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
     protected function agregarLeyendaDestinoContinuo($tipo)
1400 1400
     {
1401 1401
         $this->setFont('', 'B', 8);
1402
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R');
1402
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R');
1403 1403
     }
1404 1404
 
1405 1405
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -770,10 +770,12 @@  discard block
 block discarded – undo
770 770
             $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2);
771 771
         }
772 772
         $contacto = [];
773
-        if (!empty($receptor['Contacto']))
774
-            $contacto[] = $receptor['Contacto'];
775
-        if (!empty($receptor['CorreoRecep']))
776
-            $contacto[] = $receptor['CorreoRecep'];
773
+        if (!empty($receptor['Contacto'])) {
774
+                    $contacto[] = $receptor['Contacto'];
775
+        }
776
+        if (!empty($receptor['CorreoRecep'])) {
777
+                    $contacto[] = $receptor['CorreoRecep'];
778
+        }
777 779
         if (!empty($contacto)) {
778 780
             $this->setFont('', 'B', null);
779 781
             $this->Texto('Contacto', $x);
@@ -823,10 +825,12 @@  discard block
 block discarded – undo
823 825
             if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) {
824 826
                 $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest'];
825 827
             }
826
-            if (!empty($Transporte['RUTTrans']))
827
-                $transporte .= ' por '.$Transporte['RUTTrans'];
828
-            if (!empty($Transporte['Patente']))
829
-                $transporte .= ' en vehículo '.$Transporte['Patente'];
828
+            if (!empty($Transporte['RUTTrans'])) {
829
+                            $transporte .= ' por '.$Transporte['RUTTrans'];
830
+            }
831
+            if (!empty($Transporte['Patente'])) {
832
+                            $transporte .= ' en vehículo '.$Transporte['Patente'];
833
+            }
830 834
             if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) {
831 835
                 if (!empty($Transporte['Chofer']['NombreChofer'])) {
832 836
                     $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer'];
@@ -889,8 +893,9 @@  discard block
 block discarded – undo
889 893
      */
890 894
     protected function agregarReferencia($referencias, $x = 10, $offset = 22)
891 895
     {
892
-        if (!isset($referencias[0]))
893
-            $referencias = [$referencias];
896
+        if (!isset($referencias[0])) {
897
+                    $referencias = [$referencias];
898
+        }
894 899
         foreach($referencias as $r) {
895 900
             $texto = $r['NroLinRef'].' - ';
896 901
             if (!empty($r['TpoDocRef'])) {
@@ -1124,8 +1129,9 @@  discard block
 block discarded – undo
1124 1129
      */
1125 1130
     protected function agregarPagos(array $pagos, $x = 10)
1126 1131
     {
1127
-        if (!isset($pagos[0]))
1128
-            $pagos = [$pagos];
1132
+        if (!isset($pagos[0])) {
1133
+                    $pagos = [$pagos];
1134
+        }
1129 1135
         $this->Texto('Pago(s) programado(s):', $x);
1130 1136
         $this->Ln();
1131 1137
         foreach($pagos as $p) {
Please login to merge, or discard this patch.
lib/Sii/Base/Envio.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
             return false;
59 59
         }
60 60
         // si no se debe enviar no continuar
61
-        if ($retry === 0) {
61
+        if ($retry===0) {
62 62
             return false;
63 63
         }
64 64
         // solicitar token
Please login to merge, or discard this patch.
lib/Sii/ConsumoFolio.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $fecha = '9999-12-31';
128 128
         foreach ($this->detalles as &$d) {
129
-            if ($d['FchDoc'] < $fecha) {
129
+            if ($d['FchDoc']<$fecha) {
130 130
                 $fecha = $d['FchDoc'];
131 131
             }
132 132
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $fecha = '0000-01-01';
145 145
         foreach ($this->detalles as &$d) {
146
-            if ($d['FchDoc'] > $fecha) {
146
+            if ($d['FchDoc']>$fecha) {
147 147
                 $fecha = $d['FchDoc'];
148 148
             }
149 149
         }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         // ajustes post agregar detalles
203 203
         foreach ($Resumen as &$r) {
204 204
             // obtener folios utilizados = emitidos + anulados
205
-            $r['FoliosUtilizados'] = $r['FoliosEmitidos'] + $r['FoliosAnulados'];
205
+            $r['FoliosUtilizados'] = $r['FoliosEmitidos']+$r['FoliosAnulados'];
206 206
             $r['RangoUtilizados'] = $this->getRangos($RangoUtilizados[$r['TipoDocumento']]);
207 207
         }
208 208
         // completar con los resumenes que no se colocaron
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $aux = [];
235 235
         $inicial = $folios[0];
236 236
         $i = $inicial;
237
-        foreach($folios as $f) {
237
+        foreach ($folios as $f) {
238 238
             if ($i!=$f) {
239 239
                 $inicial = $f;
240 240
                 $i = $inicial;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function getSecuencia()
262 262
     {
263
-        if(isset($this->caratula['SecEnvio']))
263
+        if (isset($this->caratula['SecEnvio']))
264 264
             return trim($this->caratula['SecEnvio']);
265 265
         else
266 266
             return 1;
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -260,10 +260,11 @@
 block discarded – undo
260 260
      */
261 261
     public function getSecuencia()
262 262
     {
263
-        if(isset($this->caratula['SecEnvio']))
264
-            return trim($this->caratula['SecEnvio']);
265
-        else
266
-            return 1;
263
+        if(isset($this->caratula['SecEnvio'])) {
264
+                    return trim($this->caratula['SecEnvio']);
265
+        } else {
266
+                    return 1;
267
+        }
267 268
     }
268 269
 
269 270
 }
Please login to merge, or discard this patch.