Skip to content

Commit 19c8cef

Browse files
igrybkovxmav
authored andcommitted
MAGETWO-56954: CLONE - Shopping cart page - Reordered items count is not getting updated at mini cart
- Merged latest changes from magento2ce/develop
2 parents 29db725 + 0353379 commit 19c8cef

File tree

896 files changed

+21110
-6753
lines changed

Some content is hidden

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

896 files changed

+21110
-6753
lines changed

Gruntfile.js.sample

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@
55

66
// For performance use one level down: 'name/{,*/}*.js'
77
// If you want to recursively match all subfolders, use: 'name/**/*.js'
8+
89
module.exports = function (grunt) {
910
'use strict';
1011

1112
var _ = require('underscore'),
1213
path = require('path'),
13-
themes = require('./dev/tools/grunt/configs/themes'),
14+
filesRouter = require('./dev/tools/grunt/tools/files-router'),
1415
configDir = './dev/tools/grunt/configs',
15-
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*');
16+
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'),
17+
themes;
18+
19+
filesRouter.set('themes', 'dev/tools/grunt/configs/themes');
20+
themes = filesRouter.get('themes');
1621

1722
tasks = _.map(tasks, function(task){ return task.replace('.js', '') });
1823
tasks.push('time-grunt');

app/code/Magento/Backend/Model/View/Result/Redirect.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Backend\Model\UrlInterface;
1111
use Magento\Framework\App;
1212
use Magento\Framework\App\ActionFlag;
13+
use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface;
1314

1415
class Redirect extends \Magento\Framework\Controller\Result\Redirect
1516
{
@@ -56,7 +57,7 @@ public function setRefererOrBaseUrl()
5657
/**
5758
* {@inheritdoc}
5859
*/
59-
protected function render(App\ResponseInterface $response)
60+
protected function render(HttpResponseInterface $response)
6061
{
6162
$this->session->setIsUrlNotice($this->actionFlag->get('', AbstractAction::FLAG_IS_URLS_CHECKED));
6263
return parent::render($response);

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
<item name="fit" xsi:type="boolean">false</item>
7070
<item name="label" xsi:type="string">Search String</item>
7171
<item name="showFallbackReset" xsi:type="boolean">false</item>
72+
<item name="validation" xsi:type="array">
73+
<item name="required-entry" xsi:type="boolean">true</item>
74+
</item>
7275
</item>
7376
</argument>
7477
</field>
@@ -82,6 +85,9 @@
8285
<item name="fit" xsi:type="boolean">false</item>
8386
<item name="label" xsi:type="string">Theme Name</item>
8487
<item name="showFallbackReset" xsi:type="boolean">false</item>
88+
<item name="validation" xsi:type="array">
89+
<item name="required-entry" xsi:type="boolean">true</item>
90+
</item>
8591
</item>
8692
</argument>
8793
</field>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/cells/action-delete.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
title: $parent.deleteButtonLabel
1212
}
1313
">
14-
<span data-bind="text: $parent.deleteButtonLabel"></span>
14+
<span translate="$parent.deleteButtonLabel"></span>
1515
</button>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class="action-secondary"
1717
type="button"
1818
click="processingAddChild.bind($data, false, false, false)">
19-
<span text="addButtonLabel"/>
19+
<span translate="addButtonLabel"/>
2020
</button>
2121
</div>
2222

@@ -30,7 +30,7 @@
3030
css="element.setClasses(element)"
3131
attr="'data-index': index">
3232
<label if="element.label" class="admin__field-label" attr="for: element.uid">
33-
<span text="element.label"/>
33+
<span translate="element.label"/>
3434
</label>
3535

3636
<div class="admin__field-control" data-role="grid-wrapper">
@@ -51,7 +51,7 @@
5151

5252
<th repeat="foreach: labels, item: '$label'"
5353
class="data-grid-th"
54-
text="$label().label"
54+
translate="$label().label"
5555
visible="$label().visible"
5656
disable="$label().disabled"
5757
css="setClasses($label())">

app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,25 @@ private function isExpiredAuthorization(OrderPaymentInterface $payment)
166166
*/
167167
private function isExistsCaptureTransaction(OrderPaymentInterface $payment)
168168
{
169-
$filters[] = $this->filterBuilder->setField('payment_id')
170-
->setValue($payment->getId())
171-
->create();
169+
$this->searchCriteriaBuilder->addFilters(
170+
[
171+
$this->filterBuilder
172+
->setField('payment_id')
173+
->setValue($payment->getId())
174+
->create(),
175+
]
176+
);
172177

173-
$filters[] = $this->filterBuilder->setField('txn_type')
174-
->setValue(TransactionInterface::TYPE_CAPTURE)
175-
->create();
178+
$this->searchCriteriaBuilder->addFilters(
179+
[
180+
$this->filterBuilder
181+
->setField('txn_type')
182+
->setValue(TransactionInterface::TYPE_CAPTURE)
183+
->create(),
184+
]
185+
);
176186

177-
$searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)
178-
->create();
187+
$searchCriteria = $this->searchCriteriaBuilder->create();
179188

180189
$count = $this->transactionRepository->getList($searchCriteria)->getTotalCount();
181190
return (boolean) $count;

app/code/Magento/Braintree/Gateway/Config/Config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,14 @@ public function getDynamicDescriptors()
193193
}
194194
return $values;
195195
}
196+
197+
/**
198+
* Get Merchant account ID
199+
*
200+
* @return string
201+
*/
202+
public function getMerchantAccountId()
203+
{
204+
return $this->getValue(self::KEY_MERCHANT_ACCOUNT_ID);
205+
}
196206
}

