From 6426e9773d7a0d6272c026a063d153b8f0908447 Mon Sep 17 00:00:00 2001 From: Renan Delmonico Date: Thu, 20 Feb 2020 17:25:44 -0300 Subject: [PATCH] =?UTF-8?q?Adicionada=20condicao=20para=20inserir=20no=20X?= =?UTF-8?q?ML=20o=20CEP=20e=20Telefone=20do=20emitente=20somente=20se=20o?= =?UTF-8?q?=20valor=20n=C3=A3o=20=C3=A9=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Sped/Gnre/Sefaz/Lote.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/Sped/Gnre/Sefaz/Lote.php b/lib/Sped/Gnre/Sefaz/Lote.php index 31f39f2..7ae2732 100755 --- a/lib/Sped/Gnre/Sefaz/Lote.php +++ b/lib/Sped/Gnre/Sefaz/Lote.php @@ -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); @@ -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) {