Skip to content

Commit ef556ce

Browse files
author
Michail Slabko
committed
Merge remote-tracking branch 'mainline/develop' into goinc-bugsfixing
2 parents cf70c6d + f920640 commit ef556ce

File tree

315 files changed

+5412
-5457
lines changed

Some content is hidden

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

315 files changed

+5412
-5457
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,25 @@ public function render(\Magento\Framework\DataObject $row)
7777
{
7878
$values = $this->_getValues();
7979
$value = $row->getData($this->getColumn()->getIndex());
80+
$checked = '';
8081
if (is_array($values)) {
8182
$checked = in_array($value, $values) ? ' checked="checked"' : '';
8283
} else {
83-
$checked = $value === $this->getColumn()->getValue() ? ' checked="checked"' : '';
84+
$checkedValue = $this->getColumn()->getValue();
85+
if ($checkedValue !== null) {
86+
$checked = $value === $checkedValue ? ' checked="checked"' : '';
87+
}
8488
}
8589

90+
$disabled = '';
8691
$disabledValues = $this->getColumn()->getDisabledValues();
8792
if (is_array($disabledValues)) {
8893
$disabled = in_array($value, $disabledValues) ? ' disabled="disabled"' : '';
8994
} else {
90-
$disabled = $value === $this->getColumn()->getDisabledValue() ? ' disabled="disabled"' : '';
95+
$disabledValue = $this->getColumn()->getDisabledValue();
96+
if ($disabledValue !== null) {
97+
$disabled = $value === $disabledValue ? ' disabled="disabled"' : '';
98+
}
9199
}
92100

93101
$this->setDisabled($disabled);
@@ -108,15 +116,18 @@ public function render(\Magento\Framework\DataObject $row)
108116
*/
109117
protected function _getCheckboxHtml($value, $checked)
110118
{
111-
$html = '<input type="checkbox" ';
119+
$html = '<label class="data-grid-checkbox-cell-inner" ';
120+
$html .= ' for="id_' . $this->escapeHtml($value) . '">';
121+
$html .= '<input type="checkbox" ';
112122
$html .= 'name="' . $this->getColumn()->getFieldName() . '" ';
113123
$html .= 'value="' . $this->escapeHtml($value) . '" ';
124+
$html .= 'id="id_' . $this->escapeHtml($value) . '" ';
114125
$html .= 'class="' .
115126
($this->getColumn()->getInlineCss() ? $this->getColumn()->getInlineCss() : 'checkbox') .
116-
' admin__control-checkbox' .
117-
'"';
127+
' admin__control-checkbox' . '"';
118128
$html .= $checked . $this->getDisabled() . '/>';
119-
$html .= '<label></label>';
129+
$html .= '<label for="id_' . $this->escapeHtml($value) . '"></label>';
130+
$html .= '</label>';
120131
/* ToDo UI: add class="admin__field-label" after some refactoring _fields.less */
121132
return $html;
122133
}

app/code/Magento/Backend/Model/Session/AdminConfig.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class AdminConfig extends Config
3030
protected $_frontNameResolver;
3131

3232
/**
33-
* @var \Magento\Store\Model\StoreManagerInterface
33+
* @var \Magento\Backend\App\BackendAppList
3434
*/
35-
protected $_storeManager;
35+
private $backendAppList;
3636

3737
/**
38-
* @var \Magento\Backend\App\BackendAppList
38+
* @var \Magento\Backend\Model\UrlFactory
3939
*/
40-
private $backendAppList;
40+
private $backendUrlFactory;
4141

4242
/**
4343
* @param \Magento\Framework\ValidatorFactory $validatorFactory
@@ -49,7 +49,7 @@ class AdminConfig extends Config
4949
* @param string $scopeType
5050
* @param \Magento\Backend\App\BackendAppList $backendAppList
5151
* @param FrontNameResolver $frontNameResolver
52-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
52+
* @param \Magento\Backend\Model\UrlFactory $backendUrlFactory
5353
* @param string $lifetimePath
5454
* @param string $sessionName
5555
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -64,7 +64,7 @@ public function __construct(
6464
$scopeType,
6565
\Magento\Backend\App\BackendAppList $backendAppList,
6666
FrontNameResolver $frontNameResolver,
67-
\Magento\Store\Model\StoreManagerInterface $storeManager,
67+
\Magento\Backend\Model\UrlFactory $backendUrlFactory,
6868
$lifetimePath = self::XML_PATH_COOKIE_LIFETIME,
6969
$sessionName = self::SESSION_NAME_ADMIN
7070
) {
@@ -79,8 +79,8 @@ public function __construct(
7979
$lifetimePath
8080
);
8181
$this->_frontNameResolver = $frontNameResolver;
82-
$this->_storeManager = $storeManager;
8382
$this->backendAppList = $backendAppList;
83+
$this->backendUrlFactory = $backendUrlFactory;
8484
$adminPath = $this->extractAdminPath();
8585
$this->setCookiePath($adminPath);
8686
$this->setName($sessionName);
@@ -95,7 +95,7 @@ private function extractAdminPath()
9595
{
9696
$backendApp = $this->backendAppList->getCurrentApp();
9797
$cookiePath = null;
98-
$baseUrl = parse_url($this->_storeManager->getStore()->getBaseUrl(), PHP_URL_PATH);
98+
$baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH);
9999
if (!$backendApp) {
100100
$cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName();
101101
return $cookiePath;

app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase
2929
private $objectManager;
3030

3131
/**
32-
* @var \Magento\Store\Model\StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject
32+
* @var \Magento\Backend\Model\UrlFactory | \PHPUnit_Framework_MockObject_MockObject
3333
*/
34-
private $storeManagerMock;
34+
private $backendUrlFactory;
3535

3636
/**
3737
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
@@ -56,13 +56,10 @@ protected function setUp()
5656
$this->validatorFactory = $this->getMockBuilder('Magento\Framework\ValidatorFactory')
5757
->disableOriginalConstructor()
5858
->getMock();
59-
60-
$storeMock = $this->getMockBuilder('\Magento\Store\Model\Store')
61-
->disableOriginalConstructor()
62-
->getMock();
63-
$storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/'));
64-
$this->storeManagerMock = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface');
65-
$this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
59+
$backendUrl = $this->getMock('\Magento\Backend\Model\Url', [], [], '', false);
60+
$backendUrl->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/'));
61+
$this->backendUrlFactory = $this->getMock('Magento\Backend\Model\UrlFactory', ['create'], [], '', false);
62+
$this->backendUrlFactory->expects($this->any())->method('create')->willReturn($backendUrl);
6663

6764
$this->filesystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false);
6865
$dirMock = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface');
@@ -99,7 +96,7 @@ public function testSetCookiePathNonDefault()
9996
'validatorFactory' => $this->validatorFactory,
10097
'request' => $this->requestMock,
10198
'frontNameResolver' => $mockFrontNameResolver,
102-
'storeManager' => $this->storeManagerMock,
99+
'backendUrlFactory' => $this->backendUrlFactory,
103100
'filesystem' => $this->filesystemMock,
104101
]
105102
);
@@ -134,7 +131,7 @@ public function testSetSessionNameByConstructor()
134131
'validatorFactory' => $this->validatorFactory,
135132
'request' => $this->requestMock,
136133
'sessionName' => $sessionName,
137-
'storeManager' => $this->storeManagerMock,
134+
'backendUrlFactory' => $this->backendUrlFactory,
138135
'filesystem' => $this->filesystemMock,
139136
]
140137
);

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (!isset($advancedLabel)) {
2222
$advancedLabel = __('Additional Settings');
2323
}
2424

25-
$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset' . $element->getClass();
25+
$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset ' . $element->getClass();
2626

2727
if ($isField) {
2828
$count = $element->getCountBasicChildren();

app/code/Magento/Braintree/Model/PaymentMethod.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use \Braintree_Transaction;
1212
use \Braintree_Result_Successful;
1313
use Magento\Framework\Exception\LocalizedException;
14+
use Magento\Sales\Model\Order\Payment\Transaction;
1415
use Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory as TransactionCollectionFactory;
1516
use Magento\Sales\Model\Order\Payment\Transaction as PaymentTransaction;
1617
use Magento\Payment\Model\InfoInterface;
@@ -648,13 +649,15 @@ public function refund(InfoInterface $payment, $amount)
648649
}
649650
}
650651

652+
// transaction should be voided if it not settled
651653
$canVoid = ($transaction->status === \Braintree_Transaction::AUTHORIZED
652654
|| $transaction->status === \Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT);
653655
$result = $canVoid
654656
? $this->braintreeTransaction->void($transactionId)
655657
: $this->braintreeTransaction->refund($transactionId, $amount);
656658
$this->_debug($this->_convertObjToArray($result));
657659
if ($result->success) {
660+
$payment->setTransactionId($transactionId . '-' . Transaction::TYPE_REFUND);
658661
$payment->setIsTransactionClosed(true);
659662
} else {
660663
throw new LocalizedException($this->errorHelper->parseBraintreeError($result));

app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Braintree\Model\PaymentMethod;
1010
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
11+
use Magento\Sales\Model\Order\Payment\Transaction;
1112
use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory as TransactionCollectionFactory;
1213
use Magento\Framework\Exception\LocalizedException;
1314
use \Braintree_Result_Successful;
@@ -2378,6 +2379,7 @@ public function testRefund()
23782379

23792380
$this->model->refund($paymentObject, $amount);
23802381
$this->assertEquals(1, $paymentObject->getIsTransactionClosed());
2382+
$this->assertEquals($refundTransactionId . '-' .Transaction::TYPE_REFUND, $paymentObject->getTransactionId());
23812383
}
23822384

23832385
/**

app/code/Magento/Braintree/view/adminhtml/templates/form.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
133133
</div>
134134
</fieldset>
135135
<?php endif; ?>
136-
<?php if($_useVault): ?>
136+
<?php if($useVault): ?>
137137
<fieldset class="admin__fieldset hide_if_token_selected">
138138
<div id="<?php /* @noEscape */ echo $code; ?>_store_in_vault_div" style="text-align:left;" class="">
139139
<input type="checkbox" title="<?php echo $block->escapeHtml(__('Save this card for future use')); ?>"

app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions"/>
2525
<block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="express/review/details.phtml">
2626
<block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
27-
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>
27+
<block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
2828
</block>
2929
<block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
3030
</block>

app/code/Magento/Braintree/view/frontend/templates/creditcard/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $storedCards = $block->getCurrentCustomerStoredCards();
1919
<?php endif; ?>
2020
</div>
2121
<?php echo $block->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
22-
<?php if (count($_storedCards)): ?>
22+
<?php if (count($storedCards)): ?>
2323
<table class="data-table" id="my-quotes-table">
2424
<col width="1" />
2525
<col width="1" />

app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@
8080
<!-- ko if: (isCcDetectionEnabled())-->
8181
<ul class="credit-card-types">
8282
<!-- ko foreach: {data: getCcAvailableTypesValues(), as: 'item'} -->
83-
<li class="item" data-bind="css: {_active: $parent.selectedCardType() == item.value} ">
83+
<li class="item" data-bind="css: {
84+
_active: $parent.selectedCardType() == item.value,
85+
_inactive: $parent.selectedCardType() != null && $parent.selectedCardType() != item.value
86+
} ">
8487
<!--ko if: $parent.getIcons(item.value) -->
8588
<img data-bind="attr: {
8689
'src': $parent.getIcons(item.value).url,

