Skip to content

Commit

Permalink
Merge pull request #43 from renandelmonico/campos-opicionais
Browse files Browse the repository at this point in the history
Adicionada verificação para campos opcionais
  • Loading branch information
marabesi committed Feb 20, 2020
2 parents 912f662 + 6426e97 commit a2c04fe
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/Sped/Gnre/Sefaz/Lote.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ public function toXml()
$c18 = $gnre->createElement('c18_enderecoEmitente', $gnreGuia->c18_enderecoEmitente);
$c19 = $gnre->createElement('c19_municipioEmitente', $gnreGuia->c19_municipioEmitente);
$c20 = $gnre->createElement('c20_ufEnderecoEmitente', $gnreGuia->c20_ufEnderecoEmitente);
$c21 = $gnre->createElement('c21_cepEmitente', $gnreGuia->c21_cepEmitente);
$c22 = $gnre->createElement('c22_telefoneEmitente', $gnreGuia->c22_telefoneEmitente);
if ($gnreGuia->c21_cepEmitente) {
$c21 = $gnre->createElement('c21_cepEmitente', $gnreGuia->c21_cepEmitente);
}
if ($gnreGuia->c22_telefoneEmitente) {
$c22 = $gnre->createElement('c22_telefoneEmitente', $gnreGuia->c22_telefoneEmitente);
}

$c34_tipoIdentificacaoDestinatario = $gnreGuia->c34_tipoIdentificacaoDestinatario;
$c34 = $gnre->createElement('c34_tipoIdentificacaoDestinatario', $c34_tipoIdentificacaoDestinatario);
Expand Down Expand Up @@ -188,8 +192,12 @@ public function toXml()
$dados->appendChild($c18);
$dados->appendChild($c19);
$dados->appendChild($c20);
$dados->appendChild($c21);
$dados->appendChild($c22);
if (isset($c21)) {
$dados->appendChild($c21);
}
if (isset($c22)) {
$dados->appendChild($c22);
}
$dados->appendChild($c34);
$dados->appendChild($c35);
if ($gnreGuia->c36_inscricaoEstadualDestinatario) {
Expand Down

0 comments on commit a2c04fe

Please sign in to comment.