Skip to content

Commit

Permalink
Corrige validação ao gerar MDF-e quando RNTRC não é obrigatório (Fixes
Browse files Browse the repository at this point in the history
…#576)

Adicionada uma verificação adicional para garantir que a tag infANTT esteja definida antes de tentar acessar RNTRC.
Verificado se RNTRC está presente dentro de infANTT antes de acessar seu valor, prevenindo assim a exceção.
  • Loading branch information
MarcosBrendonDePaula committed Oct 7, 2024
1 parent 41bd258 commit dbc05f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/MDFe/Damdfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ private function loadDoc($xml)
if (!empty($this->rodo)) {
$this->RNTRC = "";
$infANTT = $this->rodo->getElementsByTagName("infANTT")->item(0);
if (!empty($infANTT) && isset($infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue)) {
$this->RNTRC = $infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue;
if(isset($infANTT)){
if (isset($infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue)) {
$this->RNTRC = $infANTT->getElementsByTagName("RNTRC")->item(0)->nodeValue;
}
}
}
$this->ciot = "";
Expand Down

0 comments on commit dbc05f3

Please sign in to comment.