Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #11707: UPS Option to include TAX in rate (by @gwharton)
 - magento-engcom/magento2ce#1134: #12205: Stock inventory reindex bug.  (by @p-bystritsky)
 - #14156: Add website- and storeview-code in stores admin grid (by @aschrammel)


Fixed GitHub Issues:
 - #12205: Stock inventory reindex bug (reported by @Nix-id) has been fixed in magento-engcom/magento2ce#1134 by @p-bystritsky in 2.2-develop branch
   Related commits:
     1. 20d7afb
     2. 8c44db2
  • Loading branch information
magento-engcom-team authored Mar 23, 2018
2 parents 5afa7d3 + 79687fc commit 6030506
Show file tree
Hide file tree
Showing 19 changed files with 2,138 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row)
$this->getUrl('adminhtml/*/editGroup', ['group_id' => $row->getGroupId()]) .
'">' .
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
'</a>';
'</a><br />'
. '(' . __('Code') . ': ' . $row->getGroupCode() . ')';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function render(\Magento\Framework\DataObject $row)
$this->getUrl('adminhtml/*/editStore', ['store_id' => $row->getStoreId()]) .
'">' .
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
'</a>';
'</a><br />' .
'(' . __('Code') . ': ' . $row->getStoreCode() . ')';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function render(\Magento\Framework\DataObject $row)
$this->getUrl('adminhtml/*/editWebsite', ['website_id' => $row->getWebsiteId()]) .
'">' .
$this->escapeHtml($row->getData($this->getColumn()->getIndex())) .
'</a>';
'</a><br />' .
'(' . __('Code') . ': ' . $row->getCode() . ')';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ protected function _prepareIndexTable($entityIds = null)
*/
protected function _updateIndex($entityIds)
{
$this->deleteOldRecords($entityIds);
$connection = $this->getConnection();
$select = $this->_getStockStatusSelect($entityIds, true);
$select = $this->getQueryProcessorComposite()->processQuery($select, $entityIds, true);
Expand All @@ -310,7 +311,6 @@ protected function _updateIndex($entityIds)
}
}

$this->deleteOldRecords($entityIds);
$this->_updateIndexTable($data);

return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ public function joinGroupAndStore()
$this->getSelect()->joinLeft(
['group_table' => $this->getTable('store_group')],
'main_table.website_id = group_table.website_id',
['group_id' => 'group_id', 'group_title' => 'name']
['group_id' => 'group_id', 'group_title' => 'name', 'group_code' => 'code']
)->joinLeft(
['store_table' => $this->getTable('store')],
'group_table.group_id = store_table.group_id',
['store_id' => 'store_id', 'store_title' => 'name']
['store_id' => 'store_id', 'store_title' => 'name', 'store_code' => 'code']
);
$this->addOrder('group_table.name', \Magento\Framework\DB\Select::SQL_ASC) // store name
->addOrder(
Expand Down
43 changes: 38 additions & 5 deletions app/code/Magento/Ups/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,9 @@ protected function _getXmlQuotes()
if ($this->getConfigFlag('negotiated_active')) {
$xmlParams .= "<RateInformation><NegotiatedRatesIndicator/></RateInformation>";
}
if ($this->getConfigFlag('include_taxes')) {
$xmlParams .= "<TaxInformationIndicator/>";
}

$xmlParams .= <<<XMLRequest
</Shipment>
Expand Down Expand Up @@ -795,6 +798,8 @@ private function mapCurrencyCode($code)
* @param mixed $xmlResponse
* @return Result
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.ElseExpression)
*/
protected function _parseXmlResponse($xmlResponse)
{
Expand All @@ -821,17 +826,45 @@ protected function _parseXmlResponse($xmlResponse)
foreach ($arr as $shipElement) {
$code = (string)$shipElement->Service->Code;
if (in_array($code, $allowedMethods)) {
//The location of tax information is in a different place depending on whether we are using negotiated rates or not
if ($negotiatedActive) {
$cost = $shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->MonetaryValue;
$includeTaxesArr = $xml->getXpath("//RatingServiceSelectionResponse/RatedShipment/NegotiatedRates/NetSummaryCharges/TotalChargesWithTaxes");
$includeTaxesActive = $this->getConfigFlag(
'include_taxes'
) && !empty($includeTaxesArr);
if ($includeTaxesActive) {
$cost = $shipElement->NegotiatedRates->NetSummaryCharges->TotalChargesWithTaxes->MonetaryValue;
$responseCurrencyCode = $this->mapCurrencyCode(
(string)$shipElement->NegotiatedRates->NetSummaryCharges->TotalChargesWithTaxes->CurrencyCode
);
}
else {
$cost = $shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->MonetaryValue;
$responseCurrencyCode = $this->mapCurrencyCode(
(string)$shipElement->NegotiatedRates->NetSummaryCharges->GrandTotal->CurrencyCode
);
}
} else {
$cost = $shipElement->TotalCharges->MonetaryValue;
$includeTaxesArr = $xml->getXpath("//RatingServiceSelectionResponse/RatedShipment/TotalChargesWithTaxes");
$includeTaxesActive = $this->getConfigFlag(
'include_taxes'
) && !empty($includeTaxesArr);
if ($includeTaxesActive) {
$cost = $shipElement->TotalChargesWithTaxes->MonetaryValue;
$responseCurrencyCode = $this->mapCurrencyCode(
(string)$shipElement->TotalChargesWithTaxes->CurrencyCode
);
}
else {
$cost = $shipElement->TotalCharges->MonetaryValue;
$responseCurrencyCode = $this->mapCurrencyCode(
(string)$shipElement->TotalCharges->CurrencyCode
);
}
}

//convert price with Origin country currency code to base currency code
$successConversion = true;
$responseCurrencyCode = $this->mapCurrencyCode(
(string)$shipElement->TotalCharges->CurrencyCode
);
if ($responseCurrencyCode) {
if (in_array($responseCurrencyCode, $allowedCurrencies)) {
$cost = (double)$cost * $this->_getBaseCurrencyRate($responseCurrencyCode);
Expand Down
Loading

0 comments on commit 6030506

Please sign in to comment.