Skip to content

Commit ecbd77d

Browse files
author
Bryant Luk
committed
Merge remote-tracking branch 'origin/develop' into Bug-Fixes
2 parents 443c2d2 + c4bbc29 commit ecbd77d

File tree

12 files changed

+129
-18
lines changed

12 files changed

+129
-18
lines changed

app/code/Magento/Catalog/view/base/web/js/price-utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* See COPYING.txt for license details.
44
*/
55
define([
6+
'jquery',
67
'underscore'
7-
], function (_) {
8+
], function ($, _) {
89
'use strict';
910

1011
var globalPriceFormat = {

app/code/Magento/Catalog/view/frontend/templates/product/view/options/type/text.phtml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ $class = ($_option->getIsRequire()) ? ' required' : '';
3333
<input type="text"
3434
id="options_<?php echo $_option->getId() ?>_text"
3535
class="input-text product-custom-option"
36-
<?php if (!empty($_textValidate)) {
37-
echo 'data-validate=' . json_encode($_textValidate);
38-
} ?>
36+
<?php if (!empty($_textValidate)) {?>
37+
data-validate="<?php echo $block->escapeHtml(json_encode($_textValidate));?>"
38+
<?php } ?>
3939
name="options[<?php echo $_option->getId() ?>]"
4040
value="<?php echo $block->escapeHtml($block->getDefaultValue()) ?>"/>
4141
<?php elseif ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_AREA): ?>
@@ -49,9 +49,9 @@ $class = ($_option->getIsRequire()) ? ' required' : '';
4949
?>
5050
<textarea id="options_<?php echo $_option->getId() ?>_text"
5151
class="product-custom-option"
52-
<?php if (!empty($_textAreaValidate)) {
53-
echo 'data-validate=' . json_encode($_textAreaValidate);
54-
} ?>
52+
<?php if (!empty($_textAreaValidate)) {?>
53+
data-validate="<?php echo $block->escapeHtml(json_encode($_textAreaValidate));?>"
54+
<?php } ?>
5555
name="options[<?php echo $_option->getId() ?>]"
5656
rows="5"
5757
cols="25"><?php echo $block->escapeHtml($block->getDefaultValue()) ?></textarea>

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ define([
3939

4040
submitForm: function(form) {
4141
var self = this;
42-
if (form.has('input[type="file"]').length) {
42+
if (form.has('input[type="file"]').length && form.find('input[type="file"]').val() !== '') {
4343
self.element.off('submit');
4444
form.submit();
4545
} else {

app/code/Magento/Config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ protected function _getCellInputElementId($rowId, $columnName)
181181
*/
182182
protected function _getCellInputElementName($columnName)
183183
{
184-
return $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
184+
return $this->getElement()->getName() . '[<%- _id %>][' . $columnName . ']';
185185
}
186186

187187
/**
@@ -203,7 +203,7 @@ public function renderCellTemplate($columnName)
203203
return $column['renderer']->setInputName(
204204
$inputName
205205
)->setInputId(
206-
$this->_getCellInputElementId('#{_id}', $columnName)
206+
$this->_getCellInputElementId('<%- _id %>', $columnName)
207207
)->setColumnName(
208208
$columnName
209209
)->setColumn(
@@ -212,15 +212,15 @@ public function renderCellTemplate($columnName)
212212
}
213213

214214
return '<input type="text" id="' . $this->_getCellInputElementId(
215-
'#{_id}',
215+
'<%- _id %>',
216216
$columnName
217217
) .
218218
'"' .
219219
' name="' .
220220
$inputName .
221-
'" value="#{' .
221+
'" value="<%- ' .
222222
$columnName .
223-
'}" ' .
223+
' %>" ' .
224224
($column['size'] ? 'size="' .
225225
$column['size'] .
226226
'"' : '') .

app/code/Magento/Config/Block/System/Config/Form/Field/Regexceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function renderCellTemplate($columnName)
6969
)->setName(
7070
$this->_getCellInputElementName($columnName)
7171
)->setHtmlId(
72-
$this->_getCellInputElementId('#{_id}', $columnName)
72+
$this->_getCellInputElementId('<%- _id %>', $columnName)
7373
)->setValues(
7474
$options
7575
);

app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
4242
'prototype'
4343
], function (mageTemplate) {
4444
// create row creator
45-
var arrayRow<?php echo $_htmlId ?> = {
45+
window.arrayRow<?php echo $_htmlId ?> = {
4646

4747
// define row prototypeJS template
4848
template: mageTemplate(

app/code/Magento/Customer/etc/data_source/customer_address.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@
4848
</constraints>
4949
</field>
5050
<field name="region" source="eav" formElement="input" visible="false"/>
51-
<field name="postcode" source="eav">
51+
52+
<field name="postcode" source="eav" formElement="post_code_fix" >
5253
<constraints>
5354
<validate name="required-entry"/>
5455
</constraints>
5556
</field>
57+
5658
<field name="telephone" source="eav" label="Phone Number">
5759
<constraints>
5860
<validate name="required-entry"/>

app/code/Magento/Directory/Model/Resource/Country/Collection.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
*/
1212
namespace Magento\Directory\Model\Resource\Country;
1313

14+
/**
15+
* Class Collection
16+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17+
*/
1418
class Collection extends \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection
1519
{
1620
/**
@@ -44,6 +48,11 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
4448
*/
4549
protected $_localeResolver;
4650

51+
/**
52+
* @var \Magento\Directory\Helper\Data
53+
*/
54+
protected $helperData;
55+
4756
/**
4857
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
4958
* @param \Psr\Log\LoggerInterface $logger
@@ -54,6 +63,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
5463
* @param \Magento\Directory\Model\Resource\CountryFactory $countryFactory
5564
* @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils
5665
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
66+
* @param \Magento\Framework\App\Helper\AbstractHelper $helperData
5767
* @param mixed $connection
5868
* @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource
5969
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -68,6 +78,7 @@ public function __construct(
6878
\Magento\Directory\Model\Resource\CountryFactory $countryFactory,
6979
\Magento\Framework\Stdlib\ArrayUtils $arrayUtils,
7080
\Magento\Framework\Locale\ResolverInterface $localeResolver,
81+
\Magento\Framework\App\Helper\AbstractHelper $helperData,
7182
$connection = null,
7283
\Magento\Framework\Model\Resource\Db\AbstractDb $resource = null
7384
) {
@@ -77,6 +88,7 @@ public function __construct(
7788
$this->_localeResolver = $localeResolver;
7889
$this->_countryFactory = $countryFactory;
7990
$this->_arrayUtils = $arrayUtils;
91+
$this->helperData = $helperData;
8092
}
8193

8294
/**
@@ -208,7 +220,11 @@ public function toOptionArray($emptyLabel = ' ')
208220
}
209221
$options = [];
210222
foreach ($sort as $label => $value) {
211-
$options[] = ['value' => $value, 'label' => $label];
223+
$option = ['value' => $value, 'label' => $label];
224+
if ($this->helperData->isRegionRequired($value)) {
225+
$option['is_region_required'] = true;
226+
}
227+
$options[] = $option;
212228
}
213229

214230
if (count($options) > 0 && $emptyLabel !== false) {

app/code/Magento/Directory/Test/Unit/Model/Resource/Country/CollectionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ protected function setUp()
4747
'',
4848
false
4949
);
50+
$helperDataMock = $this->getMock(
51+
'Magento\Directory\Helper\Data',
52+
[],
53+
[],
54+
'',
55+
false
56+
);
5057
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
5158
$arguments = [
5259
'logger' => $logger,
@@ -57,6 +64,7 @@ protected function setUp()
5764
'scopeConfig' => $scopeConfigMock,
5865
'countryFactory' => $countryFactory,
5966
'resource' => $resource,
67+
'helperData' => $helperDataMock
6068
];
6169
$this->_model = $objectManager->getObject('Magento\Directory\Model\Resource\Country\Collection', $arguments);
6270
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
9-
<type name="Magento\Directory\Model\Resource\Country\Collection" shared="false" />
109
<type name="Magento\Directory\Model\Currency\Import\Config">
1110
<arguments>
1211
<argument name="servicesConfig" xsi:type="array">
@@ -17,4 +16,15 @@
1716
</argument>
1817
</arguments>
1918
</type>
19+
20+
<virtualType name="DirectoryHelperDataProxy" type="Magento\Directory\Helper\Data\Proxy">
21+
<arguments>
22+
<argument name="instanceName" xsi:type="string">Magento\Directory\Helper\Data</argument>
23+
</arguments>
24+
</virtualType>
25+
<type name="Magento\Directory\Model\Resource\Country\Collection" shared="false">
26+
<arguments>
27+
<argument name="helperData" xsi:type="object">DirectoryHelperDataProxy</argument>
28+
</arguments>
29+
</type>
2030
</config>

0 commit comments

Comments
 (0)