Skip to content

Commit decd746

Browse files
Merge branch 'develop' of github.com:magento/magento2ce into PR-4
2 parents 6d28ea9 + 535860a commit decd746

File tree

43 files changed

+858
-342
lines changed

Some content is hidden

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

43 files changed

+858
-342
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ atlassian*
2525
/.grunt
2626
/Gruntfile.js
2727
/package.json
28+
/.php_cs
29+
/.php_cs.cache
30+
/grunt-config.json
31+
/dev/tools/grunt/configs/local-themes.js
2832

2933
/pub/media/*.*
3034
!/pub/media/.htaccess

.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
order allow,deny
223223
deny from all
224224
</Files>
225-
<Files .php_cs>
225+
<Files .php_cs.dist>
226226
order allow,deny
227227
deny from all
228228
</Files>

.htaccess.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
order allow,deny
199199
deny from all
200200
</Files>
201-
<Files .php_cs>
201+
<Files .php_cs.dist>
202202
order allow,deny
203203
deny from all
204204
</Files>

.php_cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

.php_cs.dist

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* Pre-commit hook installation:
9+
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
10+
*/
11+
$finder = PhpCsFixer\Finder::create()
12+
->name('*.phtml')
13+
->exclude('dev/tests/functional/generated')
14+
->exclude('dev/tests/functional/var')
15+
->exclude('dev/tests/functional/vendor')
16+
->exclude('dev/tests/integration/tmp')
17+
->exclude('dev/tests/integration/var')
18+
->exclude('lib/internal/Cm')
19+
->exclude('lib/internal/Credis')
20+
->exclude('lib/internal/Less')
21+
->exclude('lib/internal/LinLibertineFont')
22+
->exclude('pub/media')
23+
->exclude('pub/static')
24+
->exclude('setup/vendor')
25+
->exclude('var');
26+
27+
return PhpCsFixer\Config::create()
28+
->setFinder($finder)
29+
->setRules([
30+
'@PSR2' => true,
31+
'array_syntax' => ['syntax' => 'short'],
32+
'concat_space' => ['spacing' => 'one'],
33+
'include' => true,
34+
'new_with_braces' => true,
35+
'no_empty_statement' => true,
36+
'no_extra_consecutive_blank_lines' => true,
37+
'no_leading_import_slash' => true,
38+
'no_leading_namespace_whitespace' => true,
39+
'no_multiline_whitespace_around_double_arrow' => true,
40+
'no_multiline_whitespace_before_semicolons' => true,
41+
'no_singleline_whitespace_before_semicolons' => true,
42+
'no_trailing_comma_in_singleline_array' => true,
43+
'no_unused_imports' => true,
44+
'no_whitespace_in_blank_line' => true,
45+
'object_operator_without_whitespace' => true,
46+
'ordered_imports' => true,
47+
'standardize_not_equals' => true,
48+
'ternary_operator_spaces' => true,
49+
]);
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"Read Details","Read Details"
22
"Mark as Read","Mark as Read"
33
"Are you sure?","Are you sure?"
4-
Remove,Remove
4+
"Remove","Remove"
55
"Messages Inbox","Messages Inbox"
66
"You have %1 new system messages","You have %1 new system messages"
77
"You have %1 new system message","You have %1 new system message"
88
"Incoming Message","Incoming Message"
9-
close,close
10-
Notifications,Notifications
9+
"close","close"
10+
"Notifications","Notifications"
1111
"The message has been marked as Read.","The message has been marked as Read."
1212
"We couldn't mark the notification as Read because of an error.","We couldn't mark the notification as Read because of an error."
1313
"Please select messages.","Please select messages."
@@ -20,10 +20,10 @@ Notifications,Notifications
2020
"6 Hours","6 Hours"
2121
"12 Hours","12 Hours"
2222
"24 Hours","24 Hours"
23-
critical,critical
24-
major,major
25-
minor,minor
26-
notice,notice
23+
"critical","critical"
24+
"major","major"
25+
"minor","minor"
26+
"notice","notice"
2727
"Wrong message type","Wrong message type"
2828
"Wrong notification ID specified.","Wrong notification ID specified."
2929
"{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento <a href=""%1"">configuration</a>.","{{base_url}} is not recommended to use in a production environment to declare the Base Unsecure URL / Base Secure URL. We highly recommend changing this value in your Magento <a href=""%1"">configuration</a>."
@@ -33,7 +33,7 @@ notice,notice
3333
"Synchronization of media storages has been completed.","Synchronization of media storages has been completed."
3434
"Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider.","Your web server is set up incorrectly and allows unauthorized access to sensitive files. Please contact your hosting provider."
3535
"Close popup","Close popup"
36-
Close,Close
36+
"Close","Close"
3737
"System Messages:","System Messages:"
3838
"Critical System Messages","Critical System Messages"
3939
"Major System Messages","Major System Messages"
@@ -45,7 +45,7 @@ Close,Close
4545
"Use HTTPS to Get Feed","Use HTTPS to Get Feed"
4646
"Update Frequency","Update Frequency"
4747
"Last Update","Last Update"
48-
Severity,Severity
48+
"Severity","Severity"
4949
"Date Added","Date Added"
50-
Message,Message
51-
Actions,Actions
50+
"Message","Message"
51+
"Actions","Actions"

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Minute,Minute
250250
"JavaScript may be disabled in your browser.","JavaScript may be disabled in your browser."
251251
"To use this website you must first enable JavaScript in your browser.","To use this website you must first enable JavaScript in your browser."
252252
"This is only a demo store. You can browse and place orders, but nothing will be processed.","This is only a demo store. You can browse and place orders, but nothing will be processed."
253-
"Report a Bug","Report a Bug"
253+
"Report an Issue","Report an Issue"
254254
"Store View:","Store View:"
255255
"Stores Configuration","Stores Configuration"
256256
"Please confirm scope switching. All data that hasn\'t been saved will be lost.","Please confirm scope switching. All data that hasn\'t been saved will be lost."

