Skip to content

Commit

Permalink
ENGCOM-4147: Fixed #13319 , Incorrect method return value in \Magento…
Browse files Browse the repository at this point in the history
…\Shipping\Model\Carrier\AbstractCarrier::getTotalNumOfBoxes() #20898
  • Loading branch information
sivaschenko authored Mar 28, 2019
2 parents 427bf13 + 48ea21d commit bbefda2
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public function getConfigFlag($field)
}

/**
* Do request to shipment
* Do request to shipment.
*
* Implementation must be in overridden method
*
* @param Request $request
Expand All @@ -173,7 +174,8 @@ public function requestToShipment($request)
}

/**
* Do return of shipment
* Do return of shipment.
*
* Implementation must be in overridden method
*
* @param Request $request
Expand Down Expand Up @@ -275,6 +277,8 @@ public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $para
}

/**
* Validate request for available ship countries.
*
* @param \Magento\Framework\DataObject $request
* @return $this|bool|false|\Magento\Framework\Model\AbstractModel
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
Expand Down Expand Up @@ -400,6 +404,8 @@ public function getSortOrder()
}

/**
* Allows free shipping when all product items have free shipping.
*
* @param \Magento\Quote\Model\Quote\Address\RateRequest $request
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
Expand Down Expand Up @@ -531,10 +537,10 @@ protected function _getPerorderPrice($cost, $handlingType, $handlingFee)
}

/**
* Sets the number of boxes for shipping
* Gets the average weight of each box available for shipping
*
* @param int $weight in some measure
* @return int
* @param float $weight in some measure
* @return float
*/
public function getTotalNumOfBoxes($weight)
{
Expand All @@ -545,7 +551,7 @@ public function getTotalNumOfBoxes($weight)
$maxPackageWeight = $this->getConfigData('max_package_weight');
if ($weight > $maxPackageWeight && $maxPackageWeight != 0) {
$this->_numBoxes = ceil($weight / $maxPackageWeight);
$weight = $weight / $this->_numBoxes;
$weight = (float)$weight / $this->_numBoxes;
}

return $weight;
Expand Down Expand Up @@ -671,7 +677,8 @@ protected function filterDebugData($data)
}

/**
* Recursive replace sensitive xml nodes values by specified mask
* Recursive replace sensitive xml nodes values by specified mask.
*
* @param \SimpleXMLElement $xml
* @return void
*/
Expand Down

0 comments on commit bbefda2

Please sign in to comment.