@@ 46-52 (lines=7) @@ | ||
43 | { |
|
44 | $this->xml = new \sasco\LibreDTE\XML(); |
|
45 | $this->xml->loadXML(utf8_encode($xml)); |
|
46 | if (!$this->check()) { |
|
47 | \sasco\LibreDTE\Log::write( |
|
48 | \sasco\LibreDTE\Estado::FOLIOS_ERROR_CHECK, |
|
49 | \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::FOLIOS_ERROR_CHECK) |
|
50 | ); |
|
51 | $this->xml = null; |
|
52 | } |
|
53 | } |
|
54 | ||
55 | /** |
@@ 477-483 (lines=7) @@ | ||
474 | } |
|
475 | $TED->getElementsByTagName('FRMT')->item(0)->nodeValue = base64_encode($timbre); |
|
476 | $xml = str_replace('<TED/>', trim(str_replace('<?xml version="1.0" encoding="ISO-8859-1"?>', '', $TED->saveXML())), $this->saveXML()); |
|
477 | if (!$this->loadXML($xml)) { |
|
478 | \sasco\LibreDTE\Log::write( |
|
479 | \sasco\LibreDTE\Estado::DTE_ERROR_TIMBRE, |
|
480 | \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_TIMBRE, $this->getID()) |
|
481 | ); |
|
482 | return false; |
|
483 | } |
|
484 | return true; |
|
485 | } |
|
486 | ||
@@ 499-505 (lines=7) @@ | ||
496 | $parent = $this->xml->getElementsByTagName($this->tipo_general)->item(0); |
|
497 | $this->xml->generate(['TmstFirma'=>$this->timestamp], null, $parent); |
|
498 | $xml = $Firma->signXML($this->xml->saveXML(), '#'.$this->id, $this->tipo_general); |
|
499 | if (!$xml) { |
|
500 | \sasco\LibreDTE\Log::write( |
|
501 | \sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, |
|
502 | \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, $this->getID()) |
|
503 | ); |
|
504 | return false; |
|
505 | } |
|
506 | $this->loadXML($xml); |
|
507 | return true; |
|
508 | } |
@@ 600-603 (lines=4) @@ | ||
597 | } while (file_exists($file)); |
|
598 | if ($gzip) { |
|
599 | $dte = gzencode($dte); |
|
600 | if ($dte===false) { |
|
601 | \sasco\LibreDTE\Log::write(Estado::ENVIO_ERROR_GZIP, Estado::get(Estado::ENVIO_ERROR_GZIP)); |
|
602 | return false; |
|
603 | } |
|
604 | } |
|
605 | file_put_contents($file, $dte); |
|
606 | $data = [ |