app/code/Magento/Backend/view/adminhtml/templates/page/report.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
?>
1010
<?php if ($block->getBugreportUrl()): ?>
11-
<a class="link-report" href="<?php /* @escapeNotVerified */ echo $block->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php /* @escapeNotVerified */ echo __('Report a Bug') ?></a>
11+
<a class="link-report" href="<?php /* @escapeNotVerified */ echo $block->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php /* @escapeNotVerified */ echo __('Report an Issue') ?></a>
1212
<?php endif; ?>
Loading

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,6 @@ protected function _saveProductWebsites(array $websiteData)
21162116
*/
21172117
protected function _saveStockItem()
21182118
{
2119-
$indexer = $this->indexerRegistry->get('catalog_product_category');
21202119
/** @var $stockResource \Magento\CatalogInventory\Model\ResourceModel\Stock\Item */
21212120
$stockResource = $this->_stockResItemFac->create();
21222121
$entityTable = $stockResource->getMainTable();
@@ -2172,13 +2171,25 @@ protected function _saveStockItem()
21722171
$this->_connection->insertOnDuplicate($entityTable, array_values($stockData));
21732172
}
21742173

2175-
if ($productIdsToReindex) {
2176-
$indexer->reindexList($productIdsToReindex);
2177-
}
2174+
$this->reindexProducts($productIdsToReindex);
21782175
}
21792176
return $this;
21802177
}
21812178

2179+
/**
2180+
* Initiate product reindex by product ids
2181+
*
2182+
* @param array $productIdsToReindex
2183+
* @return void
2184+
*/
2185+
private function reindexProducts($productIdsToReindex = [])
2186+
{
2187+
$indexer = $this->indexerRegistry->get('catalog_product_category');
2188+
if (is_array($productIdsToReindex) && count($productIdsToReindex) > 0 && !$indexer->isScheduled()) {
2189+
$indexer->reindexList($productIdsToReindex);
2190+
}
2191+
}
2192+
21822193
/**
21832194
* Retrieve attribute by code
21842195
*

app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(
5353
public function apply(\Magento\Framework\App\RequestInterface $request)
5454
{
5555
$attributeValue = $request->getParam($this->_requestVar);
56-
if (empty($attributeValue)) {
56+
if (empty($attributeValue) && !is_numeric($attributeValue)) {
5757
return $this;
5858
}
5959
$attribute = $this->getAttributeModel();
@@ -84,9 +84,10 @@ protected function _getItemsData()
8484
->getProductCollection();
8585
$optionsFacetedData = $productCollection->getFacetedData($attribute->getAttributeCode());
8686

87-
if (count($optionsFacetedData) === 0
88-
&& $this->getAttributeIsFilterable($attribute) !== static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
89-
) {
87+
$isAttributeFilterable =
88+
$this->getAttributeIsFilterable($attribute) === static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS;
89+
90+
if (count($optionsFacetedData) === 0 && !$isAttributeFilterable) {
9091
return $this->itemDataBuilder->build();
9192
}
9293

@@ -95,28 +96,64 @@ protected function _getItemsData()
9596
$options = $attribute->getFrontend()
9697
->getSelectOptions();
9798
foreach ($options as $option) {
98-
if (empty($option['value'])) {
99-
continue;
100-
}
99+
$this->buildOptionData($option, $isAttributeFilterable, $optionsFacetedData, $productSize);
100+
}
101101

102-
$value = $option['value'];
102+
return $this->itemDataBuilder->build();
103+
}
103104

104-
$count = isset($optionsFacetedData[$value]['count'])
105-
? (int)$optionsFacetedData[$value]['count']
106-
: 0;
107-
// Check filter type
108-
if ($this->getAttributeIsFilterable($attribute) === static::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS
109-
&& (!$this->isOptionReducesResults($count, $productSize) || $count === 0)
110-
) {
111-
continue;
112-
}
113-
$this->itemDataBuilder->addItemData(
114-
$this->tagFilter->filter($option['label']),
115-
$value,
116-
$count
117-
);
105+
/**
106+
* Build option data
107+
*
108+
* @param array $option
109+
* @param boolean $isAttributeFilterable
110+
* @param array $optionsFacetedData
111+
* @param int $productSize
112+
* @return void
113+
*/
114+
private function buildOptionData($option, $isAttributeFilterable, $optionsFacetedData, $productSize)
115+
{
116+
$value = $this->getOptionValue($option);
117+
if ($value === false) {
118+
return;
119+
}
120+
$count = $this->getOptionCount($value, $optionsFacetedData);
121+
if ($isAttributeFilterable && (!$this->isOptionReducesResults($count, $productSize) || $count === 0)) {
122+
return;
118123
}
119124

120-
return $this->itemDataBuilder->build();
125+
$this->itemDataBuilder->addItemData(
126+
$this->tagFilter->filter($option['label']),
127+
$value,
128+
$count
129+
);
130+
}
131+
132+
/**
133+
* Retrieve option value if it exists
134+
*
135+
* @param array $option
136+
* @return bool|string
137+
*/
138+
private function getOptionValue($option)
139+
{
140+
if (empty($option['value']) && !is_numeric($option['value'])) {
141+
return false;
142+
}
143+
return $option['value'];
144+
}
145+
146+
/**
147+
* Retrieve count of the options
148+
*
149+
* @param int|string $value
150+
* @param array $optionsFacetedData
151+
* @return int
152+
*/
153+
private function getOptionCount($value, $optionsFacetedData)
154+
{
155+
return isset($optionsFacetedData[$value]['count'])
156+
? (int)$optionsFacetedData[$value]['count']
157+
: 0;
121158
}
122159
}