app/code/Magento/Braintree/Gateway/Request/PaymentDataBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function build(array $buildSubject)
8787
self::ORDER_ID => $order->getOrderIncrementId()
8888
];
8989

90-
$merchantAccountId = $this->config->getValue(Config::KEY_MERCHANT_ACCOUNT_ID);
90+
$merchantAccountId = $this->config->getMerchantAccountId();
9191
if (!empty($merchantAccountId)) {
9292
$result[self::MERCHANT_ACCOUNT_ID] = $merchantAccountId;
9393
}

app/code/Magento/Braintree/Model/Ui/ConfigProvider.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Braintree\Model\Ui;
77

8+
use Magento\Braintree\Gateway\Request\PaymentDataBuilder;
89
use Magento\Checkout\Model\ConfigProviderInterface;
910
use Magento\Braintree\Gateway\Config\Config;
1011
use Magento\Braintree\Model\Adapter\BraintreeAdapter;
@@ -86,7 +87,14 @@ public function getConfig()
8687
public function getClientToken()
8788
{
8889
if (empty($this->clientToken)) {
89-
$this->clientToken = $this->adapter->generate();
90+
$params = [];
91+
92+
$merchantAccountId = $this->config->getMerchantAccountId();
93+
if (!empty($merchantAccountId)) {
94+
$params[PaymentDataBuilder::MERCHANT_ACCOUNT_ID] = $merchantAccountId;
95+
}
96+
97+
$this->clientToken = $this->adapter->generate($params);
9098
}
9199

92100
return $this->clientToken;

app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private function buildSearchCriteria()
374374
->willReturnSelf();
375375

376376
$searchCriteria = new SearchCriteria();
377-
$this->searchCriteriaBuilder->expects(static::once())
377+
$this->searchCriteriaBuilder->expects(static::exactly(2))
378378
->method('addFilters')
379379
->willReturnSelf();
380380
$this->searchCriteriaBuilder->expects(static::once())

app/code/Magento/Braintree/Test/Unit/Gateway/Request/PaymentDataBuilderTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ public function testBuild()
133133
->willReturnMap($additionalData);
134134

135135
$this->configMock->expects(static::once())
136-
->method('getValue')
137-
->with(Config::KEY_MERCHANT_ACCOUNT_ID)
136+
->method('getMerchantAccountId')
138137
->willReturn(self::MERCHANT_ACCOUNT_ID);
139138

140139
$this->paymentDO->expects(static::once())

app/code/Magento/Braintree/Test/Unit/Gateway/Request/VaultCaptureDataBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testBuild()
8080
$paymentExtension = $this->getMockBuilder(OrderPaymentExtension::class)
8181
->setMethods(['getVaultPaymentToken'])
8282
->disableOriginalConstructor()
83-
->getMock();
83+
->getMockForAbstractClass();
8484

8585
$paymentToken = $this->getMockBuilder(PaymentToken::class)
8686
->disableOriginalConstructor()

app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
class ConfigProviderTest extends \PHPUnit_Framework_TestCase
1919
{
2020
const SDK_URL = 'https://js.braintreegateway.com/v2/braintree.js';
21-
2221
const CLIENT_TOKEN = 'token';
22+
const MERCHANT_ACCOUNT_ID = '245345';
2323

2424
/**
2525
* @var Config|MockObject
@@ -76,11 +76,17 @@ public function testGetConfig($config, $expected)
7676

7777
/**
7878
* @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken
79+
* @dataProvider getClientTokenDataProvider
7980
*/
80-
public function testGetClientToken()
81+
public function testGetClientToken($merchantAccountId, $params)
8182
{
83+
$this->config->expects(static::once())
84+
->method('getMerchantAccountId')
85+
->willReturn($merchantAccountId);
86+
8287
$this->braintreeAdapter->expects(static::once())
8388
->method('generate')
89+
->with($params)
8490
->willReturn(self::CLIENT_TOKEN);
8591

8692
static::assertEquals(self::CLIENT_TOKEN, $this->configProvider->getClientToken());
@@ -140,4 +146,21 @@ public function getConfigDataProvider()
140146
]
141147
];
142148
}
149+
150+
/**
151+
* @return array
152+
*/
153+
public function getClientTokenDataProvider()
154+
{
155+
return [
156+
[
157+
'merchantAccountId' => '',
158+
'params' => []
159+
],
160+
[
161+
'merchantAccountId' => self::MERCHANT_ACCOUNT_ID,
162+
'params' => ['merchantAccountId' => self::MERCHANT_ACCOUNT_ID]
163+
]
164+
];
165+
}
143166
}

