Skip to content

Commit 0e12649

Browse files
author
Sergii Kovalenko
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-56989
2 parents c6f6417 + 81c6cce commit 0e12649

File tree

62 files changed

+2352
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2352
-285
lines changed

app/code/Magento/Authorizenet/Model/Authorizenet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ protected function buildRequest(\Magento\Framework\DataObject $payment)
332332
->setXCity($billing->getCity())
333333
->setXState($billing->getRegion())
334334
->setXZip($billing->getPostcode())
335-
->setXCountry($billing->getCountry())
335+
->setXCountry($billing->getCountryId())
336336
->setXPhone($billing->getTelephone())
337337
->setXFax($billing->getFax())
338338
->setXCustId($order->getCustomerId())
@@ -352,7 +352,7 @@ protected function buildRequest(\Magento\Framework\DataObject $payment)
352352
->setXShipToCity($shipping->getCity())
353353
->setXShipToState($shipping->getRegion())
354354
->setXShipToZip($shipping->getPostcode())
355-
->setXShipToCountry($shipping->getCountry());
355+
->setXShipToCountry($shipping->getCountryId());
356356
}
357357

358358
$request->setXPoNum($payment->getPoNumber())

app/code/Magento/Authorizenet/Model/Directpost/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function setDataFromOrder(
123123
->setXCity(strval($billing->getCity()))
124124
->setXState(strval($billing->getRegion()))
125125
->setXZip(strval($billing->getPostcode()))
126-
->setXCountry(strval($billing->getCountry()))
126+
->setXCountry(strval($billing->getCountryId()))
127127
->setXPhone(strval($billing->getTelephone()))
128128
->setXFax(strval($billing->getFax()))
129129
->setXCustId(strval($billing->getCustomerId()))
@@ -151,7 +151,7 @@ public function setDataFromOrder(
151151
)->setXShipToZip(
152152
strval($shipping->getPostcode())
153153
)->setXShipToCountry(
154-
strval($shipping->getCountry())
154+
strval($shipping->getCountryId())
155155
);
156156
}
157157

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Text.php

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
7+
8+
use Magento\Framework\DataObject;
69

