diff --git a/app/code/Magento/Backend/App/AbstractAction.php b/app/code/Magento/Backend/App/AbstractAction.php index 99ee86b2b6407..3f658ee90bf4e 100644 --- a/app/code/Magento/Backend/App/AbstractAction.php +++ b/app/code/Magento/Backend/App/AbstractAction.php @@ -217,6 +217,7 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request) $this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false); $this->_view->renderLayout(); $this->_request->setDispatched(true); + return $this->_response; } @@ -226,6 +227,11 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request) $this->_processLocaleSettings(); + // Need to preload isFirstPageAfterLogin (see https://github.com/magento/magento2/issues/15510) + if ($this->_auth->isLoggedIn()) { + $this->_auth->getAuthStorage()->isFirstPageAfterLogin(); + } + return parent::dispatch($request); } diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 1ec23a0dd5582..d6c3273a9a67f 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -139,10 +139,16 @@ - + Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN + + + + + + Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Checkbox.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Checkbox.php index 0b3a938255de1..b220e2c98d77c 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Checkbox.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Checkbox.php @@ -17,7 +17,7 @@ class Checkbox extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Op /** * @var string */ - protected $_template = 'product/composite/fieldset/options/type/checkbox.phtml'; + protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/checkbox.phtml'; /** * @param string $elementId diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Multi.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Multi.php index 304b3a5cf34ed..a4b8c6bde73aa 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Multi.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Multi.php @@ -17,7 +17,7 @@ class Multi extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio /** * @var string */ - protected $_template = 'product/composite/fieldset/options/type/multi.phtml'; + protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/multi.phtml'; /** * @param string $elementId diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Radio.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Radio.php index e011ab36e8029..1519b3a67ac97 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Radio.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Radio.php @@ -17,7 +17,7 @@ class Radio extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio /** * @var string */ - protected $_template = 'product/composite/fieldset/options/type/radio.phtml'; + protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/radio.phtml'; /** * @param string $elementId diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Select.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Select.php index f1206db359b5c..502dfa32044a3 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Select.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Options/Type/Select.php @@ -17,7 +17,7 @@ class Select extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Opti /** * @var string */ - protected $_template = 'product/composite/fieldset/options/type/select.phtml'; + protected $_template = 'Magento_Bundle::product/composite/fieldset/options/type/select.phtml'; /** * @param string $elementId diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php index f124740a766ab..8be512a3e6348 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle.php @@ -20,7 +20,7 @@ class Bundle extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * @var string */ - protected $_template = 'product/edit/bundle.phtml'; + protected $_template = 'Magento_Bundle::product/edit/bundle.phtml'; /** * Core registry diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php index 13c5dcc81afb3..19da6bc6244e5 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php @@ -26,7 +26,7 @@ class Option extends \Magento\Backend\Block\Widget /** * @var string */ - protected $_template = 'product/edit/bundle/option.phtml'; + protected $_template = 'Magento_Bundle::product/edit/bundle/option.phtml'; /** * Core registry diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php index 5b73c22b5781a..cf4814d3cd778 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search.php @@ -15,7 +15,7 @@ class Search extends \Magento\Backend\Block\Widget /** * @var string */ - protected $_template = 'product/edit/bundle/option/search.phtml'; + protected $_template = 'Magento_Bundle::product/edit/bundle/option/search.phtml'; /** * @return void diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php index 353808dc66a72..cf88f9b93d32f 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php @@ -15,7 +15,7 @@ class Selection extends \Magento\Backend\Block\Widget /** * @var string */ - protected $_template = 'product/edit/bundle/option/selection.phtml'; + protected $_template = 'Magento_Bundle::product/edit/bundle/option/selection.phtml'; /** * Catalog data diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php index 8ca0cf8a5159e..83730d4eae2bd 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Checkbox.php @@ -16,5 +16,5 @@ class Checkbox extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Op /** * @var string */ - protected $_template = 'catalog/product/view/type/bundle/option/checkbox.phtml'; + protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/checkbox.phtml'; } diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php index 3319db8cff1d5..79e94a18a789e 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Multi.php @@ -16,7 +16,7 @@ class Multi extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio /** * @var string */ - protected $_template = 'catalog/product/view/type/bundle/option/multi.phtml'; + protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/multi.phtml'; /** * @inheritdoc diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php index 84a619dafab52..07c113bd8e4bb 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Radio.php @@ -16,5 +16,5 @@ class Radio extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Optio /** * @var string */ - protected $_template = 'catalog/product/view/type/bundle/option/radio.phtml'; + protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/radio.phtml'; } diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php index d7f1cf41057a8..63f0d35bda0f0 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option/Select.php @@ -16,5 +16,5 @@ class Select extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Opti /** * @var string */ - protected $_template = 'catalog/product/view/type/bundle/option/select.phtml'; + protected $_template = 'Magento_Bundle::catalog/product/view/type/bundle/option/select.phtml'; } diff --git a/app/code/Magento/Captcha/i18n/en_US.csv b/app/code/Magento/Captcha/i18n/en_US.csv index 3c56d3f0d393d..480107df8adfe 100644 --- a/app/code/Magento/Captcha/i18n/en_US.csv +++ b/app/code/Magento/Captcha/i18n/en_US.csv @@ -20,11 +20,7 @@ Forms,Forms "Number of Symbols","Number of Symbols" "Please specify 8 symbols at the most. Range allowed (e.g. 3-5)","Please specify 8 symbols at the most. Range allowed (e.g. 3-5)" "Symbols Used in CAPTCHA","Symbols Used in CAPTCHA" -" - Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer. - "," - Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer. - " +"Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer.","Please use only letters (a-z or A-Z) or numbers (0-9) in this field. No spaces or other characters are allowed.
Similar looking characters (e.g. ""i"", ""l"", ""1"") decrease chance of correct recognition by customer." "Case Sensitive","Case Sensitive" "Enable CAPTCHA on Storefront","Enable CAPTCHA on Storefront" "CAPTCHA for ""Create user"" and ""Forgot password"" forms is always enabled if chosen.","CAPTCHA for ""Create user"" and ""Forgot password"" forms is always enabled if chosen." diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 33ff3ecccd4dd..9ad0db444eed0 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -251,7 +251,7 @@ public function getChildrenIds($parentId, $required = true) } /** - * Retrieve parent ids array by requered child + * Retrieve parent ids array by required child * * @param int|array $childId * @return array diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml index 6a2dd1f27d4a9..f1d4b32031e49 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml @@ -10,7 +10,7 @@ ?> getItems()->getSize() ?> - +
@@ -29,7 +29,7 @@ - + helper('Magento\Catalog\Helper\Product\Compare');?> @@ -59,7 +59,7 @@ getReviewsSummaryHtml($_item, 'short') ?> getProductPrice($_item, '-compare-list-top') ?> -
+
isSaleable()): ?>
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js index dab40f026645d..debb1acf90d4f 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js @@ -9,11 +9,12 @@ define([ 'Magento_Customer/js/customer-data', 'Magento_Ui/js/modal/alert', 'Magento_Ui/js/modal/confirm', + 'underscore', 'jquery/ui', 'mage/decorate', 'mage/collapsible', 'mage/cookies' -], function ($, authenticationPopup, customerData, alert, confirm) { +], function ($, authenticationPopup, customerData, alert, confirm, _) { 'use strict'; $.widget('mage.sidebar', { @@ -219,6 +220,11 @@ define([ * @param {HTMLElement} elem */ _updateItemQtyAfter: function (elem) { + var productData = this._getProductById(Number(elem.data('cart-item'))); + + if (!_.isUndefined(productData)) { + $(document).trigger('ajax:updateCartItemQty', productData['product_sku']); + } this._hideItemButton(elem); }, @@ -241,11 +247,24 @@ define([ * @private */ _removeItemAfter: function (elem) { - var productData = customerData.get('cart')().items.find(function (item) { - return Number(elem.data('cart-item')) === Number(item['item_id']); - }); + var productData = this._getProductById(Number(elem.data('cart-item'))); + + if (!_.isUndefined(productData)) { + $(document).trigger('ajax:removeFromCart', productData['product_sku']); + } + }, - $(document).trigger('ajax:removeFromCart', productData['product_sku']); + /** + * Retrieves product data by Id. + * + * @param {Number} productId - product Id + * @returns {Object|undefined} + * @private + */ + _getProductById: function (productId) { + return _.find(customerData.get('cart')().items, function (item) { + return productId === Number(item['item_id']); + }); }, /** diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js b/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js index 9af5201c267e8..0e2fc6bbfc8fe 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/configure/product-customer-data.js @@ -1,8 +1,9 @@ require([ 'jquery', 'Magento_Customer/js/customer-data', + 'underscore', 'domReady!' -], function ($, customerData) { +], function ($, customerData, _) { 'use strict'; var selectors = { @@ -41,7 +42,7 @@ require([ if (!(data && data.items && data.items.length && productId)) { return; } - product = data.items.find(function (item) { + product = _.find(data.items, function (item) { if (item['item_id'] === itemId) { return item['product_id'] === productId || item['item_id'] === productId; diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html index 1be754934042b..3e9170186ebfa 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html @@ -9,7 +9,9 @@ -
+
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html index 8bf1a87d34e6e..2daca51a2f5da 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html @@ -30,8 +30,12 @@ - - + + + + + +
diff --git a/app/code/Magento/Config/Block/System/Config/Form.php b/app/code/Magento/Config/Block/System/Config/Form.php index c17df229cf549..81e39a83296d7 100644 --- a/app/code/Magento/Config/Block/System/Config/Form.php +++ b/app/code/Magento/Config/Block/System/Config/Form.php @@ -709,7 +709,7 @@ protected function _getAdditionalElementTypes() } /** - * Temporary moved those $this->getRequest()->getParam('blabla') from the code accross this block + * Temporary moved those $this->getRequest()->getParam('blabla') from the code across this block * to getBlala() methods to be later set from controller with setters */ diff --git a/app/code/Magento/Config/Model/Config/Structure/ConcealInProductionConfigList.php b/app/code/Magento/Config/Model/Config/Structure/ConcealInProductionConfigList.php index 115a372e6150a..c60d634210339 100644 --- a/app/code/Magento/Config/Model/Config/Structure/ConcealInProductionConfigList.php +++ b/app/code/Magento/Config/Model/Config/Structure/ConcealInProductionConfigList.php @@ -11,7 +11,8 @@ * Defines status of visibility of form elements on Stores > Settings > Configuration page * in Admin Panel in Production mode. * @api - * @since 100.2.0 + * @deprecated class location was changed + * @see \Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction */ class ConcealInProductionConfigList implements ElementVisibilityInterface { @@ -54,7 +55,7 @@ public function __construct(State $state, array $configs = []) /** * @inheritdoc - * @since 100.2.0 + * @deprecated */ public function isHidden($path) { @@ -66,7 +67,7 @@ public function isHidden($path) /** * @inheritdoc - * @since 100.2.0 + * @deprecated */ public function isDisabled($path) { diff --git a/app/code/Magento/Config/Model/Config/Structure/ElementVisibility/ConcealInProduction.php b/app/code/Magento/Config/Model/Config/Structure/ElementVisibility/ConcealInProduction.php new file mode 100755 index 0000000000000..d5ded9292864a --- /dev/null +++ b/app/code/Magento/Config/Model/Config/Structure/ElementVisibility/ConcealInProduction.php @@ -0,0 +1,138 @@ + Settings > Configuration page + * in Admin Panel in Production mode. + * @api + */ +class ConcealInProduction implements ElementVisibilityInterface +{ + /** + * The list of form element paths with concrete visibility status. + * + * E.g. + * + * ```php + * [ + * 'general/locale/code' => ElementVisibilityInterface::DISABLED, + * 'general/country' => ElementVisibilityInterface::HIDDEN, + * ]; + * ``` + * + * It means that: + * - field Locale (in group Locale Options in section General) will be disabled + * - group Country Options (in section General) will be hidden + * + * @var array + */ + private $configs = []; + + /** + * The object that has information about the state of the system. + * + * @var State + */ + private $state; + + /** + * + * The list of form element paths which ignore visibility status. + * + * E.g. + * + * ```php + * [ + * 'general/country/default' => '', + * ]; + * ``` + * + * It means that: + * - field 'default' in group Country Options (in section General) will be showed, even if all group(section) + * will be hidden. + * + * @var array + */ + private $exemptions = []; + + /** + * @param State $state The object that has information about the state of the system + * @param array $configs The list of form element paths with concrete visibility status. + * @param array $exemptions The list of form element paths which ignore visibility status. + */ + public function __construct(State $state, array $configs = [], array $exemptions = []) + { + $this->state = $state; + $this->configs = $configs; + $this->exemptions = $exemptions; + } + + /** + * @inheritdoc + * @since 100.2.0 + */ + public function isHidden($path) + { + $path = $this->normalizePath($path); + if ($this->state->getMode() === State::MODE_PRODUCTION + && preg_match('/(?(?
.*?)\/.*?)\/.*?/', $path, $match)) { + $group = $match['group']; + $section = $match['section']; + $exemptions = array_keys($this->exemptions); + $checkedItems = []; + foreach ([$path, $group, $section] as $itemPath) { + $checkedItems[] = $itemPath; + if (!empty($this->configs[$itemPath])) { + return $this->configs[$itemPath] === static::HIDDEN + && empty(array_intersect($checkedItems, $exemptions)); + } + } + } + + return false; + } + + /** + * @inheritdoc + * @since 100.2.0 + */ + public function isDisabled($path) + { + $path = $this->normalizePath($path); + if ($this->state->getMode() === State::MODE_PRODUCTION) { + while (true) { + if (!empty($this->configs[$path])) { + return $this->configs[$path] === static::DISABLED; + } + + $position = strripos($path, '/'); + if ($position === false) { + break; + } + $path = substr($path, 0, $position); + } + } + + return false; + } + + /** + * Returns normalized path. + * + * @param string $path The path to be normalized + * @return string The normalized path + */ + private function normalizePath($path) + { + return trim($path, '/'); + } +} diff --git a/app/code/Magento/Config/Model/Config/Structure/ElementVisibility/ConcealInProductionWithoutScdOnDemand.php b/app/code/Magento/Config/Model/Config/Structure/ElementVisibility/ConcealInProductionWithoutScdOnDemand.php new file mode 100755 index 0000000000000..29148a244dcc6 --- /dev/null +++ b/app/code/Magento/Config/Model/Config/Structure/ElementVisibility/ConcealInProductionWithoutScdOnDemand.php @@ -0,0 +1,72 @@ + Settings > Configuration page + * when Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION is enabled + * otherwise rule from Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction is used + * @see \Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction + * + * @api + */ +class ConcealInProductionWithoutScdOnDemand implements ElementVisibilityInterface +{ + /** + * @var ConcealInProduction Element visibility rules in the Production mode + */ + private $concealInProduction; + + /** + * @var DeploymentConfig The application deployment configuration + */ + private $deploymentConfig; + + /** + * @param ConcealInProductionFactory $concealInProductionFactory + * @param DeploymentConfig $deploymentConfig Deployment configuration reader + * @param array $configs The list of form element paths with concrete visibility status. + * @param array $exemptions The list of form element paths which ignore visibility status. + */ + public function __construct( + ConcealInProductionFactory $concealInProductionFactory, + DeploymentConfig $deploymentConfig, + array $configs = [], + array $exemptions = [] + ) { + $this->concealInProduction = $concealInProductionFactory + ->create(['configs' => $configs, 'exemptions' => $exemptions]); + $this->deploymentConfig = $deploymentConfig; + } + + /** + * @inheritdoc + */ + public function isHidden($path): bool + { + if (!$this->deploymentConfig->getConfigData(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)) { + return $this->concealInProduction->isHidden($path); + } + return false; + } + + /** + * @inheritdoc + */ + public function isDisabled($path): bool + { + if (!$this->deploymentConfig->getConfigData(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)) { + return $this->concealInProduction->isDisabled($path); + } + return false; + } +} diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ConcealInProductionConfigListTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ConcealInProductionConfigListTest.php index 5cad923264e00..ba74b93d9ad76 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ConcealInProductionConfigListTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ConcealInProductionConfigListTest.php @@ -8,6 +8,11 @@ use Magento\Config\Model\Config\Structure\ConcealInProductionConfigList; use Magento\Framework\App\State; +/** + * @deprecated Original class has changed the location + * @see \Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction + * @see \Magento\Config\Test\Unit\Model\Config\Structure\ElementVisibility\ConcealInProductionTest + */ class ConcealInProductionConfigListTest extends \PHPUnit\Framework\TestCase { /** @@ -43,6 +48,8 @@ protected function setUp() * @param string $mageMode * @param bool $expectedResult * @dataProvider disabledDataProvider + * + * @deprecated */ public function testIsDisabled($path, $mageMode, $expectedResult) { @@ -54,6 +61,8 @@ public function testIsDisabled($path, $mageMode, $expectedResult) /** * @return array + * + * @deprecated */ public function disabledDataProvider() { @@ -78,6 +87,8 @@ public function disabledDataProvider() * @param string $mageMode * @param bool $expectedResult * @dataProvider hiddenDataProvider + * + * @deprecated */ public function testIsHidden($path, $mageMode, $expectedResult) { @@ -89,6 +100,8 @@ public function testIsHidden($path, $mageMode, $expectedResult) /** * @return array + * + * @deprecated */ public function hiddenDataProvider() { diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibility/ConcealInProductionTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibility/ConcealInProductionTest.php new file mode 100644 index 0000000000000..873d447d9868c --- /dev/null +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibility/ConcealInProductionTest.php @@ -0,0 +1,107 @@ +stateMock = $this->getMockBuilder(State::class) + ->disableOriginalConstructor() + ->getMock(); + + $configs = [ + 'section1/group1/field1' => ElementVisibilityInterface::DISABLED, + 'section1/group1' => ElementVisibilityInterface::HIDDEN, + 'section1' => ElementVisibilityInterface::DISABLED, + 'section1/group2' => 'no', + 'section2/group1' => ElementVisibilityInterface::DISABLED, + 'section2/group2' => ElementVisibilityInterface::HIDDEN, + 'section3' => ElementVisibilityInterface::HIDDEN, + 'section3/group1/field1' => 'no', + ]; + $exemptions = [ + 'section1/group1/field3' => '', + 'section1/group2/field1' => '', + 'section2/group2/field1' => '', + 'section3/group2' => '', + ]; + + $this->model = new ConcealInProduction($this->stateMock, $configs, $exemptions); + } + + /** + * @param string $path + * @param string $mageMode + * @param bool $isDisabled + * @param bool $isHidden + * @dataProvider disabledDataProvider + * @return void + */ + public function testCheckVisibility(string $path, string $mageMode, bool $isHidden, bool $isDisabled) + { + $this->stateMock->expects($this->any()) + ->method('getMode') + ->willReturn($mageMode); + + $this->assertSame($isHidden, $this->model->isHidden($path)); + $this->assertSame($isDisabled, $this->model->isDisabled($path)); + } + + /** + * @return array + */ + public function disabledDataProvider(): array + { + return [ + //visibility of field 'section1/group1/field1' should be applied + ['section1/group1/field1', State::MODE_PRODUCTION, false, true], + ['section1/group1/field1', State::MODE_DEFAULT, false, false], + ['section1/group1/field1', State::MODE_DEVELOPER, false, false], + //visibility of group 'section1/group1' should be applied + ['section1/group1/field2', State::MODE_PRODUCTION, true, false], + ['section1/group1/field2', State::MODE_DEFAULT, false, false], + ['section1/group1/field2', State::MODE_DEVELOPER, false, false], + //exemption should be applied for section1/group2/field1 + ['section1/group2/field1', State::MODE_PRODUCTION, false, false], + ['section1/group2/field1', State::MODE_DEFAULT, false, false], + ['section1/group2/field1', State::MODE_DEVELOPER, false, false], + //as 'section1/group2' has neither Disable nor Hidden rule, this field should be visible + ['section1/group2/field2', State::MODE_PRODUCTION, false, false], + //exemption should be applied for section1/group1/field3 + ['section1/group1/field3', State::MODE_PRODUCTION, false, false], + //visibility of group 'section2/group1' should be applied + ['section2/group1/field1', State::MODE_PRODUCTION, false, true], + //exemption should be applied for section2/group2/field1 + ['section2/group2/field1', State::MODE_PRODUCTION, false, false], + //any rule should not be applied + ['section2/group3/field1', State::MODE_PRODUCTION, false, false], + //any rule should not be applied + ['section3/group1/field1', State::MODE_PRODUCTION, false, false], + //visibility of section 'section3' should be applied + ['section3/group1/field2', State::MODE_PRODUCTION, true, false], + //exception from 'section3/group2' should be applied + ['section3/group2/field1', State::MODE_PRODUCTION, false, false], + + ]; + } +} diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibility/ConcealInProductionWithoutScdOnDemandTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibility/ConcealInProductionWithoutScdOnDemandTest.php new file mode 100644 index 0000000000000..ae213c19a5337 --- /dev/null +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/ElementVisibility/ConcealInProductionWithoutScdOnDemandTest.php @@ -0,0 +1,156 @@ +createMock(ConcealInProductionFactory::class); + + $this->concealInProductionMock = $this->createMock(ConcealInProduction::class); + + $this->deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); + + $configs = [ + 'section1/group1/field1' => ElementVisibilityInterface::DISABLED, + 'section1/group1' => ElementVisibilityInterface::HIDDEN, + 'section1' => ElementVisibilityInterface::DISABLED, + 'section1/group2' => 'no', + 'section2/group1' => ElementVisibilityInterface::DISABLED, + 'section2/group2' => ElementVisibilityInterface::HIDDEN, + 'section3' => ElementVisibilityInterface::HIDDEN, + 'section3/group1/field1' => 'no', + ]; + $exemptions = [ + 'section1/group1/field3' => '', + 'section1/group2/field1' => '', + 'section2/group2/field1' => '', + 'section3/group2' => '', + ]; + + $concealInProductionFactoryMock->expects($this->any()) + ->method('create') + ->with(['configs' => $configs, 'exemptions' => $exemptions]) + ->willReturn($this->concealInProductionMock); + + $this->model = new ConcealInProductionWithoutScdOnDemand( + $concealInProductionFactoryMock, + $this->deploymentConfigMock, + $configs, + $exemptions + ); + } + + /** + * @return void + */ + public function testIsHiddenScdOnDemandEnabled() + { + $path = 'section1/group1/field1'; + $this->deploymentConfigMock->expects($this->once()) + ->method('getConfigData') + ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION) + ->willReturn(true); + $this->concealInProductionMock->expects($this->never()) + ->method('isHidden'); + + $this->assertFalse($this->model->isHidden($path)); + } + + /** + * @return void + */ + public function testIsDisabledScdOnDemandEnabled() + { + $path = 'section1/group1/field1'; + $this->deploymentConfigMock->expects($this->once()) + ->method('getConfigData') + ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION) + ->willReturn(true); + $this->concealInProductionMock->expects($this->never()) + ->method('isDisabled'); + + $this->assertFalse($this->model->isDisabled($path)); + } + + /** + * @param bool $isHidden + * + * @dataProvider visibilityDataProvider + * @return void + */ + public function testIsHiddenScdOnDemandDisabled(bool $isHidden) + { + $path = 'section1/group1/field1'; + $this->deploymentConfigMock->expects($this->once()) + ->method('getConfigData') + ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION) + ->willReturn(false); + $this->concealInProductionMock->expects($this->once()) + ->method('isHidden') + ->with($path) + ->willReturn($isHidden); + + $this->assertSame($isHidden, $this->model->isHidden($path)); + } + + /** + * @param bool $isDisabled + * + * @dataProvider visibilityDataProvider + * @return void + */ + public function testIsDisabledScdOnDemandDisabled(bool $isDisabled) + { + $path = 'section1/group1/field1'; + $this->deploymentConfigMock->expects($this->once()) + ->method('getConfigData') + ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION) + ->willReturn(false); + $this->concealInProductionMock->expects($this->once()) + ->method('isDisabled') + ->with($path) + ->willReturn($isDisabled); + + $this->assertSame($isDisabled, $this->model->isDisabled($path)); + } + + /** + * @return array + */ + public function visibilityDataProvider(): array + { + return [ + [true], + [false], + ]; + } +} diff --git a/app/code/Magento/Config/etc/adminhtml/di.xml b/app/code/Magento/Config/etc/adminhtml/di.xml index c21c06c7f3e1f..5e54f177776ba 100644 --- a/app/code/Magento/Config/etc/adminhtml/di.xml +++ b/app/code/Magento/Config/etc/adminhtml/di.xml @@ -15,6 +15,8 @@ Magento\Config\Model\Config\Structure\ConcealInProductionConfigList + Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProduction + Magento\Config\Model\Config\Structure\ElementVisibility\ConcealInProductionWithoutScdOnDemand diff --git a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php index 245ea1978dc7b..6af7a44accda8 100644 --- a/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php @@ -637,7 +637,7 @@ protected function _insertData() } /** - * Get new supper attribute id. + * Get new super attribute id. * * @return int */ diff --git a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php index d1e4db41cd209..63eec3bb698bb 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php @@ -68,7 +68,11 @@ public function getProductForThumbnail() self::CONFIG_THUMBNAIL_SOURCE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) == ThumbnailSource::OPTION_USE_PARENT_IMAGE || - !($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection') + !( + $this->getChildProduct() && + $this->getChildProduct()->getThumbnail() && + $this->getChildProduct()->getThumbnail() != 'no_selection' + ) ) { $product = $this->getProduct(); } else { diff --git a/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php b/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php index 3a9ed653305c5..67e51b3797540 100644 --- a/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php +++ b/app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php @@ -63,7 +63,11 @@ protected function getProductForThumbnail() ); $product = $config == ThumbnailSource::OPTION_USE_PARENT_IMAGE - || (!$this->getChildProduct()->getThumbnail() || $this->getChildProduct()->getThumbnail() == 'no_selection') + || ( + !$this->getChildProduct() || + !$this->getChildProduct()->getThumbnail() || + $this->getChildProduct()->getThumbnail() == 'no_selection' + ) ? $this->getProduct() : $this->getChildProduct(); diff --git a/app/code/Magento/Customer/Model/Metadata/AttributeMetadataHydrator.php b/app/code/Magento/Customer/Model/Metadata/AttributeMetadataHydrator.php index 190a3a38e0bf0..f61f064e3f97e 100644 --- a/app/code/Magento/Customer/Model/Metadata/AttributeMetadataHydrator.php +++ b/app/code/Magento/Customer/Model/Metadata/AttributeMetadataHydrator.php @@ -11,6 +11,7 @@ use Magento\Customer\Api\Data\OptionInterfaceFactory; use Magento\Customer\Api\Data\ValidationRuleInterface; use Magento\Customer\Api\Data\ValidationRuleInterfaceFactory; +use Magento\Customer\Model\Data\AttributeMetadata; use Magento\Framework\Reflection\DataObjectProcessor; /** @@ -120,7 +121,7 @@ public function extract($attributeMetadata) { return $this->dataObjectProcessor->buildOutputDataArray( $attributeMetadata, - AttributeMetadataInterface::class + AttributeMetadata::class ); } } diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 71b0297fdd114..680e68b5c4c0f 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -555,7 +555,7 @@ public function setAfterAuthUrl($url) } /** - * Reset core session hosts after reseting session ID + * Reset core session hosts after resetting session ID * * @return $this */ diff --git a/app/code/Magento/Customer/Test/Unit/Model/Metadata/AttributeMetadataHydratorTest.php b/app/code/Magento/Customer/Test/Unit/Model/Metadata/AttributeMetadataHydratorTest.php index ec9831dde081e..248cae999065c 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Metadata/AttributeMetadataHydratorTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Metadata/AttributeMetadataHydratorTest.php @@ -205,7 +205,7 @@ public function testExtract() ->method('buildOutputDataArray') ->with( $this->attributeMetadataMock, - AttributeMetadataInterface::class + AttributeMetadata::class ) ->willReturn($data); $this->assertSame( diff --git a/app/code/Magento/Customer/view/frontend/templates/form/login.phtml b/app/code/Magento/Customer/view/frontend/templates/form/login.phtml index 16206525aa53b..77e250c5de923 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/login.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/login.phtml @@ -42,3 +42,13 @@
+ + diff --git a/app/code/Magento/Customer/view/frontend/templates/logout.phtml b/app/code/Magento/Customer/view/frontend/templates/logout.phtml index 43665045ce3e2..5a99b7d931b9b 100644 --- a/app/code/Magento/Customer/view/frontend/templates/logout.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/logout.phtml @@ -7,13 +7,12 @@ /** @var \Magento\Framework\View\Element\Template $block */ ?>

escapeHtml(__('You have signed out and will go to our homepage in 5 seconds.')) ?>

- diff --git a/app/code/Magento/Customer/view/frontend/web/js/logout-redirect.js b/app/code/Magento/Customer/view/frontend/web/js/logout-redirect.js new file mode 100644 index 0000000000000..6792626df6a08 --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/web/js/logout-redirect.js @@ -0,0 +1,15 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'mage/mage' +], function ($) { + 'use strict'; + + return function (data) { + $($.mage.redirect(data.url, 'assign', 5000)); + }; +}); diff --git a/app/code/Magento/Customer/view/frontend/web/js/trim-username.js b/app/code/Magento/Customer/view/frontend/web/js/trim-username.js new file mode 100644 index 0000000000000..69f89cb8fe01f --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/web/js/trim-username.js @@ -0,0 +1,65 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery' +], function ($) { + 'use strict'; + + $.widget('mage.trimUsername', { + options: { + cache: {}, + formSelector: 'form', + emailSelector: 'input[type="email"]' + }, + + /** + * Widget initialization + * @private + */ + _create: function () { + // We need to look outside the module for backward compatibility, since someone can already use the module. + // @todo Narrow this selector in 2.3 so it doesn't accidentally finds the the email field from the + // newsletter email field or any other "email" field. + this.options.cache.email = $(this.options.formSelector).find(this.options.emailSelector); + this._bind(); + }, + + /** + * Event binding, will monitor change, keyup and paste events. + * @private + */ + _bind: function () { + if (this.options.cache.email.length) { + this._on(this.options.cache.email, { + 'change': this._trimUsername, + 'keyup': this._trimUsername, + 'paste': this._trimUsername + }); + } + }, + + /** + * Trim username + * @private + */ + _trimUsername: function () { + var username = this._getUsername().trim(); + + this.options.cache.email.val(username); + }, + + /** + * Get username value + * @returns {*} + * @private + */ + _getUsername: function () { + return this.options.cache.email.val(); + } + }); + + return $.mage.trimUsername; +}); diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php index cdd4fce583230..13c0b7a627edb 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php @@ -165,7 +165,7 @@ public function getValue(\Magento\Framework\DataObject $object) $options = $opt->getAllOptions(); if ($options) { foreach ($options as $option) { - if ($option['value'] == $value) { + if ($option['value'] === $value) { $valueOption = $option['label']; } } diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 0ebb0d8f703b6..e88cae4ea7155 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -9,8 +9,10 @@ namespace Magento\Fedex\Model; use Magento\Framework\App\ObjectManager; +use Magento\Framework\DataObject; use Magento\Framework\Module\Dir; use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Webapi\Soap\ClientFactory; use Magento\Framework\Xml\Security; use Magento\Quote\Model\Quote\Address\RateRequest; use Magento\Shipping\Model\Carrier\AbstractCarrierOnline; @@ -19,7 +21,6 @@ /** * Fedex shipping implementation * - * @author Magento Core Team * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -145,6 +146,11 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C */ private $serializer; + /** + * @var ClientFactory + */ + private $soapClientFactory; + /** * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory @@ -166,7 +172,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory * @param array $data * @param Json|null $serializer - * + * @param ClientFactory|null $soapClientFactory * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -189,7 +195,8 @@ public function __construct( \Magento\Framework\Module\Dir\Reader $configReader, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory, array $data = [], - Json $serializer = null + Json $serializer = null, + ClientFactory $soapClientFactory = null ) { $this->_storeManager = $storeManager; $this->_productCollectionFactory = $productCollectionFactory; @@ -216,6 +223,7 @@ public function __construct( $this->_rateServiceWsdl = $wsdlBasePath . 'RateService_v10.wsdl'; $this->_trackServiceWsdl = $wsdlBasePath . 'TrackService_v' . self::$trackServiceVersion . '.wsdl'; $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class); + $this->soapClientFactory = $soapClientFactory ?: ObjectManager::getInstance()->get(ClientFactory::class); } /** @@ -227,7 +235,7 @@ public function __construct( */ protected function _createSoapClient($wsdl, $trace = false) { - $client = new \SoapClient($wsdl, ['trace' => $trace]); + $client = $this->soapClientFactory->create($wsdl, ['trace' => $trace]); $client->__setLocation( $this->getConfigFlag( 'sandbox_mode' @@ -1264,7 +1272,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request) $countriesOfManufacture[] = $product->getCountryOfManufacture(); } - $paymentType = $request->getIsReturn() ? 'RECIPIENT' : 'SENDER'; + $paymentType = $this->getPaymentType($request); $optionType = $request->getShippingMethod() == self::RATE_REQUEST_SMARTPOST ? 'SERVICE_DEFAULT' : $packageParams->getDeliveryConfirmation(); $requestClient = [ @@ -1750,4 +1758,18 @@ private function parseDate($timestamp) return false; } + + /** + * Defines payment type by request. + * Two values are available: RECIPIENT or SENDER. + * + * @param DataObject $request + * @return string + */ + private function getPaymentType(DataObject $request): string + { + return $request->getIsReturn() && $request->getShippingMethod() !== self::RATE_REQUEST_SMARTPOST + ? 'RECIPIENT' + : 'SENDER'; + } } diff --git a/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-form.html b/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-form.html index 20739f621ecff..15a36cc0e977a 100644 --- a/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-form.html +++ b/app/code/Magento/GiftMessage/view/frontend/web/template/gift-message-form.html @@ -12,26 +12,24 @@
-
-
@@ -46,7 +44,6 @@
-
diff --git a/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js b/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js index cd6292b39e989..60a131ae746de 100644 --- a/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js +++ b/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js @@ -53,7 +53,7 @@ define([ } // Process orders data - if (config.ordersTrackingData.length) { + if (config.ordersTrackingData.hasOwnProperty('currency')) { ga('require', 'ec', 'ec.js'); //Set currency code diff --git a/app/code/Magento/Integration/Setup/UpgradeSchema.php b/app/code/Magento/Integration/Setup/UpgradeSchema.php index 6173a359329b0..21aea4e4122c9 100644 --- a/app/code/Magento/Integration/Setup/UpgradeSchema.php +++ b/app/code/Magento/Integration/Setup/UpgradeSchema.php @@ -71,6 +71,16 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->getConnection()->createTable($table); } + if (version_compare($context->getVersion(), '2.2.1', '<')) { + $connection = $setup->getConnection(); + + $connection->addIndex( + $setup->getTable('oauth_nonce'), + $setup->getIdxName('oauth_nonce', ['timestamp']), + ['timestamp'] + ); + } + $setup->endSetup(); } } diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index c5e2aa75a8d05..d62b00ae8e3f3 100644 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/Marketplace/view/adminhtml/templates/partners.phtml b/app/code/Magento/Marketplace/view/adminhtml/templates/partners.phtml index 309df6f883a49..b63bf9ebd50eb 100644 --- a/app/code/Magento/Marketplace/view/adminhtml/templates/partners.phtml +++ b/app/code/Magento/Marketplace/view/adminhtml/templates/partners.phtml @@ -11,7 +11,7 @@ $partners = $block->getPartners(); ?> - getPartners() as $partner) : ?> +
*/ diff --git a/app/code/Magento/Multishipping/Block/Checkout/Overview.php b/app/code/Magento/Multishipping/Block/Checkout/Overview.php index 2197598489358..5963e62e948f9 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Overview.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Overview.php @@ -319,9 +319,19 @@ public function getQuote() } /** + * @deprecated + * typo in method name, see getBillingAddressTotals() * @return mixed */ public function getBillinAddressTotals() + { + return $this->getBillingAddressTotals(); + } + + /** + * @return mixed + */ + public function getBillingAddressTotals() { $address = $this->getQuote()->getBillingAddress(); return $this->getShippingAddressTotals($address); diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index ef1aa6301b23d..77981c736b9e9 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -9,7 +9,7 @@ use Magento\Quote\Model\Quote\Address; /** - * Multishipping checkout shipping + * Mustishipping checkout shipping * * @api * @author Magento Core Team diff --git a/app/code/Magento/Multishipping/Test/Unit/Block/Checkout/SuccessTest.php b/app/code/Magento/Multishipping/Test/Unit/Block/Checkout/SuccessTest.php index 403e6cfcb48dc..2083703b15e3b 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Block/Checkout/SuccessTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Block/Checkout/SuccessTest.php @@ -71,7 +71,7 @@ public function testGetOrderIdsWithEmptyIdsArray() public function testGetOrderIds() { $ids = [100, 102, 103]; - $this->sessionMock->method('getOrderIds')->willReturn($ids);; + $this->sessionMock->method('getOrderIds')->willReturn($ids); $this->assertEquals($ids, $this->model->getOrderIds()); } diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml index d4d446a7567db..4590b7c584085 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml @@ -186,7 +186,7 @@ - renderTotals($block->getBillinAddressTotals()); ?> + renderTotals($block->getBillingAddressTotals()); ?>
diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index 87d4b984cf933..b67eb1b45fe45 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -128,8 +128,10 @@ public function collectRates(RateRequest $request) $freeQty += $item->getQty() * ($child->getQty() - $freeShipping); } } - } elseif ($item->getFreeShipping()) { - $freeShipping = is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0; + } elseif ($item->getFreeShipping() || $item->getAddress()->getFreeShipping()) { + $freeShipping = $item->getFreeShipping() ? + $item->getFreeShipping() : $item->getAddress()->getFreeShipping(); + $freeShipping = is_numeric($freeShipping) ? $freeShipping : 0; $freeQty += $item->getQty() - $freeShipping; $freePackageValue += $item->getBaseRowTotal(); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php index f3647ca1bd5f6..d01566285954a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php @@ -134,7 +134,15 @@ protected function _prepareForm() $this->_addAttributesToForm($attributes, $fieldset); $this->_form->addFieldNameSuffix('order[account]'); - $this->_form->setValues($this->getFormValues()); + + $formValues = $this->getFormValues(); + foreach ($attributes as $code => $attribute) { + $defaultValue = $attribute->getDefaultValue(); + if (isset($defaultValue) && !isset($formValues[$code])) { + $formValues[$code] = $defaultValue; + } + } + $this->_form->setValues($formValues); return $this; } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php index 1f0ee8304629a..19139350b509d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php @@ -71,7 +71,7 @@ public function canDisplay() } /** - * Retrieve disply item qty availablity + * Retrieve display item qty availability * * @return false */ diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/LoadBlock.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/LoadBlock.php index 6a9d0a5dcb8ed..bc4eb3cfba423 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/LoadBlock.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/LoadBlock.php @@ -55,10 +55,10 @@ public function execute() $this->_initSession()->_processData(); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->_reloadQuote(); - $this->messageManager->addError($e->getMessage()); + $this->messageManager->addErrorMessage($e->getMessage()); } catch (\Exception $e) { $this->_reloadQuote(); - $this->messageManager->addException($e, $e->getMessage()); + $this->messageManager->addExceptionMessage($e, $e->getMessage()); } $asJson = $request->getParam('json'); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Save.php index 621705c7937cb..2d22c3343c2e7 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Save.php @@ -3,8 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Sales\Controller\Adminhtml\Order\Create; +use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Exception\PaymentException; class Save extends \Magento\Sales\Controller\Adminhtml\Order\Create @@ -12,14 +14,15 @@ class Save extends \Magento\Sales\Controller\Adminhtml\Order\Create /** * Saving quote and create order * - * @return \Magento\Backend\Model\View\Result\Forward|\Magento\Backend\Model\View\Result\Redirect + * @return \Magento\Framework\Controller\ResultInterface * * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function execute() { - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); + $path = 'sales/*/'; + $pathParams = []; + try { // check if the creation of a new customer is allowed if (!$this->_authorization->isAllowed('Magento_Customer::manage') @@ -49,31 +52,30 @@ public function execute() ->createOrder(); $this->_getSession()->clearStorage(); - $this->messageManager->addSuccess(__('You created the order.')); + $this->messageManager->addSuccessMessage(__('You created the order.')); if ($this->_authorization->isAllowed('Magento_Sales::actions_view')) { - $resultRedirect->setPath('sales/order/view', ['order_id' => $order->getId()]); + $pathParams = ['order_id' => $order->getId()]; + $path = 'sales/order/view'; } else { - $resultRedirect->setPath('sales/order/index'); + $path = 'sales/order/index'; } } catch (PaymentException $e) { $this->_getOrderCreateModel()->saveQuote(); $message = $e->getMessage(); if (!empty($message)) { - $this->messageManager->addError($message); + $this->messageManager->addErrorMessage($message); } - $resultRedirect->setPath('sales/*/'); } catch (\Magento\Framework\Exception\LocalizedException $e) { // customer can be created before place order flow is completed and should be stored in current session - $this->_getSession()->setCustomerId($this->_getSession()->getQuote()->getCustomerId()); + $this->_getSession()->setCustomerId((int)$this->_getSession()->getQuote()->getCustomerId()); $message = $e->getMessage(); if (!empty($message)) { - $this->messageManager->addError($message); + $this->messageManager->addErrorMessage($message); } - $resultRedirect->setPath('sales/*/'); } catch (\Exception $e) { - $this->messageManager->addException($e, __('Order saving error: %1', $e->getMessage())); - $resultRedirect->setPath('sales/*/'); + $this->messageManager->addExceptionMessage($e, __('Order saving error: %1', $e->getMessage())); } - return $resultRedirect; + + return $this->resultRedirectFactory->create()->setPath($path, $pathParams); } } diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 22ef39aa30247..1348c816b46e6 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -1948,21 +1948,17 @@ public function createOrder() */ protected function _validate() { - $customerId = $this->getSession()->getCustomerId(); - if ($customerId === null) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please select a customer')); - } - if (!$this->getSession()->getStore()->getId()) { throw new \Magento\Framework\Exception\LocalizedException(__('Please select a store')); } $items = $this->getQuote()->getAllItems(); - if (count($items) == 0) { + if (count($items) === 0) { $this->_errors[] = __('Please specify order items.'); } foreach ($items as $item) { + /** @var \Magento\Quote\Model\Quote\Item $item */ $messages = $item->getMessage(false); if ($item->getHasError() && is_array($messages) && !empty($messages)) { $this->_errors = array_merge($this->_errors, $messages); @@ -1991,7 +1987,7 @@ protected function _validate() } if (!empty($this->_errors)) { foreach ($this->_errors as $error) { - $this->messageManager->addError($error); + $this->messageManager->addErrorMessage($error); } throw new \Magento\Framework\Exception\LocalizedException(__('Validation is failed.')); } diff --git a/app/code/Magento/Sales/Setup/UpgradeData.php b/app/code/Magento/Sales/Setup/UpgradeData.php index 16455d616d853..4dcbb87df53ed 100644 --- a/app/code/Magento/Sales/Setup/UpgradeData.php +++ b/app/code/Magento/Sales/Setup/UpgradeData.php @@ -177,27 +177,27 @@ private function convertSerializedDataToJson($setupVersion, SalesSetup $salesSet public function fillQuoteAddressIdInSalesOrderAddress() { $addressCollection = $this->addressCollectionFactory->create(); + $addressCollection->addFieldToFilter('quote_address_id', ['null' => true]); + /** @var \Magento\Sales\Model\Order\Address $orderAddress */ foreach ($addressCollection as $orderAddress) { - if (!$orderAddress->getData('quote_address_id')) { - $orderId = $orderAddress->getParentId(); - $addressType = $orderAddress->getAddressType(); - - /** @var \Magento\Sales\Model\Order $order */ - $order = $this->orderFactory->create()->load($orderId); - $quoteId = $order->getQuoteId(); - $quote = $this->quoteFactory->create()->load($quoteId); - - if ($addressType == \Magento\Sales\Model\Order\Address::TYPE_SHIPPING) { - $quoteAddressId = $quote->getShippingAddress()->getId(); - $orderAddress->setData('quote_address_id', $quoteAddressId); - } elseif ($addressType == \Magento\Sales\Model\Order\Address::TYPE_BILLING) { - $quoteAddressId = $quote->getBillingAddress()->getId(); - $orderAddress->setData('quote_address_id', $quoteAddressId); - } - - $orderAddress->save(); + $orderId = $orderAddress->getParentId(); + $addressType = $orderAddress->getAddressType(); + + /** @var \Magento\Sales\Model\Order $order */ + $order = $this->orderFactory->create()->load($orderId); + $quoteId = $order->getQuoteId(); + $quote = $this->quoteFactory->create()->load($quoteId); + + if ($addressType == \Magento\Sales\Model\Order\Address::TYPE_SHIPPING) { + $quoteAddressId = $quote->getShippingAddress()->getId(); + $orderAddress->setData('quote_address_id', $quoteAddressId); + } elseif ($addressType == \Magento\Sales\Model\Order\Address::TYPE_BILLING) { + $quoteAddressId = $quote->getBillingAddress()->getId(); + $orderAddress->setData('quote_address_id', $quoteAddressId); } + + $orderAddress->save(); } } } diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index 8f004d9ad5968..9d6d11d56c81f 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -106,15 +106,15 @@ We'll use the default error above if you leave this empty. - + - + Magento\Config\Model\Config\Source\Yesno Improves dashboard performance but provides non-realtime data. - + diff --git a/app/code/Magento/Search/view/frontend/web/form-mini.js b/app/code/Magento/Search/view/frontend/web/form-mini.js index c064aba86caf9..27a15017cb3fc 100644 --- a/app/code/Magento/Search/view/frontend/web/form-mini.js +++ b/app/code/Magento/Search/view/frontend/web/form-mini.js @@ -55,7 +55,7 @@ define([ this.autoComplete = $(this.options.destinationSelector); this.searchForm = $(this.options.formSelector); this.submitBtn = this.searchForm.find(this.options.submitBtn)[0]; - this.searchLabel = $(this.options.searchLabel); + this.searchLabel = this.searchForm.find(this.options.searchLabel); this.isExpandable = this.options.isExpandable; _.bindAll(this, '_onKeyDown', '_onPropertyChange', '_onSubmit'); diff --git a/app/code/Magento/Store/Model/PathConfig.php b/app/code/Magento/Store/Model/PathConfig.php index dfe4eee31f9a2..6eeb93d7475fa 100644 --- a/app/code/Magento/Store/Model/PathConfig.php +++ b/app/code/Magento/Store/Model/PathConfig.php @@ -83,6 +83,8 @@ public function shouldBeSecure($path) */ public function getDefaultPath() { - return $this->scopeConfig->getValue('web/default/front', ScopeInterface::SCOPE_STORE); + $store = $this->storeManager->getStore(); + $value = $this->scopeConfig->getValue('web/default/front', ScopeInterface::SCOPE_STORE, $store); + return $value; } } diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php index 7752911ceb22f..ff31aa4ba90cb 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php @@ -531,7 +531,7 @@ protected function processProductItems( $total->setSubtotalInclTax($subtotalInclTax); $total->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); $total->setBaseSubtotalInclTax($baseSubtotalInclTax); - $shippingAssignment->getShipping()->getAddress()->setBaseSubtotalTotalInclTax($baseSubtotalInclTax);; + $shippingAssignment->getShipping()->getAddress()->setBaseSubtotalTotalInclTax($baseSubtotalInclTax); return $this; } diff --git a/app/code/Magento/Ui/Component/Bookmark.php b/app/code/Magento/Ui/Component/Bookmark.php index aa1d7a9fb5c0a..db824f11bd4b1 100644 --- a/app/code/Magento/Ui/Component/Bookmark.php +++ b/app/code/Magento/Ui/Component/Bookmark.php @@ -82,11 +82,11 @@ public function prepare() } } - $this->setData('config', array_replace_recursive($config, $this->getConfiguration($this))); + $this->setData('config', array_replace_recursive($config, $this->getConfiguration())); parent::prepare(); - $jsConfig = $this->getConfiguration($this); + $jsConfig = $this->getConfiguration(); $this->getContext()->addComponentDefinition($this->getComponentName(), $jsConfig); } } diff --git a/app/code/Magento/Ui/Model/Export/ConvertToCsv.php b/app/code/Magento/Ui/Model/Export/ConvertToCsv.php index 9eba829982533..40b10749db21e 100644 --- a/app/code/Magento/Ui/Model/Export/ConvertToCsv.php +++ b/app/code/Magento/Ui/Model/Export/ConvertToCsv.php @@ -6,6 +6,7 @@ namespace Magento\Ui\Model\Export; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\WriteInterface; @@ -31,11 +32,17 @@ class ConvertToCsv */ protected $pageSize = null; + /** + * @var Filter + */ + protected $filter; + /** * @param Filesystem $filesystem * @param Filter $filter * @param MetadataProvider $metadataProvider * @param int $pageSize + * @throws FileSystemException */ public function __construct( Filesystem $filesystem, diff --git a/app/code/Magento/Ui/Model/Export/ConvertToXml.php b/app/code/Magento/Ui/Model/Export/ConvertToXml.php index b707742063dbd..5f6e45a948f24 100644 --- a/app/code/Magento/Ui/Model/Export/ConvertToXml.php +++ b/app/code/Magento/Ui/Model/Export/ConvertToXml.php @@ -10,6 +10,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Convert\Excel; use Magento\Framework\Convert\ExcelFactory; +use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Filesystem; use Magento\Framework\Filesystem\Directory\WriteInterface; @@ -50,12 +51,18 @@ class ConvertToXml */ protected $fields; + /** + * @var Filter + */ + protected $filter; + /** * @param Filesystem $filesystem * @param Filter $filter * @param MetadataProvider $metadataProvider * @param ExcelFactory $excelFactory * @param SearchResultIteratorFactory $iteratorFactory + * @throws FileSystemException */ public function __construct( Filesystem $filesystem, @@ -88,6 +95,7 @@ protected function getOptions() * Returns DB fields list * * @return array + * @throws LocalizedException */ protected function getFields() { @@ -103,6 +111,7 @@ protected function getFields() * * @param DocumentInterface $document * @return array + * @throws LocalizedException */ public function getRowData(DocumentInterface $document) { diff --git a/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php b/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php index e18155cd08c53..85226b780aac3 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Control/ActionPoolTest.php @@ -83,8 +83,7 @@ protected function setUp() $this->items[$this->key] = $this->createPartialMock(\Magento\Ui\Component\Control\Item::class, ['setData']); $this->actionPool = new ActionPool( $this->contextMock, - $this->itemFactoryMock, - $this->toolbarBlockMock + $this->itemFactoryMock ); } diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js index d4962c0658bdf..27a32b04a7e1c 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows-grid.js @@ -109,9 +109,8 @@ define([ * @param {String|Number} recordId */ deleteRecord: function (index, recordId) { - this._super(); - this.updateInsertData(recordId); + this._super(); }, /** diff --git a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js index 94a05e5fcde33..c0d2f45544d74 100644 --- a/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js +++ b/app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js @@ -722,6 +722,8 @@ define([ * @param {Number} page - current page */ changePage: function (page) { + this.clear(); + if (page === 1 && !this.recordData().length) { return false; } @@ -763,7 +765,6 @@ define([ * Change page to next */ nextPage: function () { - this.clear(); this.currentPage(this.currentPage() + 1); }, @@ -771,7 +772,6 @@ define([ * Change page to previous */ previousPage: function () { - this.clear(); this.currentPage(this.currentPage() - 1); }, diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js index 371a0773f9d7e..b729dd3127d90 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js @@ -115,14 +115,14 @@ define([ * @returns {Group} Chainable. */ _setClasses: function () { - var addtional = this.additionalClasses, + var additional = this.additionalClasses, classes; - if (_.isString(addtional)) { - addtional = this.additionalClasses.split(' '); + if (_.isString(additional)) { + additional = this.additionalClasses.split(' '); classes = this.additionalClasses = {}; - addtional.forEach(function (name) { + additional.forEach(function (name) { classes[name] = true; }, this); } diff --git a/app/code/Magento/Ui/view/base/web/js/form/components/group.js b/app/code/Magento/Ui/view/base/web/js/form/components/group.js index f6937cffe1f2f..8c5950f7e2fa1 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/components/group.js +++ b/app/code/Magento/Ui/view/base/web/js/form/components/group.js @@ -58,14 +58,14 @@ define([ * @returns {Group} Chainable. */ _setClasses: function () { - var addtional = this.additionalClasses, + var additional = this.additionalClasses, classes; - if (_.isString(addtional)) { - addtional = this.additionalClasses.split(' '); + if (_.isString(additional)) { + additional = this.additionalClasses.split(' '); classes = this.additionalClasses = {}; - addtional.forEach(function (name) { + additional.forEach(function (name) { classes[name] = true; }, this); } diff --git a/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php b/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php index 6d921dfdcdd65..c1b7e6a1110f7 100644 --- a/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php +++ b/app/code/Magento/User/Model/Backend/Config/ObserverConfig.php @@ -72,7 +72,7 @@ public function getAdminPasswordLifetime() } /** - * Get admin maximum security failures from config + * Get admin maxiumum security failures from config * * @return int */ diff --git a/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php b/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php index 110191360acfd..129670410495c 100644 --- a/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php +++ b/app/code/Magento/Webapi/Model/Authorization/TokenUserContext.php @@ -133,6 +133,11 @@ private function isTokenExpired(Token $token): bool // other user-type tokens are considered always valid return false; } + + if (empty($tokenTtl)) { + return false; + } + if ($this->dateTime->strToTime($token->getCreatedAt()) < ($this->date->gmtTimestamp() - $tokenTtl * 3600)) { return true; } diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index b8ddf4e47d451..74b1b41ee1bf5 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -39,7 +39,9 @@ class Fault const NODE_DETAIL_WRAPPER = 'GenericFault'; /**#@-*/ - /**#@-*/ + /** + * @var string + */ protected $_soapFaultCode; /** @@ -114,7 +116,7 @@ public function __construct( \Magento\Framework\Locale\ResolverInterface $localeResolver, State $appState ) { - $this->_soapCode = $exception->getOriginator(); + $this->_soapFaultCode = $exception->getOriginator(); $this->_parameters = $exception->getDetails(); $this->_wrappedErrors = $exception->getErrors(); $this->stackTrace = $exception->getStackTrace() ?: $exception->getTraceAsString(); @@ -194,7 +196,7 @@ public function getDetails() */ public function getSoapCode() { - return $this->_soapCode; + return $this->_soapFaultCode; } /** diff --git a/app/code/Magento/Wishlist/Block/Rss/EmailLink.php b/app/code/Magento/Wishlist/Block/Rss/EmailLink.php index 8a5db15dfb5db..4a5f116cd8293 100644 --- a/app/code/Magento/Wishlist/Block/Rss/EmailLink.php +++ b/app/code/Magento/Wishlist/Block/Rss/EmailLink.php @@ -24,7 +24,7 @@ class EmailLink extends Link protected $_template = 'rss/email.phtml'; /** - * @return string + * @return array */ protected function getLinkParams() { diff --git a/app/code/Magento/Wishlist/Block/Rss/Link.php b/app/code/Magento/Wishlist/Block/Rss/Link.php index de068d68c2207..3e716c863862b 100644 --- a/app/code/Magento/Wishlist/Block/Rss/Link.php +++ b/app/code/Magento/Wishlist/Block/Rss/Link.php @@ -72,7 +72,7 @@ public function isRssAllowed() } /** - * @return string + * @return array */ protected function getLinkParams() { diff --git a/app/code/Magento/Wishlist/CustomerData/Wishlist.php b/app/code/Magento/Wishlist/CustomerData/Wishlist.php index 6933efc2aa540..d7dd27874d365 100644 --- a/app/code/Magento/Wishlist/CustomerData/Wishlist.php +++ b/app/code/Magento/Wishlist/CustomerData/Wishlist.php @@ -142,11 +142,19 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem) * Retrieve product image data * * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Block\Product\Image + * @return array * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function getImageData($product) { + /*Set variant product if it is configurable product. + It will show variant product image in sidebar instead of configurable product image.*/ + $simpleOption = $product->getCustomOption('simple_product'); + if ($simpleOption !== null) { + $optionProduct = $simpleOption->getProduct(); + $product = $optionProduct; + } + /** @var \Magento\Catalog\Helper\Image $helper */ $helper = $this->imageHelperFactory->create() ->init($product, 'wishlist_sidebar_block'); diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 6c34adffcd851..968a7f1db8c39 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -503,7 +503,7 @@ public function isAllowInCart() /** * Retrieve customer name * - * @return string|void + * @return string|null */ public function getCustomerName() { diff --git a/app/code/Magento/Wishlist/Plugin/Ui/DataProvider/WishlistSettings.php b/app/code/Magento/Wishlist/Plugin/Ui/DataProvider/WishlistSettings.php index 7f37486c7936c..df8bb3191bf9f 100644 --- a/app/code/Magento/Wishlist/Plugin/Ui/DataProvider/WishlistSettings.php +++ b/app/code/Magento/Wishlist/Plugin/Ui/DataProvider/WishlistSettings.php @@ -32,7 +32,7 @@ public function __construct(Data $helper) /** * Add tax data to result * - * @param \Magento\Checkout\CustomerData\Cart $subject + * @param \Magento\Catalog\Ui\DataProvider\Product\Listing\DataProvider $subject * @param array $result * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less index 9480161248d15..065f870dbfe01 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less @@ -236,7 +236,7 @@ body._in-resize { th, td { - font-size: @data-grid__font-size; // ToDo UI: Rewrite old styles. Should be deleted afterwards + font-size: @data-grid__font-size; // Rewrite old styles. Should be deleted afterwards line-height: @line-height__base; transition: @smooth__background-color; vertical-align: top; @@ -304,7 +304,7 @@ body._in-resize { .action-menu { left: auto; min-width: 10rem; - right: auto; + right: 0; text-align: left; top: auto; z-index: 1; diff --git a/app/design/frontend/Magento/blank/web/css/print.less b/app/design/frontend/Magento/blank/web/css/print.less index 474bc27b0751b..ebfc6ce4300b7 100644 --- a/app/design/frontend/Magento/blank/web/css/print.less +++ b/app/design/frontend/Magento/blank/web/css/print.less @@ -132,4 +132,8 @@ .footer.content { padding: 0; } + + .hidden-print { + display: none !important; + } } diff --git a/app/design/frontend/Magento/luma/etc/view.xml b/app/design/frontend/Magento/luma/etc/view.xml index 349224a34022c..eafcc89e20b75 100644 --- a/app/design/frontend/Magento/luma/etc/view.xml +++ b/app/design/frontend/Magento/luma/etc/view.xml @@ -231,6 +231,7 @@ hover false + outside diff --git a/app/design/frontend/Magento/luma/web/css/source/_actions-toolbar.less b/app/design/frontend/Magento/luma/web/css/source/_actions-toolbar.less index 096b93675a92c..d81d0a8388a78 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_actions-toolbar.less +++ b/app/design/frontend/Magento/luma/web/css/source/_actions-toolbar.less @@ -22,10 +22,6 @@ &:last-child { margin-bottom: 0; } - - &.primary { - // &:extend(.abs-button-l all); - } } &:last-child { diff --git a/app/design/frontend/Magento/luma/web/css/source/_forms.less b/app/design/frontend/Magento/luma/web/css/source/_forms.less index 1c9ffb1606b26..7c5027aef113b 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_forms.less +++ b/app/design/frontend/Magento/luma/web/css/source/_forms.less @@ -91,11 +91,7 @@ .select-styling() { .lib-css(appearance, none, 1); appearance: none; - background: @select__background url('../images/select-bg.svg') no-repeat 100% 45%; background-size: 30px 60px; - border: 1px solid @border-color__base; - height: 32px; - padding-right: 25px; text-indent: .01em; text-overflow: ''; diff --git a/app/design/frontend/Magento/luma/web/css/source/_theme.less b/app/design/frontend/Magento/luma/web/css/source/_theme.less index b94ffc08b77ec..957e622d6a0bb 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_theme.less +++ b/app/design/frontend/Magento/luma/web/css/source/_theme.less @@ -166,6 +166,13 @@ // Forms // --------------------------------------------- + +// Select +@select__background: @form-element-input__background url('../images/select-bg.svg') no-repeat 100% 45%; +@select__border: 1px solid @border-color__base; +@select__height: 32px; +@select__padding: 4px 25px @indent__xs @indent__s; + // Form fieldset @form-fieldset-legend__font-size: 18px; @form-fieldset-legend__font-weight: @font-weight__light; diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml index cfafe3d485bb1..ee12d3ac22a5e 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutPaymentSection.xml @@ -12,7 +12,7 @@ - + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php index 74d522e9545a8..431116903d372 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php @@ -51,6 +51,9 @@ public function getItemProductBlock($productSku) */ public function clickUpdateQty() { - $this->_rootElement->find($this->updateQty)->click(); + $button = $this->_rootElement->find($this->updateQty); + if (!$button->isDisabled()) { + $button->click(); + } } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php index 2013c3590019e..d13137c4887f7 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Totals.php @@ -123,6 +123,9 @@ public function getAdjustmentFeeElement() */ public function clickUpdateTotals() { - $this->_rootElement->find($this->updateTotalsSelector)->click(); + $button = $this->_rootElement->find($this->updateTotalsSelector); + if (!$button->isDisabled()) { + $button->click(); + } } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php index 21239242b3c89..319338bb579d2 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php @@ -30,7 +30,7 @@ public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderI $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); \PHPUnit_Framework_Assert::assertFalse( $salesOrderView->getPageActions()->isActionButtonVisible('Credit Memo'), - 'Credit memo button is present on order view page.' + 'Credit memo button should not be present on order view page.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php index ef388d12a6575..11d8f57af9e1c 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateCreditMemoStep.php @@ -96,11 +96,8 @@ public function run() $this->orderCreditMemoNew->getFormBlock()->updateQty(); } - $hasChangeTotals = $this->compareRefundTotalsData($refundData); $this->orderCreditMemoNew->getFormBlock()->fillFormData($refundData); - if ($hasChangeTotals) { - $this->orderCreditMemoNew->getTotalsBlock()->clickUpdateTotals(); - } + $this->orderCreditMemoNew->getTotalsBlock()->clickUpdateTotals(); $this->orderCreditMemoNew->getFormBlock()->submit(); } @@ -121,31 +118,4 @@ protected function getCreditMemoIds() $this->salesOrderView->getOrderForm()->openTab('creditmemos'); return $this->salesOrderView->getOrderForm()->getTab('creditmemos')->getGridBlock()->getIds(); } - - /** - * Compare refund total items. - * - * @param array $data - * @return int - */ - private function compareRefundTotalsData($data) - { - $compareData = [ - 'shipping_amount' => - $this->orderCreditMemoNew->getTotalsBlock()->getRefundShippingElement()->getValue(), - 'adjustment_positive' => - $this->orderCreditMemoNew->getTotalsBlock()->getAdjustmentRefundElement()->getValue(), - 'adjustment_negative' => - $this->orderCreditMemoNew->getTotalsBlock()->getAdjustmentFeeElement()->getValue(), - ]; - - $count = 0; - foreach ($compareData as $key => $val) { - if (isset($data['form_data'][$key])) { - $count += ($val != $data['form_data'][$key] ? 1 : 0); - } - } - - return $count; - } } diff --git a/dev/tests/integration/testsuite/Magento/AdvancedPricingImportExport/_files/create_products.php b/dev/tests/integration/testsuite/Magento/AdvancedPricingImportExport/_files/create_products.php index 492a957542338..15bc1176e81e7 100644 --- a/dev/tests/integration/testsuite/Magento/AdvancedPricingImportExport/_files/create_products.php +++ b/dev/tests/integration/testsuite/Magento/AdvancedPricingImportExport/_files/create_products.php @@ -15,7 +15,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['qty' => 100, 'is_in_stock' => 1]) ->setIsObjectNew(true) ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php index 43e39499707b5..1b3bb84fe3e3d 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/multiple_products.php @@ -28,7 +28,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData([ 'use_config_manage_stock' => 1, 'qty' => 100, @@ -59,7 +59,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData([ 'use_config_manage_stock' => 1, 'qty' => 50, @@ -85,7 +85,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData([ 'use_config_manage_stock' => 1, 'qty' => 140, @@ -116,7 +116,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData([ 'use_config_manage_stock' => 1, 'qty' => 20, @@ -147,7 +147,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData([ 'use_config_manage_stock' => 1, 'qty' => 15, diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync.php index 9c55370156235..96a537f123d92 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/_files/website_attribute_sync.php @@ -126,7 +126,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(AttributeStatus::STATUS_ENABLED) ->setWebsiteIds([$website->getId()]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]); $product = $productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_duplicates.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_duplicates.php index 8f35758df637c..02f6c4e3cf514 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/category_duplicates.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/category_duplicates.php @@ -48,7 +48,7 @@ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED )->setWebsiteIds( [1] -)->setCateroryIds( +)->setCategoryIds( [] )->setStockData( ['qty' => 100, 'is_in_stock' => 1] diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php index f55afc8c6a211..bb7e241d972e5 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/dropdown_attribute.php @@ -32,8 +32,8 @@ 'is_filterable_in_search' => 0, 'is_used_for_promo_rules' => 0, 'is_html_allowed_on_front' => 1, - 'is_visible_on_front' => 0, - 'used_in_product_listing' => 0, + 'is_visible_on_front' => 1, + 'used_in_product_listing' => 1, 'used_for_sort_by' => 0, 'frontend_label' => ['Drop-Down Attribute'], 'backend_type' => 'varchar', diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products.php index 00fa3d98dad04..a7e472ec7bf4e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products.php @@ -25,7 +25,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) ->save(); @@ -49,7 +49,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) ->save(); @@ -68,6 +68,6 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 140, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products_with_non_saleable_product.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products_with_non_saleable_product.php index 2286b2abffd0f..1b8fd1cd02552 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products_with_non_saleable_product.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/multiple_products_with_non_saleable_product.php @@ -24,7 +24,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1]) ->save(); @@ -47,6 +47,6 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_IN_CATALOG) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['use_config_manage_stock' => 1, 'qty' => 50, 'is_qty_decimal' => 0, 'is_in_stock' => 0]) ->save(); diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars.php index 06a686d9d7830..95dd6329751d8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data_special_chars.php @@ -28,7 +28,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->setWebsiteIds([1]) - ->setCateroryIds([]) + ->setCategoryIds([]) ->setStockData(['qty' => 100, 'is_in_stock' => 1]) ->setCanSaveCustomOptions(true) ->setCategoryIds([333]) diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php index 2f1f0a0b14f54..512371ee128af 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_with_product_links_data.php @@ -34,7 +34,7 @@ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED )->setWebsiteIds( [1] -)->setCateroryIds( +)->setCategoryIds( [] )->setStockData( ['qty' => 100, 'is_in_stock' => 1] diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php index 7d5cb55ec2f96..02d004e3239aa 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Model/Entity/Attribute/Frontend/DefaultFrontendTest.php @@ -78,6 +78,21 @@ public function testGetSelectOptions() ); } + /** + * @magentoDataFixture Magento/Catalog/_files/dropdown_attribute.php + * @return void + */ + public function testAttributeEntityValueNotSet() + { + $entity = $this->objectManager->create(\Magento\Catalog\Model\Product::class); + $entity->setStoreId(0); + $entity->load(1); + $frontEnd = $this->attribute->loadByCode('catalog_product', 'dropdown_attribute'); + $value = $frontEnd->getFrontend()->getValue($entity); + + $this->assertFalse($value); + } + /** * Cache key generation * @return string diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css index b29e2c0fd9b88..e079dd3715e4f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Magento/ModuleA/view/adminhtml/product/product.css @@ -13,7 +13,7 @@ overflow: hidden; padding: 5px 6px 3px; margin-left: 12px; - color: #7a7976;; + color: #7a7976; } [class^=" catalog-product-"] .page-actions .action-back:hover, diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php index 3ad5299a48654..96f98488dc704 100644 --- a/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/ShippingMethodManagementTest.php @@ -30,6 +30,57 @@ public function testRateAppliedToShipping() $this->assertEquals(0, $customerQuote->getBaseGrandTotal()); } + /** + * @magentoConfigFixture current_store carriers/tablerate/active 1 + * @magentoConfigFixture current_store carriers/flatrate/active 0 + * @magentoConfigFixture current_store carriers/freeshipping/active 0 + * @magentoConfigFixture current_store carriers/tablerate/condition_name package_qty + * @magentoDataFixture Magento/SalesRule/_files/cart_rule_free_shipping_by_cart.php + * @magentoDataFixture Magento/Sales/_files/quote.php + * @magentoDataFixture Magento/OfflineShipping/_files/tablerates.php + * @return void + */ + public function testTableRateFreeShipping() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $objectManager->get(\Magento\Quote\Model\Quote::class); + $quote->load('test01', 'reserved_order_id'); + $cartId = $quote->getId(); + if (!$cartId) { + $this->fail('quote fixture failed'); + } + /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ + $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class) + ->create(); + $quoteIdMask->load($cartId, 'quote_id'); + //Use masked cart Id + $cartId = $quoteIdMask->getMaskedId(); + $data = [ + 'data' => [ + 'country_id' => "US", + 'postcode' => null, + 'region' => null, + 'region_id' => null + ] + ]; + /** @var \Magento\Quote\Api\Data\EstimateAddressInterface $address */ + $address = $objectManager->create(\Magento\Quote\Api\Data\EstimateAddressInterface::class, $data); + /** @var \Magento\Quote\Api\GuestShippingMethodManagementInterface $shippingEstimation */ + $shippingEstimation = $objectManager->get(\Magento\Quote\Api\GuestShippingMethodManagementInterface::class); + $result = $shippingEstimation->estimateByAddress($cartId, $address); + $this->assertNotEmpty($result); + $expectedResult = [ + 'method_code' => 'bestway', + 'amount' => 0 + ]; + foreach ($result as $rate) { + $this->assertEquals($expectedResult['amount'], $rate->getAmount()); + $this->assertEquals($expectedResult['method_code'], $rate->getMethodCode()); + } + } + /** * @magentoConfigFixture current_store carriers/tablerate/active 1 * @magentoConfigFixture current_store carriers/tablerate/condition_name package_qty @@ -53,6 +104,7 @@ public function testEstimateByAddressWithCartPriceRuleByItem() */ public function testEstimateByAddressWithCartPriceRuleByShipment() { + $this->markTestSkipped('According to MAGETWO-69940 it is an incorrect behavior'); // Rule applied to entire shipment should not overwrite flat or table rate shipping prices // Only rules applied to specific items should modify those prices (MAGETWO-63844) $this->executeTestFlow(5, 10); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php index 6b4e9a66f4c6b..999522a49e006 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php @@ -5,39 +5,50 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\Sales\Block\Adminhtml\Order\Create\Form; +use Magento\Backend\Model\Session\Quote as SessionQuote; +use Magento\Customer\Api\Data\AttributeMetadataInterfaceFactory; +use Magento\Customer\Model\Metadata\Form; +use Magento\Customer\Model\Metadata\FormFactory; +use Magento\Framework\View\LayoutInterface; +use Magento\Quote\Model\Quote; +use Magento\TestFramework\Helper\Bootstrap; + /** * @magentoAppArea adminhtml */ class AccountTest extends \PHPUnit\Framework\TestCase { - /** @var \Magento\Sales\Block\Adminhtml\Order\Create\Form\Account */ - protected $_accountBlock; + /** @var Account */ + private $accountBlock; /** - * @var \Magento\TestFramework\Helper\Bootstrap + * @var Bootstrap */ - protected $_objectManager; + private $objectManager; /** * @magentoDataFixture Magento/Sales/_files/quote.php */ protected function setUp() { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $quote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class)->load(1); + $this->objectManager = Bootstrap::getObjectManager(); + $quote = $this->objectManager->create(Quote::class)->load(1); $sessionQuoteMock = $this->getMockBuilder( - \Magento\Backend\Model\Session\Quote::class + SessionQuote::class )->disableOriginalConstructor()->setMethods( ['getCustomerId', 'getStore', 'getStoreId', 'getQuote'] )->getMock(); $sessionQuoteMock->expects($this->any())->method('getCustomerId')->will($this->returnValue(1)); $sessionQuoteMock->expects($this->any())->method('getQuote')->will($this->returnValue($quote)); - /** @var \Magento\Framework\View\LayoutInterface $layout */ - $layout = $this->_objectManager->get(\Magento\Framework\View\LayoutInterface::class); - $this->_accountBlock = $layout->createBlock( - \Magento\Sales\Block\Adminhtml\Order\Create\Form\Account::class, + /** @var LayoutInterface $layout */ + $layout = $this->objectManager->get(LayoutInterface::class); + $this->accountBlock = $layout->createBlock( + Account::class, 'address_block' . rand(), ['sessionQuote' => $sessionQuoteMock] ); @@ -50,7 +61,7 @@ protected function setUp() public function testGetForm() { $expectedFields = ['group_id', 'email']; - $form = $this->_accountBlock->getForm(); + $form = $this->accountBlock->getForm(); $this->assertEquals(1, $form->getElements()->count(), "Form has invalid number of fieldsets"); $fieldset = $form->getElements()[0]; @@ -63,4 +74,56 @@ public function testGetForm() ); } } + + /** + * Tests a case when user defined custom attribute has default value. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetFormWithUserDefinedAttribute() + { + $formFactory = $this->getFormFactoryMock(); + $this->objectManager->addSharedInstance($formFactory, FormFactory::class); + + /** @var LayoutInterface $layout */ + $layout = $this->objectManager->get(LayoutInterface::class); + $accountBlock = $layout->createBlock(Account::class, 'address_block' . rand()); + + $form = $accountBlock->getForm(); + $form->setUseContainer(true); + + $this->assertContains( + '', + $form->toHtml(), + 'Default value for user defined custom attribute should be selected' + ); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getFormFactoryMock(): \PHPUnit_Framework_MockObject_MockObject + { + /** @var AttributeMetadataInterfaceFactory $attributeMetadataFactory */ + $attributeMetadataFactory = $this->objectManager->create(AttributeMetadataInterfaceFactory::class); + $booleanAttribute = $attributeMetadataFactory->create() + ->setAttributeCode('boolean') + ->setBackendType('boolean') + ->setFrontendInput('boolean') + ->setDefaultValue('1') + ->setFrontendLabel('Yes/No'); + + $form = $this->getMockBuilder(Form::class) + ->disableOriginalConstructor() + ->getMock(); + $form->method('getUserAttributes')->willReturn([$booleanAttribute]); + $form->method('getSystemAttributes')->willReturn([]); + + $formFactory = $this->getMockBuilder(FormFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $formFactory->method('create')->willReturn($form); + + return $formFactory; + } } diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/address_data.php b/dev/tests/integration/testsuite/Magento/Sales/_files/address_data.php index 2d131bf5f57e2..394b13078010a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/address_data.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/address_data.php @@ -6,6 +6,7 @@ return [ 'region' => 'CA', + 'region_id' => '12', 'postcode' => '11111', 'lastname' => 'lastname', 'firstname' => 'firstname', diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/sidebar.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/sidebar.test.js new file mode 100644 index 0000000000000..8b4fae5a69461 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Checkout/frontend/js/sidebar.test.js @@ -0,0 +1,109 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/* eslint-disable max-nested-callbacks */ +/*jscs:disable jsDoc*/ + +define([ + 'squire', + 'jquery', + 'ko' +], function (Squire, $, ko) { + 'use strict'; + + describe('Magento_Checkout/js/sidebar', function () { + var injector = new Squire(), + mocks = { + 'Magento_Customer/js/customer-data': { + get: function () { + return ko.observable(); + } + } + }, + sidebar, + cartData = { + 'items': [ + { + 'item_id': 1, + 'product_sku': 'bundle' + }, + { + 'item_id': 5, + 'product_sku': 'simple' + }, + { + 'item_id': 7, + 'product_sku': 'configurable' + } + ] + }, + cart = ko.observable(cartData); + + beforeEach(function (done) { + injector.mock(mocks); + injector.require(['Magento_Checkout/js/sidebar'], function (Constr) { + sidebar = new Constr; + done(); + }); + }); + + describe('Check remove mini-cart item callback.', function () { + beforeEach(function () { + spyOn(jQuery.fn, 'trigger'); + spyOn(mocks['Magento_Customer/js/customer-data'], 'get').and.returnValue(cart); + }); + + it('Method "_removeItemAfter" is defined', function () { + expect(sidebar._removeItemAfter).toBeDefined(); + }); + + it('Cart item is exists', function () { + var elem = $('').data('cart-item', 5); + + sidebar._removeItemAfter(elem); + expect(mocks['Magento_Customer/js/customer-data'].get).toHaveBeenCalledWith('cart'); + expect(jQuery('body').trigger).toHaveBeenCalledWith('ajax:removeFromCart', 'simple'); + }); + + it('Cart item doesn\'t exists', function () { + var elem = $('').data('cart-item', 100); + + sidebar._removeItemAfter(elem); + expect(jQuery('body').trigger).not.toHaveBeenCalled(); + }); + }); + + describe('Check update item quantity callback.', function () { + beforeEach(function () { + spyOn(jQuery.fn, 'trigger'); + spyOn(mocks['Magento_Customer/js/customer-data'], 'get').and.returnValue(cart); + }); + + it('Method "_updateItemQtyAfter" is defined', function () { + expect(sidebar._updateItemQtyAfter).toBeDefined(); + }); + + it('Cart item is exists', function () { + var elem = $('').data('cart-item', 5); + + spyOn(sidebar, '_hideItemButton'); + + sidebar._updateItemQtyAfter(elem); + expect(mocks['Magento_Customer/js/customer-data'].get).toHaveBeenCalledWith('cart'); + expect(jQuery('body').trigger).toHaveBeenCalledWith('ajax:updateCartItemQty', 'simple'); + expect(sidebar._hideItemButton).toHaveBeenCalledWith(elem); + }); + + it('Cart item doesn\'t exists', function () { + var elem = $('').data('cart-item', 100); + + spyOn(sidebar, '_hideItemButton'); + + sidebar._updateItemQtyAfter(elem); + expect(jQuery('body').trigger).not.toHaveBeenCalled(); + expect(sidebar._hideItemButton).toHaveBeenCalledWith(elem); + }); + }); + }); +}); diff --git a/dev/tests/static/framework/Magento/Sniffs/Less/PropertiesSortingSniff.php b/dev/tests/static/framework/Magento/Sniffs/Less/PropertiesSortingSniff.php index 29b6d9a8cae9d..e59b5da37d0e2 100644 --- a/dev/tests/static/framework/Magento/Sniffs/Less/PropertiesSortingSniff.php +++ b/dev/tests/static/framework/Magento/Sniffs/Less/PropertiesSortingSniff.php @@ -100,6 +100,14 @@ public function process(File $phpcsFile, $stackPtr) */ private function validatePropertiesSorting(File $phpcsFile, $stackPtr, array $properties) { + // Fix needed for cases when incorrect properties passed for validation due to bug in PHP tokens. + $symbolsForSkip = ['(', 'block', 'field']; + $properties = array_filter( + $properties, + function ($var) use ($symbolsForSkip) { + return !in_array($var, $symbolsForSkip); + } + ); $originalProperties = $properties; sort($properties); diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/DiRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/DiRule.php index 2b4497c544ab7..cdaa49e8d37fb 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/DiRule.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/DiRule.php @@ -40,7 +40,7 @@ private function getPattern() { if ($this->pattern === null) { $this->pattern = '~\b(?(?(' - . implode('_|', Files::init()->getNamespaces()) + . implode('[_\\\\]|', Files::init()->getNamespaces()) . '[_\\\\])[a-zA-Z0-9]+)[a-zA-Z0-9_\\\\]*)\b~'; } diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php index e240e5037fb3e..43ca45bc3aaa3 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php @@ -89,7 +89,7 @@ public function getDependencyInfo($currentModule, $fileType, $file, &$contents) } $pattern = '~\b(?(?(' . implode( - '_|', + '[_\\\\]|', Files::init()->getNamespaces() ) . '[_\\\\])[a-zA-Z0-9]+)[a-zA-Z0-9_\\\\]*)\b~'; diff --git a/lib/internal/Magento/Framework/Locale/Deployed/Options.php b/lib/internal/Magento/Framework/Locale/Deployed/Options.php index ea892ee7fcab0..82f80b8a3b576 100644 --- a/lib/internal/Magento/Framework/Locale/Deployed/Options.php +++ b/lib/internal/Magento/Framework/Locale/Deployed/Options.php @@ -3,9 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\Locale\Deployed; +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\State; +use Magento\Framework\Config\ConfigOptionsListConstants as Constants; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Locale\AvailableLocalesInterface; use Magento\Framework\Locale\ListsInterface; @@ -45,28 +50,36 @@ class Options implements OptionInterface */ private $localeLists; + /** + * @var DeploymentConfig + */ + private $deploymentConfig; + /** * @param ListsInterface $localeLists locales list * @param State $state application state class * @param AvailableLocalesInterface $availableLocales operates with available locales * @param DesignInterface $design operates with magento design settings + * @param DeploymentConfig $deploymentConfig */ public function __construct( ListsInterface $localeLists, State $state, AvailableLocalesInterface $availableLocales, - DesignInterface $design + DesignInterface $design, + DeploymentConfig $deploymentConfig = null ) { $this->localeLists = $localeLists; $this->state = $state; $this->availableLocales = $availableLocales; $this->design = $design; + $this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class); } /** * {@inheritdoc} */ - public function getOptionLocales() + public function getOptionLocales(): array { return $this->filterLocales($this->localeLists->getOptionLocales()); } @@ -74,7 +87,7 @@ public function getOptionLocales() /** * {@inheritdoc} */ - public function getTranslatedOptionLocales() + public function getTranslatedOptionLocales(): array { return $this->filterLocales($this->localeLists->getTranslatedOptionLocales()); } @@ -82,7 +95,7 @@ public function getTranslatedOptionLocales() /** * Filter list of locales by available locales for current theme and depends on running application mode. * - * Applies filters only in production mode. + * Applies filters only in production mode when flag 'static_content_on_demand_in_production' is not enabled. * For example, if the current design theme has only one generated locale en_GB then for given array of locales: * ```php * $locales = [ @@ -113,9 +126,10 @@ public function getTranslatedOptionLocales() * @param array $locales list of locales for filtering * @return array of filtered locales */ - private function filterLocales(array $locales) + private function filterLocales(array $locales): array { - if ($this->state->getMode() != State::MODE_PRODUCTION) { + if ($this->state->getMode() != State::MODE_PRODUCTION + || $this->deploymentConfig->getConfigData(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)) { return $locales; } diff --git a/lib/internal/Magento/Framework/Locale/Format.php b/lib/internal/Magento/Framework/Locale/Format.php index 7bb4cb4b7d432..00379c87daaf9 100644 --- a/lib/internal/Magento/Framework/Locale/Format.php +++ b/lib/internal/Magento/Framework/Locale/Format.php @@ -99,7 +99,10 @@ public function getPriceFormat($localeCode = null, $currencyCode = null) $currency = $this->_scopeResolver->getScope()->getCurrentCurrency(); } - $formatter = new \NumberFormatter($localeCode, \NumberFormatter::CURRENCY); + $formatter = new \NumberFormatter( + $localeCode . '@currency=' . $currency->getCode(), + \NumberFormatter::CURRENCY + ); $format = $formatter->getPattern(); $decimalSymbol = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); $groupSymbol = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL); diff --git a/lib/internal/Magento/Framework/Locale/Test/Unit/Deployed/OptionsTest.php b/lib/internal/Magento/Framework/Locale/Test/Unit/Deployed/OptionsTest.php index 417bbfd402549..0dd592449d77d 100644 --- a/lib/internal/Magento/Framework/Locale/Test/Unit/Deployed/OptionsTest.php +++ b/lib/internal/Magento/Framework/Locale/Test/Unit/Deployed/OptionsTest.php @@ -3,9 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\Locale\Test\Unit\Deployed; +use Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\State; +use Magento\Framework\Config\ConfigOptionsListConstants as Constants; use Magento\Framework\Locale\AvailableLocalesInterface; use Magento\Framework\Locale\Deployed\Options; use Magento\Framework\Locale\ListsInterface; @@ -40,6 +44,11 @@ class OptionsTest extends \PHPUnit\Framework\TestCase */ private $localeListsMock; + /** + * @var DeploymentConfig|MockObject + */ + private $deploymentConfigMock; + /** * @var Options */ @@ -59,63 +68,123 @@ protected function setUp() ->getMockForAbstractClass(); $this->localeListsMock = $this->getMockBuilder(ListsInterface::class) ->getMockForAbstractClass(); + $this->deploymentConfigMock = $this->createMock(\Magento\Framework\App\DeploymentConfig::class); $this->model = new Options( $this->localeListsMock, $this->stateMock, $this->availableLocalesMock, - $this->designMock + $this->designMock, + $this->deploymentConfigMock ); } /** * @param string $mode + * @param int $scdOnDemand + * @param array $locales + * @return void + * + * @dataProvider getFullLocalesDataProvider + */ + public function testGetOptionLocalesFull(string $mode, int $scdOnDemand, array $locales) + { + $this->localeListsMock->expects($this->once()) + ->method('getOptionLocales') + ->willReturn($locales); + + $this->prepareGetLocalesFull($mode, $scdOnDemand); + + $this->assertEquals($locales, array_values($this->model->getOptionLocales())); + } + + /** + * @param string $mode + * @param int $scdOnDemand + * @param array $locales + * @return void + * + * @dataProvider getFullLocalesDataProvider + */ + public function testGetTranslatedOptionLocalesFull(string $mode, int $scdOnDemand, array $locales) + { + $this->localeListsMock->expects($this->once()) + ->method('getTranslatedOptionLocales') + ->willReturn($locales); + + $this->prepareGetLocalesFull($mode, $scdOnDemand); + + $this->assertEquals($locales, array_values($this->model->getTranslatedOptionLocales())); + } + + /** + * @param string $mode + * @param int $scdOnDemand * @param array $locales * @param array $expectedLocales * @param array $deployedCodes - * @dataProvider getLocaleDataProvider + * @return void + * + * @dataProvider getLimitedLocalesDataProvider */ - public function testGetOptionLocales($mode, $locales, $expectedLocales, $deployedCodes) - { + public function testGetOptionLocalesLimited( + string $mode, + int $scdOnDemand, + array $locales, + array $expectedLocales, + array $deployedCodes + ) { $this->localeListsMock->expects($this->once()) ->method('getOptionLocales') ->willReturn($locales); - $this->prepareGetLocales($mode, $deployedCodes); + $this->prepareGetLocalesLimited($mode, $scdOnDemand, $deployedCodes); $this->assertEquals($expectedLocales, array_values($this->model->getOptionLocales())); } /** * @param string $mode + * @param int $scdOnDemand * @param array $locales * @param array $expectedLocales * @param array $deployedCodes - * @dataProvider getLocaleDataProvider + * @return void + * + * @dataProvider getLimitedLocalesDataProvider */ - public function testGetTranslatedOptionLocales($mode, $locales, $expectedLocales, $deployedCodes) - { + public function testGetTranslatedOptionLocalesLimited( + string $mode, + int $scdOnDemand, + array $locales, + array $expectedLocales, + array $deployedCodes + ) { $this->localeListsMock->expects($this->once()) ->method('getTranslatedOptionLocales') ->willReturn($locales); - $this->prepareGetLocales($mode, $deployedCodes); + $this->prepareGetLocalesLimited($mode, $scdOnDemand, $deployedCodes); $this->assertEquals($expectedLocales, array_values($this->model->getTranslatedOptionLocales())); } /** - * @param $mode - * @param $deployedCodes + * @param string $mode + * @param int $scdOnDemand + * @param array $deployedCodes * @return void */ - private function prepareGetLocales($mode, $deployedCodes) + private function prepareGetLocalesLimited(string $mode, int $scdOnDemand, $deployedCodes) { $this->stateMock->expects($this->once()) ->method('getMode') ->willReturn($mode); + $this->deploymentConfigMock->expects($this->any()) + ->method('getConfigData') + ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION) + ->willReturn($scdOnDemand); - if ($mode == State::MODE_PRODUCTION) { $area = 'area'; $code = 'code'; $themeMock = $this->getMockBuilder(ThemeInterface::class) @@ -133,32 +202,94 @@ private function prepareGetLocales($mode, $deployedCodes) ->method('getList') ->with($code, $area) ->willReturn($deployedCodes); - } + } + + /** + * @param string $mode + * @param int $scdOnDemand + * @return void + */ + private function prepareGetLocalesFull(string $mode, int $scdOnDemand) + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->willReturn($mode); + $this->deploymentConfigMock->expects($this->any()) + ->method('getConfigData') + ->with(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION) + ->willReturn($scdOnDemand); + + $this->designMock->expects($this->never()) + ->method('getDesignTheme'); } /** * @return array */ - public function getLocaleDataProvider() + public function getFullLocalesDataProvider(): array { + $deLocale = [ + 'value' => 'de_DE', + 'label' => 'German (German)' + ]; + $daLocale = [ + 'value' => 'da_DK', + 'label' => 'Danish (Denmark)' + ]; + return [ [ State::MODE_PRODUCTION, + 1, + [$daLocale, $deLocale], + ], + [ + State::MODE_DEVELOPER, + 0, + [$daLocale, $deLocale], + ], + [ + State::MODE_DEVELOPER, + 1, + [$deLocale], + ], + [ + State::MODE_DEFAULT, + 0, + [$daLocale], + ], + [ + State::MODE_DEFAULT, + 1, + [$daLocale, $deLocale], + ], + ]; + } + + /** + * @return array + */ + public function getLimitedLocalesDataProvider(): array + { + $deLocale = [ + 'value' => 'de_DE', + 'label' => 'German (German)' + ]; + $daLocale = [ + 'value' => 'da_DK', + 'label' => 'Danish (Denmark)' + ]; + + return [ + [ + State::MODE_PRODUCTION, + 0, [ - [ - 'value' => 'da_DK', - 'label' => 'Danish (Denmark)' - ], - [ - 'value' => 'de_DE', - 'label' => 'German (German)' - ] + $daLocale, + $deLocale ], [ - [ - 'value' => 'de_DE', - 'label' => 'German (German)' - ] + $deLocale ], [ 'de_DE' @@ -166,38 +297,17 @@ public function getLocaleDataProvider() ], [ State::MODE_PRODUCTION, + 0, [ - [ - 'value' => 'de_DE', - 'label' => 'German (German)' - ] - ], - [], - [] - ], - [ - State::MODE_DEVELOPER, - [ - [ - 'value' => 'da_DK', - 'label' => 'Danish (Denmark)' - ], - [ - 'value' => 'de_DE', - 'label' => 'German (German)' - ] + $daLocale, + $deLocale ], [ - [ - 'value' => 'da_DK', - 'label' => 'Danish (Denmark)' - ], - [ - 'value' => 'de_DE', - 'label' => 'German (German)' - ] + $daLocale, + $deLocale ], [ + 'da_DK', 'de_DE' ] ], diff --git a/lib/internal/Magento/Framework/Math/FloatComparator.php b/lib/internal/Magento/Framework/Math/FloatComparator.php new file mode 100644 index 0000000000000..4053404369956 --- /dev/null +++ b/lib/internal/Magento/Framework/Math/FloatComparator.php @@ -0,0 +1,59 @@ + self::$epsilon; + } + + /** + * Compares if the first argument greater or equal to the second. + * + * @param float $a + * @param float $b + * @return bool + */ + public function greaterThanOrEqual(float $a, float $b): bool + { + return $this->equal($a, $b) || $this->greaterThan($a, $b); + } +} diff --git a/lib/internal/Magento/Framework/Math/Test/Unit/FloatComparatorTest.php b/lib/internal/Magento/Framework/Math/Test/Unit/FloatComparatorTest.php new file mode 100644 index 0000000000000..c9e5143ee789e --- /dev/null +++ b/lib/internal/Magento/Framework/Math/Test/Unit/FloatComparatorTest.php @@ -0,0 +1,115 @@ +comparator = new FloatComparator(); + } + + /** + * Checks a case when `a` and `b` are equal. + * + * @param float $a + * @param float $b + * @param bool $expected + * @dataProvider eqDataProvider + */ + public function testEq(float $a, float $b, bool $expected) + { + self::assertEquals($expected, $this->comparator->equal($a, $b)); + } + + /** + * Gets list of variations to compare equal float. + * + * @return array + */ + public function eqDataProvider(): array + { + return [ + [10, 10.00001, true], + [10, 10.000001, true], + [10.0000099, 10.00001, true], + [1, 1.0001, false], + [1, -1.00001, false], + ]; + } + + /** + * Checks a case when `a` > `b`. + * + * @param float $a + * @param float $b + * @param bool $expected + * @dataProvider gtDataProvider + */ + public function testGt(float $a, float $b, bool $expected) + { + self::assertEquals($expected, $this->comparator->greaterThan($a, $b)); + } + + /** + * Gets list of variations to compare if `a` > `b`. + * + * @return array + */ + public function gtDataProvider(): array + { + return [ + [10, 10.00001, false], + [10, 10.000001, false], + [10.0000099, 10.00001, false], + [1.0001, 1, true], + [1, -1.00001, true], + ]; + } + + /** + * Checks a case when `a` >= `b`. + * + * @param float $a + * @param float $b + * @param bool $expected + * @dataProvider gteDataProvider + */ + public function testGte(float $a, float $b, bool $expected) + { + self::assertEquals($expected, $this->comparator->greaterThanOrEqual($a, $b)); + } + + /** + * Gets list of variations to compare if `a` >= `b`. + * + * @return array + */ + public function gteDataProvider(): array + { + return [ + [10, 10.00001, true], + [10, 10.000001, true], + [10.0000099, 10.00001, true], + [1.0001, 1, true], + [1, -1.00001, true], + [1.0001, 1.001, false], + ]; + } +} diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index acb2c5b4f1d15..13b7494f9c75e 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -286,8 +286,8 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null) * @param string|\DateTimeInterface $date * @param int $dateType * @param int $timeType - * @param null $locale - * @param null $timezone + * @param string|null $locale + * @param string|null $timezone * @param string|null $pattern * @return string */ diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php b/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php index 047ca9d8b4528..a8b3fb1a81ffe 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php @@ -124,8 +124,8 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null); * @param string|\DateTimeInterface $date * @param int $dateType * @param int $timeType - * @param null $locale - * @param null $timezone + * @param string|null $locale + * @param string|null $timezone * @param string|null $pattern * @return string */ diff --git a/lib/internal/Magento/Framework/View/Model/Layout/Merge.php b/lib/internal/Magento/Framework/View/Model/Layout/Merge.php index 4d611c830e91a..06b00afe42ad9 100644 --- a/lib/internal/Magento/Framework/View/Model/Layout/Merge.php +++ b/lib/internal/Magento/Framework/View/Model/Layout/Merge.php @@ -431,6 +431,9 @@ public function load($handles = []) if ($result) { $this->addUpdate($result); $this->pageLayout = $this->_loadCache($cacheIdPageLayout); + foreach ($this->getHandles() as $handle) { + $this->allHandles[$handle] = $this->handleProcessed; + } return $this; } diff --git a/lib/web/css/docs/source/docs.less b/lib/web/css/docs/source/docs.less index 4039d0562da53..952beb5c0f970 100644 --- a/lib/web/css/docs/source/docs.less +++ b/lib/web/css/docs/source/docs.less @@ -21,7 +21,6 @@ @import '_icons.less'; @import '_loaders.less'; @import '_messages.less'; -//@import 'navigation.less'; @import '_layout.less'; @import '_pages.less'; @import '_popups.less'; diff --git a/lib/web/css/source/lib/_buttons.less b/lib/web/css/source/lib/_buttons.less index 804302fcb69ac..679c4b11fbaac 100644 --- a/lib/web/css/source/lib/_buttons.less +++ b/lib/web/css/source/lib/_buttons.less @@ -266,8 +266,7 @@ &.disabled, &[disabled], fieldset[disabled] & { - cursor: not-allowed; - pointer-events: none; // Disabling of clicks + pointer-events: none; // Disabling of all pointer events .lib-css(opacity, @button__disabled__opacity); } } diff --git a/lib/web/css/source/lib/_forms.less b/lib/web/css/source/lib/_forms.less index 800054e58c3dd..b1c7a49da4a7a 100644 --- a/lib/web/css/source/lib/_forms.less +++ b/lib/web/css/source/lib/_forms.less @@ -465,11 +465,9 @@ .lib-css(margin, @_margin); .lib-css(padding, @_padding); letter-spacing: -.31em; - //word-spacing: -.43em; > * { letter-spacing: normal; - //word-spacing: normal; } > .legend { diff --git a/lib/web/css/source/lib/_navigation.less b/lib/web/css/source/lib/_navigation.less index 6ed3a9671ab13..56aa2e7ef86b9 100644 --- a/lib/web/css/source/lib/_navigation.less +++ b/lib/web/css/source/lib/_navigation.less @@ -305,6 +305,10 @@ .lib-css(border-top, none); } + li.level1 { + position: relative; + } + .level0 { .lib-css(margin, @_nav-level0-item-margin); display: inline-block; diff --git a/lib/web/css/source/lib/variables/_forms.less b/lib/web/css/source/lib/variables/_forms.less index 69d0146fb3555..fff6141c67fd5 100644 --- a/lib/web/css/source/lib/variables/_forms.less +++ b/lib/web/css/source/lib/variables/_forms.less @@ -121,7 +121,7 @@ @select__disabled__font-style: @form-element-input__disabled__font-style; // Focus state -@select__focus__background: @form-element-input__focus__background; +@select__focus__background: false; @select__focus__border: @form-element-input__focus__border; @select__focus__color: @form-element-input__focus__color; @select__focus__font-style: @form-element-input__focus__font-style; diff --git a/lib/web/extjs/resources/css/ytheme-magento.css b/lib/web/extjs/resources/css/ytheme-magento.css index 7be66ddd5efe5..fa54395806264 100644 --- a/lib/web/extjs/resources/css/ytheme-magento.css +++ b/lib/web/extjs/resources/css/ytheme-magento.css @@ -15,7 +15,7 @@ background:url(../images/magento/loading_bg.gif) no-repeat #eae2ca; padding:85px 15px 15px 15px; font-size:14px; - font-weight:bold;; + font-weight:bold; color:#611B06; width:206px; text-align:center; diff --git a/lib/web/mage/dropdowns.js b/lib/web/mage/dropdowns.js index 6c1389924a24b..1496a1c65d957 100644 --- a/lib/web/mage/dropdowns.js +++ b/lib/web/mage/dropdowns.js @@ -127,11 +127,9 @@ define([ } elem.on('click.toggleDropdown', function () { - var el; + var el = actionElem; if (options.autoclose === true) { - el = actionElem; - actionElem = $(); $(document).trigger('click.hideDropdown'); actionElem = el; diff --git a/lib/web/mage/gallery/gallery.less b/lib/web/mage/gallery/gallery.less index 24a5a2b4033d3..8f4dd78979018 100644 --- a/lib/web/mage/gallery/gallery.less +++ b/lib/web/mage/gallery/gallery.less @@ -736,24 +736,30 @@ text-align: center; top: 0; z-index: @z-index-10; + overflow: hidden; + + .magnifier-large { + width: auto; + height: auto; + max-height: none; + max-width: none; + border: none; + position: absolute; + z-index: @z-index-1; + } } .magnifier-loader-text { margin-top: 10px; } -.magnifier-large { - position: absolute; - width: 32%; - z-index: @z-index-1; -} - .magnifier-preview { bottom: 0; left: 58%; overflow: hidden; padding: 0; position: absolute; + z-index: 2; top: 215px; &:not(.hidden) { background-color: @color-white; diff --git a/lib/web/mage/requirejs/resolver.js b/lib/web/mage/requirejs/resolver.js index 5088206dd31d9..6927a3205d94d 100644 --- a/lib/web/mage/requirejs/resolver.js +++ b/lib/web/mage/requirejs/resolver.js @@ -8,11 +8,11 @@ define([ ], function (_) { 'use strict'; - var context = require.s.contexts._, - execCb = context.execCb, - registry = context.registry, - callbacks = [], - retries = 10, + var context = require.s.contexts._, + execCb = context.execCb, + registry = context.registry, + callbacks = [], + retries = 10, updateDelay = 1, ready, update; @@ -28,13 +28,13 @@ define([ } /** - * Checks if provided module is rejected during load. + * Checks if provided module is registered after load. * * @param {Object} module - Module to be checked. * @return {Boolean} */ - function isRejected(module) { - return registry[module.id] && registry[module.id].error; + function isRegistered(module) { + return registry[module.id]; } /** @@ -48,7 +48,7 @@ define([ return false; } - return module.depCount > _.filter(module.depMaps, isRejected).length; + return module.depCount > _.filter(module.depMaps, isRegistered).length; } /** diff --git a/lib/web/magnifier/magnifier.js b/lib/web/magnifier/magnifier.js index c475364368922..150c8adf0b22b 100644 --- a/lib/web/magnifier/magnifier.js +++ b/lib/web/magnifier/magnifier.js @@ -9,101 +9,100 @@ var magnify = new Magnify($(this), options); - /*events must be tracked here*/ + /* events must be tracked here */ /** * Return that from _init function * */ return magnify; - }; function Magnify(element, options) { - var gOptions = options || {}, + var customUserOptions = options || {}, $box = $(element), $thumb, that = this, - largeWrapper = options.largeWrapper || '.magnifier-preview', - $largeWrapper = $(largeWrapper); + largeWrapper = options.largeWrapper || '.magnifier-preview', + $magnifierPreview = $(largeWrapper); curThumb = null, - currentOpts = { - x: 0, - y: 0, - w: 0, - h: 0, - lensW: 0, - lensH: 0, - lensBgX: 0, - lensBgY: 0, - largeW: 0, - largeH: 0, - largeL: 0, - largeT: 0, - zoom: 2, - zoomMin: 1.1, - zoomMax: 5, - mode: 'outside', - eventType: 'click', - status: 0, - zoomAttached: false, - zoomable: gOptions.zoomable !== undefined ? - gOptions.zoomable - : false, - onthumbenter: gOptions.onthumbenter !== undefined ? - gOptions.onthumbenter - : null, - onthumbmove: gOptions.onthumbmove !== undefined ? - gOptions.onthumbmove - : null, - onthumbleave: gOptions.onthumbleave !== undefined ? - gOptions.onthumbleave - : null, - onzoom: gOptions.onzoom !== undefined ? - gOptions.onzoom - : null - }, - pos = { - t: 0, - l: 0, - x: 0, - y: 0 - }, - gId = 0, - status = 0, - curIdx = '', - curLens = null, - curLarge = null, - lensbg = gOptions.bg !== undefined ? gOptions.lensbg : true, - gZoom = gOptions.zoom !== undefined ? - gOptions.zoom - : currentOpts.zoom, - gZoomMin = gOptions.zoomMin !== undefined ? - gOptions.zoomMin - : currentOpts.zoomMin, - gZoomMax = gOptions.zoomMax !== undefined ? - gOptions.zoomMax - : currentOpts.zoomMax, - gMode = gOptions.mode || currentOpts.mode, - gEventType = gOptions.eventType || currentOpts.eventType, - data = {}, - inBounds = false, - isOverThumb = false, - rate = 1, - paddingX = 0, - paddingY = 0, - enabled = true, - showWrapper = true; + magnifierOptions = { + x: 0, + y: 0, + w: 0, + h: 0, + lensW: 0, + lensH: 0, + lensBgX: 0, + lensBgY: 0, + largeW: 0, + largeH: 0, + largeL: 0, + largeT: 0, + zoom: 2, + zoomMin: 1.1, + zoomMax: 5, + mode: 'outside', + eventType: 'click', + status: 0, + zoomAttached: false, + zoomable: customUserOptions.zoomable !== undefined ? + customUserOptions.zoomable + : false, + onthumbenter: customUserOptions.onthumbenter !== undefined ? + customUserOptions.onthumbenter + : null, + onthumbmove: customUserOptions.onthumbmove !== undefined ? + customUserOptions.onthumbmove + : null, + onthumbleave: customUserOptions.onthumbleave !== undefined ? + customUserOptions.onthumbleave + : null, + onzoom: customUserOptions.onzoom !== undefined ? + customUserOptions.onzoom + : null + }, + pos = { + t: 0, + l: 0, + x: 0, + y: 0 + }, + gId = 0, + status = 0, + curIdx = '', + curLens = null, + curLarge = null, + lensbg = customUserOptions.bg !== undefined ? + customUserOptions.lensbg + : true, + gZoom = customUserOptions.zoom !== undefined ? + customUserOptions.zoom + : magnifierOptions.zoom, + gZoomMin = customUserOptions.zoomMin !== undefined ? + customUserOptions.zoomMin + : magnifierOptions.zoomMin, + gZoomMax = customUserOptions.zoomMax !== undefined ? + customUserOptions.zoomMax + : magnifierOptions.zoomMax, + gMode = customUserOptions.mode || magnifierOptions.mode, + gEventType = customUserOptions.eventType || magnifierOptions.eventType, + data = {}, + inBounds = false, + isOverThumb = false, + rate = 1, + paddingX = 0, + paddingY = 0, + enabled = true, + showWrapper = true; var MagnifyCls = { magnifyHidden: 'magnify-hidden', magnifyOpaque: 'magnify-opaque', magnifyFull: 'magnify-fullimage' - }; - /** * Update Lens positon on. * @@ -143,105 +142,104 @@ $(thumb).parent().append(lens); } - function updateLensOnLoad(idx, thumb, large, largeWrapper) { - var lens = $box.find('.magnify-lens'), + function updateLensOnLoad(idSelectorMainImg, thumb, largeImgInMagnifyLens, largeWrapper) { + var magnifyLensElement= $box.find('.magnify-lens'), textWrapper; - if (data[idx].status === 1) { + if (data[idSelectorMainImg].status === 1) { textWrapper = $('
'); - lens.className = 'magnifier-loader magnify-hidden'; + magnifyLensElement.className = 'magnifier-loader magnify-hidden'; textWrapper.html('Loading...'); - lens.html('').append(textWrapper); - } else if (data[idx].status === 2) { - lens.addClass(MagnifyCls.magnifyHidden); - lens.html(''); - large.id = idx + '-large'; - large.style.width = data[idx].largeW * rate + 'px'; - large.style.height = data[idx].largeH + 'px'; - large.className = 'magnifier-large magnify-hidden'; - - if (data[idx].mode === 'inside') { - lens.append(large); + magnifyLensElement.html('').append(textWrapper); + } else if (data[idSelectorMainImg].status === 2) { + magnifyLensElement.addClass(MagnifyCls.magnifyHidden); + magnifyLensElement.html(''); + + largeImgInMagnifyLens.id = idSelectorMainImg + '-large'; + largeImgInMagnifyLens.style.width = data[idSelectorMainImg].largeImgInMagnifyLensWidth + 'px'; + largeImgInMagnifyLens.style.height = data[idSelectorMainImg].largeImgInMagnifyLensHeight + 'px'; + largeImgInMagnifyLens.className = 'magnifier-large magnify-hidden'; + + if (data[idSelectorMainImg].mode === 'inside') { + magnifyLensElement.append(largeImgInMagnifyLens); } else { - largeWrapper.html('').append(large); + largeWrapper.html('').append(largeImgInMagnifyLens); } } - data[idx].lensH = data[idx].lensH > $thumb.height() ? $thumb.height() : data[idx].lensH; + data[idSelectorMainImg].lensH = data[idSelectorMainImg].lensH > $thumb.height() ? $thumb.height() : data[idSelectorMainImg].lensH; - if (Math.round(data[idx].lensW) === 0) { - lens.css('display', 'none'); + if (Math.round(data[idSelectorMainImg].lensW) === 0) { + magnifyLensElement.css('display', 'none'); } else { - lens.css({ - width: data[idx].lensW + 1 + 'px', - height: data[idx].lensH - 1 + 'px', + magnifyLensElement.css({ + width: Math.round(data[idSelectorMainImg].lensW) + 'px', + height: Math.round(data[idSelectorMainImg].lensH) + 'px', display: '' }); } } function getMousePos() { - var xPos = pos.x - currentOpts.x, - yPos = pos.y - currentOpts.y, + var xPos = pos.x - magnifierOptions.x, + yPos = pos.y - magnifierOptions.y, t, l; - inBounds = xPos < 0 || yPos < 0 || xPos > currentOpts.w || yPos > currentOpts.h ? false : true; + inBounds = xPos < 0 || yPos < 0 || xPos > magnifierOptions.w || yPos > magnifierOptions.h ? false : true; - l = xPos - currentOpts.lensW / 2; - t = yPos - currentOpts.lensH / 2; + l = xPos - magnifierOptions.lensW / 2; + t = yPos - magnifierOptions.lensH / 2; - if (currentOpts.mode !== 'inside') { - if (xPos < currentOpts.lensW / 2) { - l = 0; - } + if (xPos < magnifierOptions.lensW / 2) { + l = 0; + } - if (yPos < currentOpts.lensH / 2) { - t = 0; - } + if (yPos < magnifierOptions.lensH / 2) { + t = 0; + } - if (xPos - currentOpts.w + Math.ceil(currentOpts.lensW / 2) > 0) { - l = currentOpts.w - Math.ceil(currentOpts.lensW + 2); - } + if (xPos - magnifierOptions.w + Math.ceil(magnifierOptions.lensW / 2) > 0) { + l = magnifierOptions.w - Math.ceil(magnifierOptions.lensW + 2); + } - if (yPos - currentOpts.h + Math.ceil(currentOpts.lensH / 2) > 0) { - t = currentOpts.h - Math.ceil(currentOpts.lensH); - } + if (yPos - magnifierOptions.h + Math.ceil(magnifierOptions.lensH / 2) > 0) { + t = magnifierOptions.h - Math.ceil(magnifierOptions.lensH); + } - pos.l = l; - pos.t = t; + pos.l = l; + pos.t = t; - currentOpts.lensBgX = pos.l; - currentOpts.lensBgY = pos.t; + magnifierOptions.lensBgX = pos.l; + magnifierOptions.lensBgY = pos.t; - if (currentOpts.mode === 'inside') { - currentOpts.largeL = xPos * (currentOpts.zoom - currentOpts.lensW / currentOpts.w); - currentOpts.largeT = yPos * (currentOpts.zoom - currentOpts.lensH / currentOpts.h); - } else { - currentOpts.largeL = currentOpts.lensBgX * currentOpts.zoom * (currentOpts.largeWrapperW / currentOpts.w) * rate; - currentOpts.largeT = currentOpts.lensBgY * currentOpts.zoom * (currentOpts.largeWrapperH / currentOpts.h); - } + if (magnifierOptions.mode === 'inside') { + magnifierOptions.largeL = Math.round(xPos * (magnifierOptions.zoom - magnifierOptions.lensW / magnifierOptions.w)); + magnifierOptions.largeT = Math.round(yPos * (magnifierOptions.zoom - magnifierOptions.lensH / magnifierOptions.h)); + } else { + magnifierOptions.largeL = Math.round(magnifierOptions.lensBgX * magnifierOptions.zoom * (magnifierOptions.largeWrapperW / magnifierOptions.w)); + magnifierOptions.largeT = Math.round(magnifierOptions.lensBgY * magnifierOptions.zoom * (magnifierOptions.largeWrapperH / magnifierOptions.h)); } } function onThumbEnter() { if (_toBoolean(enabled)) { - currentOpts = data[curIdx]; + magnifierOptions = data[curIdx]; curLens = $box.find('.magnify-lens'); - if (currentOpts.status === 2) { + if (magnifierOptions.status === 2) { curLens.removeClass(MagnifyCls.magnifyOpaque); curLarge = $('#' + curIdx + '-large'); curLarge.removeClass(MagnifyCls.magnifyHidden); - } else if (currentOpts.status === 1) { + } else if (magnifierOptions.status === 1) { curLens.className = 'magnifier-loader'; } } } function onThumbLeave() { - if (currentOpts.status > 0) { - var handler = currentOpts.onthumbleave; + if (magnifierOptions.status > 0) { + var handler = magnifierOptions.onthumbleave; if (handler !== null) { handler({ @@ -266,28 +264,30 @@ function move() { if (_toBoolean(enabled)) { - if (status !== currentOpts.status) { + if (status !== magnifierOptions.status) { onThumbEnter(); } - if (currentOpts.status > 0) { - curThumb.className = currentOpts.thumbCssClass + ' magnify-opaque'; + if (magnifierOptions.status > 0) { + curThumb.className = magnifierOptions.thumbCssClass + ' magnify-opaque'; - if (currentOpts.status === 1) { + if (magnifierOptions.status === 1) { curLens.className = 'magnifier-loader'; - } else if (currentOpts.status === 2) { + } else if (magnifierOptions.status === 2) { curLens.removeClass(MagnifyCls.magnifyHidden); curLarge.removeClass(MagnifyCls.magnifyHidden); curLarge.css({ - left: '-' + currentOpts.largeL + 'px', - top: '-' + currentOpts.largeT + 'px' + left: '-' + magnifierOptions.largeL + 'px', + top: '-' + magnifierOptions.largeT + 'px' }); } - pos.t = pos.t <= 0 ? 0 : pos.t; + var borderOffset = 2; // Offset for magnify-lens border + pos.t = pos.t <= 0 ? 0 : pos.t - borderOffset; + curLens.css({ left: pos.l + paddingX + 'px', - top: pos.t + 1 + paddingY + 'px' + top: pos.t + paddingY + 'px' }); if (lensbg) { @@ -296,10 +296,10 @@ }); } else { curLens.get(0).style.backgroundPosition = '-' + - currentOpts.lensBgX + 'px -' + - currentOpts.lensBgY + 'px'; + magnifierOptions.lensBgX + 'px -' + + magnifierOptions.lensBgY + 'px'; } - var handler = currentOpts.onthumbmove; + var handler = magnifierOptions.onthumbmove; if (handler !== null) { handler({ @@ -312,33 +312,33 @@ } } - status = currentOpts.status; + status = magnifierOptions.status; } } - function setThumbData(thumb, thumbData) { - var thumbBounds = thumb.getBoundingClientRect(), + function setThumbData(mainImage, mainImageData) { + var thumbBounds = mainImage.getBoundingClientRect(), w = 0, h = 0; - thumbData.x = thumbBounds.left; - thumbData.y = thumbBounds.top; - thumbData.w = thumbBounds.right - thumbData.x; - thumbData.h = thumbBounds.bottom - thumbData.y; + mainImageData.x = Math.round(thumbBounds.left); + mainImageData.y = Math.round(thumbBounds.top); + mainImageData.w = Math.round(thumbBounds.right - mainImageData.x); + mainImageData.h = Math.round(thumbBounds.bottom - mainImageData.y); - if (thumbData.mode === 'inside') { - w = thumbData.w; - h = thumbData.h; + if (mainImageData.mode === 'inside') { + w = mainImageData.w; + h = mainImageData.h; } else { - w = thumbData.largeWrapperW; - h = thumbData.largeWrapperH; + w = mainImageData.largeWrapperW; + h = mainImageData.largeWrapperH; } - thumbData.largeW = thumbData.zoom * w; - thumbData.largeH = thumbData.zoom * h; + mainImageData.largeImgInMagnifyLensWidth = Math.round(mainImageData.zoom * w); + mainImageData.largeImgInMagnifyLensHeight = Math.round(mainImageData.zoom * h); - thumbData.lensW = thumbData.w / thumbData.zoom / rate; - thumbData.lensH = thumbData.h / thumbData.zoom; + mainImageData.lensW = Math.round(mainImageData.w / mainImageData.zoom); + mainImageData.lensH = Math.round(mainImageData.h / mainImageData.zoom); } function _init($box, options) { @@ -360,11 +360,11 @@ if (_toBoolean(enabled)) { - $largeWrapper.show().css('display', ''); - $largeWrapper.addClass(MagnifyCls.magnifyHidden); + $magnifierPreview.show().css('display', ''); + $magnifierPreview.addClass(MagnifyCls.magnifyHidden); set(opts); } else { - $largeWrapper.empty().hide(); + $magnifierPreview.empty().hide(); } } @@ -376,7 +376,7 @@ if (showWrapper) { - if (currentOpts.status !== 0) { + if (magnifierOptions.status !== 0) { onThumbLeave(); } handleEvents(e); @@ -390,7 +390,7 @@ if (showWrapper) { if (!isOverThumb) { - if (currentOpts.status !== 0) { + if (magnifierOptions.status !== 0) { onThumbLeave(); } handleEvents(e); @@ -420,7 +420,7 @@ onThumbEnter(src); - setThumbData(curThumb, currentOpts); + setThumbData(curThumb, magnifierOptions); pos.x = e.clientX; pos.y = e.clientY; @@ -428,7 +428,7 @@ getMousePos(); move(); - var handler = currentOpts.onthumbenter; + var handler = magnifierOptions.onthumbenter; if (handler !== null) { handler({ @@ -462,15 +462,15 @@ eventType = options.eventType || thumb.getAttribute('data-eventType') || gEventType, onthumbenter = options.onthumbenter !== undefined ? options.onthumbenter - : currentOpts.onthumbenter, + : magnifierOptions.onthumbenter, onthumbleave = options.onthumbleave !== undefined ? options.onthumbleave - : currentOpts.onthumbleave, + : magnifierOptions.onthumbleave, onthumbmove = options.onthumbmove !== undefined ? options.onthumbmove - : currentOpts.onthumbmove; + : magnifierOptions.onthumbmove; - largeUrl = $thumb.data('original') || gOptions.full || $thumb.attr('src'); + largeUrl = $thumb.data('original') || customUserOptions.full || $thumb.attr('src'); if (thumb.id === '') { idx = thumb.id = 'magnifier-item-' + gId; @@ -529,7 +529,6 @@ onthumbmove: onthumbmove }; - rate = $thumb.width() / $thumb.height() / (data[idx].largeWrapperW / data[idx].largeWrapperH); paddingX = ($thumb.parent().width() - $thumb.width()) / 2; paddingY = ($thumb.parent().height() - $thumb.height()) / 2; @@ -556,7 +555,6 @@ } function onMousemove(e) { - pos.x = e.clientX; pos.y = e.clientY; @@ -567,29 +565,30 @@ } if (inBounds && isOverThumb) { - $largeWrapper.removeClass(MagnifyCls.magnifyHidden); + if(gMode === 'outside'){ + $magnifierPreview.removeClass(MagnifyCls.magnifyHidden); + } move(); } else { onThumbLeave(); isOverThumb = false; - $largeWrapper.addClass(MagnifyCls.magnifyHidden); + $magnifierPreview.addClass(MagnifyCls.magnifyHidden); } } function onScroll() { if (curThumb !== null) { - setThumbData(curThumb, currentOpts); + setThumbData(curThumb, magnifierOptions); } } $(window).on('scroll', onScroll); $(window).resize(function () { - _init($box, gOptions); + _init($box, customUserOptions); }); $box.on('mousemove', onMousemove); - _init($box, gOptions); - + _init($box, customUserOptions); } }(jQuery)); diff --git a/setup/pub/angular-sanitize/angular-sanitize.js b/setup/pub/angular-sanitize/angular-sanitize.js index b7ec2820dd7fe..6004460cd17eb 100644 --- a/setup/pub/angular-sanitize/angular-sanitize.js +++ b/setup/pub/angular-sanitize/angular-sanitize.js @@ -159,7 +159,7 @@ END_TAG_REGEXP = /^<\s*\/\s*([\w:-]+)[^>]*>/, ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, BEGIN_TAG_REGEXP = /^/g, DOCTYPE_REGEXP = /]*?)>/i, CDATA_REGEXP = //g, @@ -260,7 +260,7 @@ chars = false; } // end tag - } else if ( BEGING_END_TAGE_REGEXP.test(html) ) { + } else if ( BEGIN_END_TAGE_REGEXP.test(html) ) { match = html.match( END_TAG_REGEXP ); if ( match ) { diff --git a/setup/pub/angular-sanitize/angular-sanitize.min.js.map b/setup/pub/angular-sanitize/angular-sanitize.min.js.map index 0c993a6ed2afb..0310ddce9c937 100644 --- a/setup/pub/angular-sanitize/angular-sanitize.min.js.map +++ b/setup/pub/angular-sanitize/angular-sanitize.min.js.map @@ -4,5 +4,5 @@ "lineCount":13, "mappings":"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", "sources":["angular-sanitize.js"], -"names":["window","angular","undefined","sanitizeText","chars","buf","htmlSanitizeWriter","writer","noop","join","makeMap","str","obj","items","split","i","length","htmlParser","html","handler","parseStartTag","tag","tagName","rest","unary","lowercase","blockElements","stack","last","inlineElements","parseEndTag","optionalEndTagElements","voidElements","push","attrs","replace","ATTR_REGEXP","match","name","doubleQuotedValue","singleQuotedValue","unquotedValue","decodeEntities","start","pos","end","index","stack.last","specialElements","RegExp","all","text","COMMENT_REGEXP","CDATA_REGEXP","indexOf","lastIndexOf","comment","substring","DOCTYPE_REGEXP","test","BEGING_END_TAGE_REGEXP","END_TAG_REGEXP","BEGIN_TAG_REGEXP","START_TAG_REGEXP","$sanitizeMinErr","value","parts","spaceRe","exec","spaceBefore","spaceAfter","content","hiddenPre","innerHTML","textContent","innerText","encodeEntities","NON_ALPHANUMERIC_REGEXP","charCodeAt","uriValidator","ignore","out","bind","validElements","forEach","key","lkey","isImage","validAttrs","uriAttrs","$$minErr","optionalEndTagBlockElements","optionalEndTagInlineElements","extend","document","createElement","module","provider","$SanitizeProvider","$get","$$sanitizeUri","uri","filter","$sanitize","LINKY_URL_REGEXP","MAILTO_REGEXP","target","addText","addLink","url","isDefined","raw","substr"] +"names":["window","angular","undefined","sanitizeText","chars","buf","htmlSanitizeWriter","writer","noop","join","makeMap","str","obj","items","split","i","length","htmlParser","html","handler","parseStartTag","tag","tagName","rest","unary","lowercase","blockElements","stack","last","inlineElements","parseEndTag","optionalEndTagElements","voidElements","push","attrs","replace","ATTR_REGEXP","match","name","doubleQuotedValue","singleQuotedValue","unquotedValue","decodeEntities","start","pos","end","index","stack.last","specialElements","RegExp","all","text","COMMENT_REGEXP","CDATA_REGEXP","indexOf","lastIndexOf","comment","substring","DOCTYPE_REGEXP","test","BEGIN_END_TAGE_REGEXP","END_TAG_REGEXP","BEGIN_TAG_REGEXP","START_TAG_REGEXP","$sanitizeMinErr","value","parts","spaceRe","exec","spaceBefore","spaceAfter","content","hiddenPre","innerHTML","textContent","innerText","encodeEntities","NON_ALPHANUMERIC_REGEXP","charCodeAt","uriValidator","ignore","out","bind","validElements","forEach","key","lkey","isImage","validAttrs","uriAttrs","$$minErr","optionalEndTagBlockElements","optionalEndTagInlineElements","extend","document","createElement","module","provider","$SanitizeProvider","$get","$$sanitizeUri","uri","filter","$sanitize","LINKY_URL_REGEXP","MAILTO_REGEXP","target","addText","addLink","url","isDefined","raw","substr"] } \ No newline at end of file