app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public function getBundleOptions(ItemInterface $item)
142142
. $this->pricingHelper->currency(
143143
$this->getSelectionFinalPrice($item, $bundleSelection)
144144
);
145+
$option['has_html'] = true;
145146
}
146147
}
147148

app/code/Magento/Bundle/Test/Unit/Helper/Catalog/Product/ConfigurationTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ public function testGetBundleOptionsEmptyBundleSelectionIds()
164164
$this->assertEquals([], $this->helper->getBundleOptions($this->item));
165165
}
166166

167+
/**
168+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
169+
*/
167170
public function testGetOptions()
168171
{
169172
$optionIds = 'a:1:{i:0;i:1;}';
@@ -254,8 +257,12 @@ public function testGetOptions()
254257

255258
$this->assertEquals(
256259
[
257-
0 => ['label' => 'title', 'value' => [0 => '1 x name <span class="price">$15.00</span>']],
258-
1 => ['label' => 'title', 'value' => 'value'],
260+
[
261+
'label' => 'title',
262+
'value' => ['1 x name <span class="price">$15.00</span>'],
263+
'has_html' => true,
264+
],
265+
['label' => 'title', 'value' => 'value'],
259266
],
260267
$this->helper->getOptions($this->item)
261268
);

app/code/Magento/Captcha/view/adminhtml/templates/default.phtml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
id="captcha"
2020
class="admin__control-text"
2121
type="text"
22-
name="<?php /* @escapeNotVerified */ echo \Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE ?>[<?php /* @escapeNotVerified */ echo $block->getFormId()?>]"
22+
name="<?php echo $block->escapeHtmlAttr(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE) ?>[<?php echo $block->escapeHtml($block->getFormId())?>]"
2323
data-validate="{required:true}"/>
2424
<?php if ($captcha->isCaseSensitive()) :?>
2525
<div class="admin__field-note">
@@ -32,19 +32,19 @@
3232
<img
3333
id="captcha-reload"
3434
class="captcha-reload"
35-
src="<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('Magento_Captcha::reload.png') ?>"
35+
src="<?php echo $block->escapeUrl($block->getViewFileUrl('Magento_Captcha::reload.png')) ?>"
3636
alt="<?php /* @escapeNotVerified */ echo __('Reload captcha') ?>"/>
3737
<img
38-
id="<?php /* @escapeNotVerified */ echo $block->getFormId() ?>"
39-
width="<?php /* @escapeNotVerified */ echo $block->getImgWidth() ?>"
40-
height="<?php /* @escapeNotVerified */ echo $block->getImgHeight() ?>"
41-
src="<?php /* @escapeNotVerified */ echo $captcha->getImgSrc() ?>" />
38+
id="<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>"
39+
width="<?php /* @noEscape */ echo (float) $block->getImgWidth() ?>"
40+
height="<?php /* @noEscape */ echo (float) $block->getImgHeight() ?>"
41+
src="<?php echo $block->escapeUrl($captcha->getImgSrc()) ?>" />
4242
</div>
4343
<script>
4444
require(["prototype", "mage/captcha"], function(){
4545

4646
//<![CDATA[
47-
var captcha = new Captcha('<?php /* @escapeNotVerified */ echo $block->getRefreshUrl() ?>', '<?php /* @escapeNotVerified */ echo $block->getFormId() ?>');
47+
var captcha = new Captcha('<?php echo $block->escapeUrl($block->getRefreshUrl()) ?>', '<?php echo $block->escapeJs($block->getFormId()) ?>');
4848

4949
$('captcha-reload').observe('click', function () {
5050
captcha.refresh(this);

app/code/Magento/Captcha/view/frontend/templates/default.phtml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<?php /* @var $captcha \Magento\Captcha\Model\DefaultModel */ ?>
1111
<?php /* @var $block \Magento\Captcha\Block\Captcha\DefaultCaptcha */ ?>
1212
<?php $captcha = $block->getCaptchaModel() ?>
13-
<div class="field captcha required" role="<?php /* @escapeNotVerified */ echo $block->getFormId()?>">
14-
<label for="captcha_<?php /* @escapeNotVerified */ echo $block->getFormId() ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Please type the letters below')?></span></label>
13+
<div class="field captcha required" role="<?php echo $block->escapeHtmlAttr($block->getFormId())?>">
14+
<label for="captcha_<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Please type the letters below')?></span></label>
1515
<div class="control captcha">
16-
<input name="<?php /* @escapeNotVerified */ echo \Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE ?>[<?php /* @escapeNotVerified */ echo $block->getFormId()?>]" type="text" class="input-text required-entry" data-validate="{required:true}" id="captcha_<?php /* @escapeNotVerified */ echo $block->getFormId() ?>" />
16+
<input name="<?php echo $block->escapeHtmlAttr(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE) ?>[<?php echo $block->escapeHtmlAttr($block->getFormId())?>]" type="text" class="input-text required-entry" data-validate="{required:true}" id="captcha_<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>" />
1717
<div class="nested">
1818
<div class="field captcha no-label"
19-
data-captcha="<?php /* @escapeNotVerified */ echo $block->getFormId()?>"
20-
id="captcha-container-<?php /* @escapeNotVerified */ echo $block->getFormId()?>"
21-
data-mage-init='{"captcha":{"url": "<?php /* @escapeNotVerified */ echo $block->getRefreshUrl()?>",
22-
"imageLoader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-2.gif') ?>",
23-
"type": "<?php /* @escapeNotVerified */ echo $block->getFormId() ?>"}}'>
19+
data-captcha="<?php echo $block->escapeHtmlAttr($block->getFormId())?>"
20+
id="captcha-container-<?php echo $block->escapeHtmlAttr($block->getFormId())?>"
21+
data-mage-init='{"captcha":{"url": "<?php echo $block->escapeUrl($block->getRefreshUrl())?>",
22+
"imageLoader": "<?php echo $block->escapeUrl($block->getViewFileUrl('images/loader-2.gif')) ?>",
23+
"type": "<?php echo $block->escapeHtmlAttr($block->getFormId()) ?>"}}'>
2424
<div class="control captcha-image">
25-
<img alt="<?php /* @escapeNotVerified */ echo __('Please type the letters below')?>" class="captcha-img" height="<?php /* @escapeNotVerified */ echo $block->getImgHeight() ?>" src="<?php /* @escapeNotVerified */ echo $captcha->getImgSrc() ?>"/>
25+
<img alt="<?php /* @escapeNotVerified */ echo __('Please type the letters below')?>" class="captcha-img" height="<?php /* @noEscape */ echo (float) $block->getImgHeight() ?>" src="<?php echo $block->escapeUrl($captcha->getImgSrc()) ?>"/>
2626
<button type="button" class="action reload captcha-reload" title="<?php /* @escapeNotVerified */ echo __('Reload captcha') ?>"><span><?php /* @escapeNotVerified */ echo __('Reload captcha') ?></span></button>
2727
</div>
2828
</div>

app/code/Magento/Catalog/Block/Adminhtml/Category/Widget/Chooser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function (node, e) {
121121
}
122122
';
123123
} else {
124-
$chooserJsObject = $this->getId();
124+
$chooserJsObject = $this->escapeJs($this->getId());
125125
$js = '
126126
function (node, e) {
127127
' .

app/code/Magento/Catalog/Block/Adminhtml/Product/Widget/Chooser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function (node, e) {
202202
{jsObject}.categoryName = node.attributes.id != "none" ? node.text : false;
203203
}
204204
';
205-
$js = str_replace('{jsObject}', $this->getJsObjectName(), $js);
205+
$js = str_replace('{jsObject}', $this->escapeJs($this->getJsObjectName()), $js);
206206
return $js;
207207
}
208208

app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function execute()
132132
$attributesData[$attributeCode] = $value;
133133
} elseif ($attribute->getFrontendInput() == 'multiselect') {
134134
// Check if 'Change' checkbox has been checked by admin for this attribute
135-
$isChanged = (bool)$this->getRequest()->getPost($attributeCode . '_checkbox');
135+
$isChanged = (bool)$this->getRequest()->getPost('toggle_' . $attributeCode);
136136
if (!$isChanged) {
137137
unset($attributesData[$attributeCode]);
138138
continue;

0 commit comments

Comments
 (0)