@@ 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 | } |
@@ 207-213 (lines=7) @@ | ||
204 | { |
|
205 | $xml_unsigned = (new \sasco\LibreDTE\XML())->generate($this->datos)->saveXML(); |
|
206 | $xml = $Firma->signXML($xml_unsigned, '#'.$this->getID(), 'DocumentoCesion'); |
|
207 | if (!$xml) { |
|
208 | \sasco\LibreDTE\Log::write( |
|
209 | \sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, |
|
210 | \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_FIRMA, '#'.$this->getID()) |
|
211 | ); |
|
212 | return false; |
|
213 | } |
|
214 | $this->xml = new \sasco\LibreDTE\XML(); |
|
215 | if (!$this->xml->loadXML($xml) or !$this->schemaValidate()) |
|
216 | return false; |