app/code/Magento/Catalog/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@
494494
</argument>
495495
</arguments>
496496
</type>
497+
<type name="Magento\Catalog\Console\Command\ImagesResizeCommand">
498+
<arguments>
499+
<argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument>
500+
</arguments>
501+
</type>
497502
<type name="Magento\Framework\Config\View">
498503
<arguments>
499504
<argument name="xpath" xsi:type="array">

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@
466466
click: function () {
467467
(function ($) {
468468
$.ajax({
469-
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>//',
469+
url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>',
470470
method: 'POST',
471471
data: pd.join(""),
472472
showLoader: true

app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,5 @@ define([
761761
}
762762
};
763763

764-
jQuery(document).ready(function(){
765-
productConfigure = new ProductConfigure();
766-
});
767-
764+
productConfigure = new ProductConfigure();
768765
});

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\CatalogSearch\Model\Adapter\Mysql\Filter;
77

88
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
910
use Magento\CatalogSearch\Model\Search\TableMapper;
1011
use Magento\Eav\Model\Config;
1112
use Magento\Framework\App\ResourceConnection;
@@ -97,7 +98,7 @@ public function process(FilterInterface $filter, $isNegation, $query)
9798
*/
9899
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
99100
{
100-
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */
101+
/** @var Attribute $attribute */
101102
$attribute = $this->config->getAttribute(Product::ENTITY, $filter->getField());
102103
if ($filter->getField() === 'price') {
103104
$resultQuery = str_replace(
@@ -114,24 +115,16 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
114115
$this->connection->quoteIdentifier($alias . '.' . $attribute->getAttributeCode()),
115116
$query
116117
);
117-
} elseif ($filter->getType() === FilterInterface::TYPE_TERM
118-
&& in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
118+
} elseif (
119+
$filter->getType() === FilterInterface::TYPE_TERM &&
120+
in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true)
119121
) {
120-
$alias = $this->tableMapper->getMappingAlias($filter);
121-
if (is_array($filter->getValue())) {
122-
$value = sprintf(
123-
'%s IN (%s)',
124-
($isNegation ? 'NOT' : ''),
125-
implode(',', $filter->getValue())
126-
);
127-
} else {
128-
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
129-
}
130-
$resultQuery = sprintf(
131-
'%1$s.value %2$s',
132-
$alias,
133-
$value
134-
);
122+
$resultQuery = $this->processTermSelect($filter, $isNegation);
123+
} elseif (
124+
$filter->getType() === FilterInterface::TYPE_RANGE &&
125+
in_array($attribute->getBackendType(), ['decimal', 'int'], true)
126+
) {
127+
$resultQuery = $this->processRangeNumeric($filter, $query, $attribute);
135128
} else {
136129
$table = $attribute->getBackendTable();
137130
$select = $this->connection->select();
@@ -161,4 +154,57 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
161154

162155
return $resultQuery;
163156
}
157+
158+
/**
159+
* @param FilterInterface $filter
160+
* @param string $query
161+
* @param Attribute $attribute
162+
* @return string
163+
*/
164+
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
165+
{
166+
$tableSuffix = $attribute->getBackendType() === 'decimal' ? '_decimal' : '';
167+
$table = $this->resource->getTableName("catalog_product_index_eav{$tableSuffix}");
168+
$select = $this->connection->select();
169+
170+
$currentStoreId = $this->scopeResolver->getScope()->getId();
171+
172+
$select->from(['main_table' => $table], 'entity_id')
173+
->columns([$filter->getField() => 'main_table.value'])
174+
->where('main_table.attribute_id = ?', $attribute->getAttributeId())
175+
->where('main_table.store_id = ?', $currentStoreId)
176+
->having($query);
177+
178+
$resultQuery = 'search_index.entity_id IN (
179+
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
180+
)';
181+
182+
return $resultQuery;
183+
}
184+
185+
/**
186+
* @param FilterInterface $filter
187+
* @param bool $isNegation
188+
* @return string
189+
*/
190+
private function processTermSelect(FilterInterface $filter, $isNegation)
191+
{
192+
$alias = $this->tableMapper->getMappingAlias($filter);
193+
if (is_array($filter->getValue())) {
194+
$value = sprintf(
195+
'%s IN (%s)',
196+
($isNegation ? 'NOT' : ''),
197+
implode(',', $filter->getValue())
198+
);
199+
} else {
200+
$value = ($isNegation ? '!' : '') . '= ' . $filter->getValue();
201+
}
202+
$resultQuery = sprintf(
203+
'%1$s.value %2$s',
204+
$alias,
205+
$value
206+
);
207+
208+
return $resultQuery;
209+
}
164210
}

0 commit comments

Comments
 (0)