710
/**
811
* Backend grid item renderer
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
1112
*/
12-
namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;
13-
1413
class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
1514
{
1615
/**
@@ -21,30 +20,53 @@ class Text extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe
2120
protected $_variablePattern = '/\\$([a-z0-9_]+)/i';
2221

2322
/**
24-
* Renders grid column
23+
* Get value for the cel
2524
*
26-
* @param \Magento\Framework\DataObject $row
27-
* @return mixed
25+
* @param DataObject $row
26+
* @return string
2827
*/
29-
public function _getValue(\Magento\Framework\DataObject $row)
28+
public function _getValue(DataObject $row)
3029
{
31-
$format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : null;
32-
$defaultValue = $this->getColumn()->getDefault();
33-
if ($format === null) {
34-
// If no format and it column not filtered specified return data as is.
35-
$data = parent::_getValue($row);
36-
$string = $data === null ? $defaultValue : $data;
37-
return $this->escapeHtml($string);
38-
} elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
39-
// Parsing of format string
40-
$formattedString = $format;
41-
foreach ($matches[0] as $matchIndex => $match) {
42-
$value = $row->getData($matches[1][$matchIndex]);
43-
$formattedString = str_replace($match, $value, $formattedString);
30+
if (null === $this->getColumn()->getFormat()) {
31+
return $this->getSimpleValue($row);
32+
}
33+
return $this->getFormattedValue($row);
34+
}
35+
36+
/**
37+
* Get simple value
38+
*
39+
* @param DataObject $row
40+
* @return string
41+
*/
42+
private function getSimpleValue(DataObject $row)
43+
{
44+
$data = parent::_getValue($row);
45+
$value = null === $data ? $this->getColumn()->getDefault() : $data;
46+
if (true === $this->getColumn()->getTranslate()) {
47+
$value = __($value);
48+
}
49+
return $this->escapeHtml($value);
50+
}
51+
52+
/**
53+
* Replace placeholders in the string with values
54+
*
55+
* @param DataObject $row
56+
* @return string
57+
*/
58+
private function getFormattedValue(DataObject $row)
59+
{
60+
$value = $this->getColumn()->getFormat() ?: null;
61+
if (true === $this->getColumn()->getTranslate()) {
62+
$value = __($value);
63+
}
64+
if (preg_match_all($this->_variablePattern, $value, $matches)) {
65+
foreach ($matches[0] as $index => $match) {
66+
$replacement = $row->getData($matches[1][$index]);
67+
$value = str_replace($match, $replacement, $value);
4468
}
45-
return $formattedString;
46-
} else {
47-
return $this->escapeHtml($format);
4869
}
70+
return $this->escapeHtml($value);
4971
}
5072
}

app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<argument name="width" xsi:type="string">180</argument>
4949
<argument name="align" xsi:type="string">left</argument>
5050
<argument name="sortable" xsi:type="string">0</argument>
51+
<argument name="translate" xsi:type="boolean">true</argument>
5152
</arguments>
5253
</block>
5354
<block class="Magento\Backend\Block\Widget\Grid\Column" as="description">
@@ -57,6 +58,7 @@
5758
<argument name="type" xsi:type="string">text</argument>
5859
<argument name="align" xsi:type="string">left</argument>
5960
<argument name="sortable" xsi:type="string">0</argument>
61+
<argument name="translate" xsi:type="boolean">true</argument>
6062
</arguments>
6163
</block>
6264
<block class="Magento\Backend\Block\Widget\Grid\Column" as="tags">

app/code/Magento/Braintree/view/adminhtml/web/js/vault.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ define([
2828
self.$selector = $('#' + self.selector);
2929
self.$container = $('#' + self.container);
3030
self.$selector.on(
31-
'setVaultNotActive',
31+
'setVaultNotActive.' + self.getCode(),
3232
function () {
3333
self.$selector.off('submitOrder.' + self.getCode());
3434
}

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ protected function _prepareTierPriceIndex($entityIds = null)
491491
null
492492
)->join(
493493
['e' => $this->getTable('catalog_product_entity')],
494-
"i.entity_id=e.$linkField",
494+
"i.entity_id=e.entity_id",
495495
[]
496496
)->where(
497497
'e.type_id=?',
@@ -502,7 +502,7 @@ protected function _prepareTierPriceIndex($entityIds = null)
502502

503503
$select = $connection->select()->from(
504504
['tp' => $this->getTable('catalog_product_entity_tier_price')],
505-
[$linkField]
505+
['e.entity_id']
506506
)->join(
507507
['e' => $this->getTable('catalog_product_entity')],
508508
"tp.{$linkField} = e.{$linkField}",
@@ -523,11 +523,11 @@ protected function _prepareTierPriceIndex($entityIds = null)
523523
)->columns(
524524
new \Zend_Db_Expr('MIN(tp.value)')
525525
)->group(
526-
["tp.{$linkField}", 'cg.customer_group_id', 'cw.website_id']
526+
['e.entity_id', 'cg.customer_group_id', 'cw.website_id']
527527
);
528528

529529
if (!empty($entityIds)) {
530-
$select->where("tp.{$linkField} IN(?)", $entityIds);
530+
$select->where('e.entity_id IN(?)', $entityIds);
531531
}
532532

533533
$query = $select->insertFromSelect($this->_getTierPriceIndexTable());

app/code/Magento/CatalogWidget/Block/Product/Widget/Conditions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function _construct()
8585
$widget = $this->registry->registry('current_widget_instance');
8686
if ($widget) {
8787
$widgetParameters = $widget->getWidgetParameters();
88-
} elseif($widgetOptions = $this->getLayout()->getBlock('wysiwyg_widget.options')) {
88+
} elseif ($widgetOptions = $this->getLayout()->getBlock('wysiwyg_widget.options')) {
8989
$widgetParameters = $widgetOptions->getWidgetValues();
9090
}
9191

@@ -100,6 +100,7 @@ protected function _construct()
100100
public function render(AbstractElement $element)
101101
{
102102
$this->element = $element;
103+
$this->rule->getConditions()->setJsFormObject($this->getHtmlId());
103104
return $this->toHtml();
104105
}
105106

app/code/Magento/CatalogWidget/Test/Unit/Block/Product/Widget/ConditionsTest.php

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
/**
1717
* Test class for \Magento\CatalogWidget\Block\Product\Widget\Conditions
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
*/
1920
class ConditionsTest extends \PHPUnit_Framework_TestCase
2021
{
@@ -175,4 +176,116 @@ public function testConstructWithParamsFromBlock()
175176
]
176177
);
177178
}
179+
180+
/**
181+
* @return void
182+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
183+
*/
184+
public function testRender()
185+
{
186+
$data = ['area' => 'backend'];
187+
$abstractElementMock = $this->getMock(
188+
\Magento\Framework\Data\Form\Element\AbstractElement::class,
189+
['getContainer'],
190+
[],
191+
'',
192+
false
193+
);
194+
$eventManagerMock = $this->getMock(
195+
\Magento\Framework\Event\ManagerInterface::class,
196+
[],
197+
[],
198+
'',
199+
false
200+
);
201+
$scopeConfigMock = $this->getMock(
202+
\Magento\Framework\App\Config\ScopeConfigInterface::class,
203+
[],
204+
[],
205+
'',
206+
false
207+
);
208+
$fieldsetMock = $this->getMock(
209+
\Magento\Framework\Data\Form\Element\Fieldset::class,
210+
[],
211+
[],
212+
'',
213+
false
214+
);
215+
$combineMock = $this->getMock(
216+
\Magento\Rule\Model\Condition\Combine::class,
217+
[],
218+
[],
219+
'',
220+
false
221+
);
222+
$resolverMock = $this->getMock(
223+
\Magento\Framework\View\Element\Template\File\Resolver::class,
224+
[],
225+
[],
226+
'',
227+
false
228+
);
229+
$filesystemMock = $this->getMock(
230+
\Magento\Framework\Filesystem::class,
231+
['getDirectoryRead'],
232+
[],
233+
'',
234+
false
235+
);
236+
$validatorMock = $this->getMock(
237+
\Magento\Framework\View\Element\Template\File\Validator::class,
238+
[],
239+
[],
240+
'',
241+
false
242+
);
243+
$templateEnginePoolMock = $this->getMock(
244+
\Magento\Framework\View\TemplateEnginePool::class,
245+
[],
246+
[],
247+
'',
248+
false
249+
);
250+
$templateEngineMock = $this->getMock(
251+
\Magento\Framework\View\TemplateEngineInterface::class,
252+
[],
253+
[],
254+
'',
255+
false
256+
);
257+
$directoryReadMock = $this->getMock(
258+
\Magento\Framework\Filesystem\Directory\ReadInterface::class,
259+
[],
260+
[],
261+
'',
262+
false
263+
);
264+
265+
$this->ruleMock->expects($this->once())->method('getConditions')->willReturn($combineMock);
266+
$combineMock->expects($this->once())->method('setJsFormObject')->willReturnSelf();
267+
$abstractElementMock->expects($this->any())->method('getContainer')->willReturn($fieldsetMock);
268+
$filesystemMock->expects($this->once())->method('getDirectoryRead')->willReturn($directoryReadMock);
269+
$validatorMock->expects($this->once())->method('isValid')->willReturn(true);
270+
$this->contextMock->expects($this->once())->method('getEnginePool')->willReturn($templateEnginePoolMock);
271+
$templateEnginePoolMock->expects($this->once())->method('get')->willReturn($templateEngineMock);
272+
$templateEngineMock->expects($this->once())->method('render')->willReturn('html');
273+
274+
$this->widgetConditions = $this->objectManagerHelper->getObject(
275+
Conditions::class,
276+
[
277+
'context' => $this->contextMock,
278+
'registry' => $this->registryMock,
279+
'rule' => $this->ruleMock,
280+
'_eventManager' => $eventManagerMock,
281+
'_filesystem' => $filesystemMock,
282+
'_scopeConfig' => $scopeConfigMock,
283+
'validator' => $validatorMock,
284+
'resolver' => $resolverMock,
285+
'data' => $data
286+
]
287+
);
288+
289+
$this->assertEquals($this->widgetConditions->render($abstractElementMock), 'html');
290+
}
178291
}

app/code/Magento/Indexer/view/adminhtml/layout/indexer_indexer_list_grid.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<argument name="index" xsi:type="string">title</argument>
4747
<argument name="sortable" xsi:type="string">0</argument>
4848
<argument name="column_css_class" xsi:type="string">indexer-title</argument>
49+
<argument name="translate" xsi:type="boolean">true</argument>
4950
</arguments>
5051
</block>
5152
<block class="Magento\Backend\Block\Widget\Grid\Column" as="indexer_description">
@@ -54,6 +55,7 @@
5455
<argument name="index" xsi:type="string">description</argument>
5556
<argument name="sortable" xsi:type="string">0</argument>
5657
<argument name="column_css_class" xsi:type="string">indexer-description</argument>
58+
<argument name="translate" xsi:type="boolean">true</argument>
5759
</arguments>
5860
</block>
5961
<block class="Magento\Backend\Block\Widget\Grid\Column" as="indexer_mode">

app/code/Magento/OfflineShipping/Model/Quote/Address/FreeShipping.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\OfflineShipping\Model\Quote\Address;
77

8-
use Magento\Quote\Model\Quote\Address;
9-
108
class FreeShipping implements \Magento\Quote\Model\Quote\Address\FreeShippingInterface
119
{
1210
/**
@@ -48,7 +46,8 @@ public function isFreeShipping(\Magento\Quote\Model\Quote $quote, $items)
4846
$quote->getCustomerGroupId(),
4947
$quote->getCouponCode()
5048
);
51-
49+
$shippingAddress = $quote->getShippingAddress();
50+
$shippingAddress->setFreeShipping(0);
5251
/** @var \Magento\Quote\Api\Data\CartItemInterface $item */
5352
foreach ($items as $item) {
5453
if ($item->getNoDiscount()) {
@@ -66,10 +65,14 @@ public function isFreeShipping(\Magento\Quote\Model\Quote $quote, $items)
6665
$itemFreeShipping = (bool)$item->getFreeShipping();
6766
$addressFreeShipping = $addressFreeShipping && $itemFreeShipping;
6867

68+
if ($addressFreeShipping && !$item->getAddress()->getFreeShipping()) {
69+
$item->getAddress()->setFreeShipping(true);
70+
}
71+
6972
/** Parent free shipping we apply to all children*/
7073
$this->applyToChildren($item, $itemFreeShipping);
7174
}
72-
return $addressFreeShipping;
75+
return (bool)$shippingAddress->getFreeShipping();
7376
}
7477

7578
/**

0 commit comments

Comments
 (0)