Skip to content

Commit

Permalink
fix al normalizar correo receptor en boletas, si no existen referenci…
Browse files Browse the repository at this point in the history
…as se crea arreglo vacio antes de asignar.
  • Loading branch information
estebandelaf committed Dec 20, 2024
1 parent 2f2a349 commit 2f53bf5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ protected function applyBoletasNormalization(array $data): array
$data['Encabezado']['Emisor']['CdgVendedor'] = false;
$data['Encabezado']['Receptor']['GiroRecep'] = false;
if (!empty($data['Encabezado']['Receptor']['CorreoRecep'])) {
if ($data['Referencia'] === false) {
$data['Referencia'] = [];
}
$data['Referencia'][] = [
'NroLinRef' => !empty($data['Referencia'])
? (count($data['Referencia']) + 1)
Expand Down
6 changes: 4 additions & 2 deletions src/Xml/XmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ public function getSchema(): ?string
*/
public function loadXML(string $source, int $options = 0): bool
{
// Si no hay un string XML en el origen entonces se retorna `false`.
// Si no hay un string XML en el origen entonces se lanza excepción.
if (empty($source)) {
throw new XmlException('El contenido XML está vacío.');
throw new XmlException(
'El contenido del XML que se desea cargar está vacío.'
);
}

// Convertir el XML si es necesario.
Expand Down

0 comments on commit 2f53bf5

Please sign in to comment.