Skip to content

Commit 7690587

Browse files
author
Igor Melnikov
committed
Merge branch 'upstream-develop' into MAGETWO-46445-correct-erroneous-negative-recommendation
2 parents a5bbe40 + 77988b6 commit 7690587

File tree

66 files changed

+1264
-669
lines changed

Some content is hidden

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

66 files changed

+1264
-669
lines changed

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: php
22
php:
33
- 5.5
44
- 5.6
5+
- 7.0
56
env:
67
- TEST_SUITE=unit
78
- TEST_SUITE=integration_part_1
@@ -37,13 +38,7 @@ before_script:
3738
# Mock mail
3839
- sudo service postfix stop
3940
- smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
40-
- echo -e '#!/usr/bin/env bash\nexit 0' | sudo tee /usr/sbin/sendmail
41-
- >
42-
echo 'sendmail_path = "/usr/sbin/sendmail -t -i "'
43-
| sudo tee "/home/travis/.phpenv/versions/`php -i
44-
| grep "PHP Version"
45-
| head -n 1
46-
| grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini"
41+
- echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' > $(php --ini|grep -m 1 "ini files in:"|cut -d ":" -f 2)/sendmail.ini
4742
# Disable xDebug
4843
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
4944
# Install MySQL 5.6, create DB for integration tests

app/autoload.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
*/
1414
define('BP', dirname(__DIR__));
1515

16-
$vendorDir = require BP . '/app/etc/vendor_path.php';
16+
define('VENDOR_PATH', BP . '/app/etc/vendor_path.php');
17+
18+
if (!file_exists(VENDOR_PATH)) {
19+
throw new \Exception(
20+
'We can\'t read some files that are required to run the Magento application. '
21+
. 'This usually means file permissions are set incorrectly.'
22+
);
23+
}
24+
25+
$vendorDir = require VENDOR_PATH;
1726
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
1827

1928
/* 'composer install' validation */

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Store switcher block
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
11-
*/
127
namespace Magento\Backend\Block\Store;
138

149
/**
10+
* Store switcher block
11+
*
1512
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1613
*/
1714
class Switcher extends \Magento\Backend\Block\Template
1815
{
1916
/**
2017
* URL for store switcher hint
2118
*/
22-
const HINT_URL = 'http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes';
19+
const HINT_URL = 'http://docs.magento.com/m2/ce/user_guide/stores/configuration.html';
2320

2421
/**
2522
* Name of website variable

app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ require([
5050
showTime: false,
5151
showHour: false,
5252
showMinute: false,
53-
localTimezone: <?php /* @escapeNotVerified */ echo $block->getTimezoneOffsetSeconds() ?>,
54-
serverTimezoneSeconds:<?php /* @escapeNotVerified */ echo $block->getStoreTimestamp() ?>,
5553
yearRange: '<?php /* @escapeNotVerified */ echo $block->getYearRange() ?>'
5654
}
5755
});

app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,10 @@ jQuery(window).load(function() {
306306

307307
});
308308
</script>
309+
<script type="text/x-magento-init">
310+
{
311+
"*": {
312+
"Magento_Bundle/js/bundle-type-handler": {}
313+
}
314+
}
315+
</script>

app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
namespace Magento\Catalog\Block\Adminhtml\Category\Tab;
1313

