From fe8193c2561588b4a5500ebcad08ba0807cea2ed Mon Sep 17 00:00:00 2001 From: Manuel Canepa Date: Fri, 4 Jun 2021 17:56:43 -0300 Subject: [PATCH 1/2] Hay veces que el nodo viene en null y da error --- src/Model/OcaApi.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/OcaApi.php b/src/Model/OcaApi.php index 9678f2b..bd93a4b 100644 --- a/src/Model/OcaApi.php +++ b/src/Model/OcaApi.php @@ -662,10 +662,10 @@ protected function loadFields($ci, $fields) $item = $ci->getElementsByTagName($field)->item(0); if ($item != null) { // En caso de que sea un array de elementos (como puede ser Servicios) - if ($item->firstChild->nodeType === XML_ELEMENT_NODE) { + if ($item->firstChild != null && $item->firstChild->nodeType === XML_ELEMENT_NODE) { $value = $this->childToArray($item->childNodes); } - if ($item->firstChild->nodeType === XML_TEXT_NODE) { + if ($item->firstChild == null || $item->firstChild->nodeType === XML_TEXT_NODE) { $value = $item->nodeValue; } } From bb4fdbec22f1e21f7265e83efb39e8c4c4e9effb Mon Sep 17 00:00:00 2001 From: Manuel Canepa Date: Fri, 4 Jun 2021 18:39:27 -0300 Subject: [PATCH 2/2] Evito que se agregue un error si no se debe mostrar --- src/Model/Carrier.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Model/Carrier.php b/src/Model/Carrier.php index b4751d1..0ea580d 100644 --- a/src/Model/Carrier.php +++ b/src/Model/Carrier.php @@ -256,12 +256,14 @@ public function processOperatory( } if ($tarifa == null) { - $error = $this->_rateErrorFactory->create(); - $error->setCarrier($this->_code); - $error->setCarrierTitle($this->getConfigData('title') . ' - ' . $operatory->getName()); - $errorMessage = $this->getConfigData('specificerrmsg') ?: $errorMessage; - $error->setErrorMessage($errorMessage); - $rateResult->append($error); + if ($this->getConfigData('showmethod')) { + $error = $this->_rateErrorFactory->create(); + $error->setCarrier($this->_code); + $error->setCarrierTitle($this->getConfigData('title') . ' - ' . $operatory->getName()); + $errorMessage = $this->getConfigData('specificerrmsg') ?: $errorMessage; + $error->setErrorMessage($errorMessage); + $rateResult->append($error); + } return $rateResult; }