Skip to content

Commit

Permalink
Merge pull request #14 from gento-arg/fix_null_node
Browse files Browse the repository at this point in the history
Hay veces que el nodo viene en null y da error
  • Loading branch information
manuelcanepa authored Jun 4, 2021
2 parents d7ef2d5 + bb4fdbe commit 3a39511
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Model/OcaApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 3a39511

Please sign in to comment.