14-
class Attributes extends \Magento\Backend\Block\Widget\Form\Generic
14+
class Attributes extends \Magento\Catalog\Block\Adminhtml\Form
1515
{
1616
/**
1717
* Retrieve Category object

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
8989
$categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'sort_order', '10');
9090

9191
$groups = [
92-
'display' => ['name' => 'Display Settings', 'sort' => 20, 'id' => null],
93-
'design' => ['name' => 'Custom Design', 'sort' => 30, 'id' => null],
92+
'display' => ['name' => 'Display Settings', 'code' => 'display-settings', 'sort' => 20, 'id' => null],
93+
'design' => ['name' => 'Custom Design', 'code' => 'custom-design', 'sort' => 30, 'id' => null],
9494
];
9595

9696
foreach ($groups as $k => $groupProp) {
9797
$categorySetup->addAttributeGroup($entityTypeId, $attributeSetId, $groupProp['name'], $groupProp['sort']);
98-
$groups[$k]['id'] = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['name']);
98+
$groups[$k]['id'] = $categorySetup->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['code']);
9999
}
100100

101101
// update attributes group and sort
@@ -183,25 +183,25 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
183183
$tabNames = [
184184
'General' => [
185185
'attribute_group_name' => $newGeneralTabName,
186-
'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newGeneralTabName)),
186+
'attribute_group_code' => $categorySetup->convertToAttributeGroupCode($newGeneralTabName),
187187
'tab_group_code' => 'basic',
188188
'sort_order' => 10,
189189
],
190190
'Images' => [
191191
'attribute_group_name' => $newImagesTabName,
192-
'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newImagesTabName)),
192+
'attribute_group_code' => $categorySetup->convertToAttributeGroupCode($newImagesTabName),
193193
'tab_group_code' => 'basic',
194194
'sort_order' => 20,
195195
],
196196
'Meta Information' => [
197197
'attribute_group_name' => $newMetaTabName,
198-
'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newMetaTabName)),
198+
'attribute_group_code' => $categorySetup->convertToAttributeGroupCode($newMetaTabName),
199199
'tab_group_code' => 'basic',
200200
'sort_order' => 30,
201201
],
202202
'Prices' => [
203203
'attribute_group_name' => $newPriceTabName,
204-
'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newPriceTabName)),
204+
'attribute_group_code' => $categorySetup->convertToAttributeGroupCode($newPriceTabName),
205205
'tab_group_code' => 'advanced',
206206
'sort_order' => 40,
207207
],

app/code/Magento/Catalog/view/adminhtml/web/catalog/type-events.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ define([
1616
*/
1717
init: function () {
1818

19-
if (weight.productHasWeight()) {
19+
//not weight switcher for specific product
20+
if (weight.productHasWeightBySwitcher() && weight.hasWeightSwither()) {
2021
this.type = {
2122
virtual: 'virtual',
2223
real: this.$type.val() //simple, configurable

app/code/Magento/Catalog/view/adminhtml/web/js/product/weight-handler.js

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,85 +10,102 @@ define([
1010

1111
return {
1212

13-
$weightSwitcher: $('[data-role=weight-switcher]'),
14-
$weight: $('#weight'),
13+
/**
14+
* Get weight
15+
* @returns {*|jQuery|HTMLElement}
16+
*/
17+
$weight: function () {
18+
return $('#weight');
19+
},
1520

1621
/**
17-
* Hide weight switcher
22+
* Weight Switcher
23+
* @returns {*|jQuery|HTMLElement}
1824
*/
19-
hideWeightSwitcher: function () {
20-
this.$weightSwitcher.hide();
25+
$weightSwitcher: function () {
26+
return $('[data-role=weight-switcher]');
2127
},
2228

2329
/**
2430
* Is locked
2531
* @returns {*}
2632
*/
2733
isLocked: function () {
28-
return this.$weight.is('[data-locked]');
34+
return this.$weight().is('[data-locked]');
2935
},
3036

3137
/**
3238
* Disabled
3339
*/
3440
disabled: function () {
35-
this.$weight.addClass('ignore-validate').prop('disabled', true);
41+
this.$weight().addClass('ignore-validate').prop('disabled', true);
3642
},
3743

3844
/**
3945
* Enabled
4046
*/
4147
enabled: function () {
42-
this.$weight.removeClass('ignore-validate').prop('disabled', false);
48+
this.$weight().removeClass('ignore-validate').prop('disabled', false);
4349
},
4450

4551
/**
4652
* Switch Weight
4753
* @returns {*}
4854
*/
4955
switchWeight: function () {
50-
return this.productHasWeight() ? this.enabled() : this.disabled();
56+
return this.productHasWeightBySwitcher() ? this.enabled() : this.disabled();
5157
},
5258

5359
/**
54-
* Product has weight
55-
* @returns {Bool}
60+
* Hide weight switcher
5661
*/
57-
productHasWeight: function () {
58-
return $('input:checked', this.$weightSwitcher).val() === '1';
62+
hideWeightSwitcher: function () {
63+
this.$weightSwitcher().hide();
5964
},
6065

6166
/**
62-
* Notify product weight is changed
63-
* @returns {*|jQuery}
67+
* Has weight swither
68+
* @returns {*}
6469
*/
65-
notifyProductWeightIsChanged: function () {
66-
return $('input:checked', this.$weightSwitcher).trigger('change');
70+
hasWeightSwither: function () {
71+
return this.$weightSwitcher().is(':visible');
72+
},
73+
74+
/**
75+
* Product has weight
76+
* @returns {Bool}
77+
*/
78+
productHasWeightBySwitcher: function () {
79+
return $('input:checked', this.$weightSwitcher()).val() === '1';
6780
},
6881

6982
/**
7083
* Change
7184
* @param {String} data
7285
*/
7386
change: function (data) {
74-
var value = data !== undefined ? +data : !this.productHasWeight();
87+
var value = data !== undefined ? +data : !this.productHasWeightBySwitcher();
7588

76-
$('input[value=' + value + ']', this.$weightSwitcher).prop('checked', true);
89+
$('input[value=' + value + ']', this.$weightSwitcher()).prop('checked', true);
90+
this.switchWeight();
7791
},
7892

7993
/**
8094
* Constructor component
8195
*/
8296
'Magento_Catalog/js/product/weight-handler': function () {
8397
this.bindAll();
84-
this.switchWeight();
98+
99+
if (this.hasWeightSwither()) {
100+
this.switchWeight();
101+
}
85102
},
86103

87104
/**
88105
* Bind all
89106
*/
90107
bindAll: function () {
91-
this.$weightSwitcher.find('input').on('change', this.switchWeight.bind(this));
108+
this.$weightSwitcher().find('input').on('change', this.switchWeight.bind(this));
92109
}
93110
};
94111
});

app/code/Magento/Downloadable/view/adminhtml/web/downloadable-type-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ define([
6161
_initType: function () {
6262
if (productType.type.current === 'downloadable') {
6363
weight.change(false);
64-
weight.$weightSwitcher.one('change', function () {
64+
weight.$weightSwitcher().one('change', function () {
6565
$(document).trigger('setTypeProduct', null);
6666
});
6767
this.show();

0 commit comments

Comments
 (0)