app/code/Magento/Checkout/Block/Cart/AbstractCart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AbstractCart extends \Magento\Framework\View\Element\Template
4040
protected $_customerSession;
4141

4242
/**
43-
* @var \Magento\Customer\Model\Session
43+
* @var \Magento\Checkout\Model\Session
4444
*/
4545
protected $_checkoutSession;
4646

app/code/Magento/Directory/Setup/InstallData.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,28 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
808808
['BR', 'SP', 'São Paulo'],
809809
['BR', 'SE', 'Sergipe'],
810810
['BR', 'TO', 'Tocantins'],
811-
['BR', 'DF', 'Distrito Federal']
811+
['BR', 'DF', 'Distrito Federal'],
812+
['HR', 'HR-01', 'Zagrebačka županija'],
813+
['HR', 'HR-02', 'Krapinsko-zagorska županija'],
814+
['HR', 'HR-03', 'Sisačko-moslavačka županija'],
815+
['HR', 'HR-04', 'Karlovačka županija'],
816+
['HR', 'HR-05', 'Varaždinska županija'],
817+
['HR', 'HR-06', 'Koprivničko-križevačka županija'],
818+
['HR', 'HR-07', 'Bjelovarsko-bilogorska županija'],
819+
['HR', 'HR-08', 'Primorsko-goranska županija'],
820+
['HR', 'HR-09', 'Ličko-senjska županija'],
821+
['HR', 'HR-10', 'Virovitičko-podravska županija'],
822+
['HR', 'HR-11', 'Požeško-slavonska županija'],
823+
['HR', 'HR-12', 'Brodsko-posavska županija'],
824+
['HR', 'HR-13', 'Zadarska županija'],
825+
['HR', 'HR-14', 'Osječko-baranjska županija'],
826+
['HR', 'HR-15', 'Šibensko-kninska županija'],
827+
['HR', 'HR-16', 'Vukovarsko-srijemska županija'],
828+
['HR', 'HR-17', 'Splitsko-dalmatinska županija'],
829+
['HR', 'HR-18', 'Istarska županija'],
830+
['HR', 'HR-19', 'Dubrovačko-neretvanska županija'],
831+
['HR', 'HR-20', 'Međimurska županija'],
832+
['HR', 'HR-21', 'Grad Zagreb']
812833
];
813834

814835
foreach ($data as $row) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@
277277
</zip>
278278
<zip countryCode="MT">
279279
<codes>
280-
<code id="pattern_1" active="true" example="ABC 123">^[a-zA-Z]{3}\s[0-9]{3}$</code>
281-
<code id="pattern_2" active="true" example="ABC 12">^[a-zA-Z]{3}\s[0-9]{2}$</code>
280+
<code id="pattern_1" active="true" example="ABC 1234">^[a-zA-Z]{3}\s[0-9]{4}$</code>
281+
<code id="pattern_2" active="true" example="ABC 123">^[a-zA-Z]{3}\s[0-9]{3}$</code>
282+
<code id="pattern_3" active="true" example="ABC 12">^[a-zA-Z]{3}\s[0-9]{2}$</code>
282283
</codes>
283284
</zip>
284285
<zip countryCode="MH">

0 commit comments

Comments
 (0)