Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #19355: [Backport] Changed get product way in blocks with related products (by @gelanivishal)
 - #19357: [Backport] #13157 - Last Ordered Items block - bad js code (by @gelanivishal)
 - #19296: Fix issue 19286 - Wrong pager style (by @speedy008)
 - #18621: 18615 updates structure for last_trans_id to be varchar 255 which is � (by @iancassidyweb)
 - #14485: Fix for Issue #4136, MAGETWO-53440 (by @vasilii-b)
 - #18905: Fix the issue with missing asterisk for admin required fields (by @dmytro-ch)


Fixed GitHub Issues:
 - #13157: Last Ordered Items block - bad js code  (reported by @Eytham) has been fixed in #19357 by @gelanivishal in 2.2-develop branch
   Related commits:
     1. 7559e3e
     2. 58550b9
     3. f1bb98e

 - #19286: Wrong pager style (reported by @gujjwal00) has been fixed in #19296 by @speedy008 in 2.2-develop branch
   Related commits:
     1. 301d73d
     2. 7c013a1
     3. 584242c
     4. ee0bae8

 - #18615: Field restriction incompatibilities between klarna_core_order and sales_order_payment last_trans_id (reported by @iancassidyweb) has been fixed in #18621 by @iancassidyweb in 2.2-develop branch
   Related commits:
     1. 172ecf6
     2. 3590785
     3. 6d33140
     4. dd753a1

 - #4136: Widget condition with unexpected character not preventing from saving (reported by @devhn) has been fixed in #14485 by @vasilii-b in 2.2-develop branch
   Related commits:
     1. cc1e013
     2. ff4b005
     3. 6c87bb3
     4. 1d1d061

 - #18904: Missing asterisk for admin required fields (reported by @dmytro-ch) has been fixed in #18905 by @dmytro-ch in 2.2-develop branch
   Related commits:
     1. 38bfe66
     2. 7d2dd65
     3. 4f07c61
magento-engcom-team authored Nov 24, 2018
2 parents 97b98cc + e1650f2 commit c59e602
Showing 26 changed files with 148 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
*/
protected function _prepareData()
{
$product = $this->_coreRegistry->registry('product');
$product = $this->getProduct();
/* @var $product \Magento\Catalog\Model\Product */

$this->_itemCollection = $product->getCrossSellProductCollection()->addAttributeToSelect(
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ public function __construct(
*/
protected function _prepareData()
{
$product = $this->_coreRegistry->registry('product');
$product = $this->getProduct();
/* @var $product \Magento\Catalog\Model\Product */

$this->_itemCollection = $product->getRelatedProductCollection()->addAttributeToSelect(
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ public function __construct(
*/
protected function _prepareData()
{
$product = $this->_coreRegistry->registry('product');
$product = $this->getProduct();
/* @var $product \Magento\Catalog\Model\Product */
$this->_itemCollection = $product->getUpSellProductCollection()->setPositionOrder()->addStoreFilter();
if ($this->moduleManager->isEnabled('Magento_Checkout')) {
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Controller/Product/Compare.php
Original file line number Diff line number Diff line change
@@ -141,10 +141,10 @@ public function setCustomerId($customerId)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function execute()
{
return $this->_redirect('catalog/product_compare');
return $this->resultRedirectFactory->create()->setPath('catalog/product_compare');
}
}
Original file line number Diff line number Diff line change
@@ -18,6 +18,6 @@
</section>
<section name="AdminModifyAttributesSection">
<!-- Parameter is the attribute name -->
<element name="dropDownAttributeByName" type="select" selector="//*[text()='{{attributeName}}']/../..//select" parameterized="true"/>
<element name="dropDownAttributeByName" type="select" selector="//*[text()='{{attributeName}}']/../../..//select" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@
<element name="useDefaultOptionTitle" type="text" selector="[data-index='options'] tr.data-row [data-index='title'] [name^='options_use_default']"/>
<element name="useDefaultOptionValueTitleByIndex" type="text" selector="[data-index='options'] [data-index='values'] tr[data-repeat-index='{{var1}}'] [name^='options_use_default']" parameterized="true"/>
<element name="addOptionBtn" type="button" selector="button[data-index='button_add']"/>
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Title']/parent::span/parent::div//input[@class='admin__control-text']" parameterized="true"/>
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//label[text()='Option Type']/parent::span/parent::div//div[@data-role='selected-option']" parameterized="true"/>
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/ancestor::div[@class='fieldset-wrapper-title']/following-sibling::div[@data-role='collapsible-content']//div[@data-index='type']//div[contains(@class, 'action-menu')]//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
<element name="fillOptionTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Title']/parent::label/parent::div/parent::div//input[@class='admin__control-text']" parameterized="true"/>
<element name="checkSelect" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//span[text()='Option Type']/parent::label/parent::div/parent::div//div[@data-role='selected-option']" parameterized="true"/>
<element name="checkDropDown" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//parent::label/parent::div/parent::div//li[@class='admin__action-multiselect-menu-inner-item']//label[text()='Drop-down']" parameterized="true"/>
<element name="clickAddValue" type="button" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tfoot//button" parameterized="true"/>
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//label[text()='Title']/parent::span/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
<element name="fillOptionValueTitle" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Title']/parent::label/parent::div/parent::div//div[@class='admin__field-control']/input" parameterized="true"/>
<element name="fillOptionValuePrice" type="input" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody/tr[@data-repeat-index='{{var2}}']//span[text()='Price']/parent::label/parent::div//div[@class='admin__control-addon']/input" parameterized="true"/>
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//label[text()='Price Type']/parent::span/parent::div//select" parameterized="true"/>
<element name="clickSelectPriceType" type="select" selector="//span[text()='{{var1}}']/parent::div/parent::div/parent::div//tbody//tr[@data-repeat-index='{{var2}}']//span[text()='Price Type']/parent::label/parent::div/parent::div//select" parameterized="true"/>
<!-- Elements that make it easier to select the most recently added element -->
<element name="lastOptionTitle" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[contains(@class, '_required')]//input" />
<element name="lastOptionTypeParent" type="block" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr[last()]//*[contains(@class, 'admin__action-multiselect-text')]" />
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@
<element name="productName" type="input" selector=".admin__field[data-index=name] input"/>
<element name="productNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
<element name="productSku" type="input" selector=".admin__field[data-index=sku] input"/>
<element name="enableProductAttributeLabel" type="text" selector="[data-index='status'] .admin__field-label label"/>
<element name="enableProductAttributeLabelWrapper" type="text" selector="[data-index='status'] .admin__field-label"/>
<element name="enableProductAttributeLabel" type="text" selector="//span[text()='Enable Product']/parent::label"/>
<element name="enableProductAttributeLabelWrapper" type="text" selector="//span[text()='Enable Product']/parent::label/parent::div"/>
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
@@ -33,7 +33,7 @@
<element name="visibilityUseDefault" type="checkbox" selector="//input[@name='use_default[visibility]']"/>
<element name="divByDataIndex" type="input" selector="div[data-index='{{var}}']" parameterized="true"/>
<element name="attributeSetSearchCount" type="text" selector="div[data-index='attribute_set_id'] .admin__action-multiselect-search-count"/>
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//label[text()='{{attributeLabel}}']" parameterized="true"/>
<element name="attributeLabelByText" type="text" selector="//*[@class='admin__field']//span[text()='{{attributeLabel}}']" parameterized="true"/>
<element name="addAttributeBtn" type="button" selector="#addAttribute"/>
<element name="attributeSetFilterResultByName" type="text" selector="//label/span[text() = '{{var}}']" timeout="30" parameterized="true"/>
<element name="attributeSetDropDown" type="select" selector="div[data-index='attribute_set_id'] .action-select.admin__action-multiselect"/>
3 changes: 3 additions & 0 deletions app/code/Magento/Rule/Model/Condition/AbstractCondition.php
Original file line number Diff line number Diff line change
@@ -615,6 +615,9 @@ public function getValueElement()
// date format intentionally hard-coded
$elementParams['input_format'] = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
$elementParams['date_format'] = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
$elementParams['placeholder'] = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
$elementParams['autocomplete'] = 'off';
$elementParams['readonly'] = 'true';
}
return $this->getForm()->addField(
$this->getPrefix() . '__' . $this->getId() . '__value',
2 changes: 2 additions & 0 deletions app/code/Magento/Rule/view/adminhtml/web/rules.js
Original file line number Diff line number Diff line change
@@ -220,6 +220,8 @@ define([

var elem = Element.down(elemContainer, 'input.input-text');

jQuery(elem).trigger('contentUpdated');

if (elem) {
elem.focus();

20 changes: 20 additions & 0 deletions app/code/Magento/Sales/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
@@ -109,6 +109,9 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
if (version_compare($context->getVersion(), '2.0.10', '<')) {
$this->expandRemoteIpField($installer);
}
if (version_compare($context->getVersion(), '2.0.11', '<')) {
$this->expandLastTransIdField($installer);
}
}

/**
@@ -161,4 +164,21 @@ private function expandRemoteIpField(SchemaSetupInterface $installer)
]
);
}

/**
* @param SchemaSetupInterface $installer
* @return void
*/
private function expandLastTransIdField(SchemaSetupInterface $installer)
{
$connection = $installer->getConnection(self::$connectionName);
$connection->modifyColumn(
$installer->getTable('sales_order_payment', self::$connectionName),
'last_trans_id',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'length' => 255
]
);
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/etc/module.xml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Sales" setup_version="2.0.10">
<module name="Magento_Sales" setup_version="2.0.11">
<sequence>
<module name="Magento_Rule"/>
<module name="Magento_Catalog"/>
Original file line number Diff line number Diff line change
@@ -26,14 +26,18 @@
<ol id="cart-sidebar-reorder" class="product-items product-items-names"
data-bind="foreach: lastOrderedItems().items">
<li class="product-item">
<div class="field item choice no-display" data-bind="css: {'no-display': !is_saleable}">
<div class="field item choice">
<label class="label" data-bind="attr: {'for': 'reorder-item-' + id}">
<span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
</label>
<div class="control">
<input type="checkbox" name="order_items[]"
data-bind="attr: {id: 'reorder-item-' + id, value: id}"
title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>"
data-bind="attr: {
id: 'reorder-item-' + id,
value: id,
title: is_saleable ? '<?= /* @escapeNotVerified */ __('Add to Cart') ?>' : '<?= /* @escapeNotVerified */ __('Product is not salable.') ?>'
},
disable: !is_saleable"
class="checkbox" data-validate='{"validate-one-checkbox-required-by-name": true}'/>
</div>
</div>
@@ -46,8 +50,8 @@
</ol>
<div id="cart-sidebar-reorder-advice-container"></div>
<div class="actions-toolbar">
<div class="primary no-display"
data-bind="css: {'no-display': !lastOrderedItems().isShowAddToCart}">
<div class="primary"
data-bind="visible: isShowAddToCart">
<button type="submit" title="<?= /* @escapeNotVerified */ __('Add to Cart') ?>" class="action tocart primary">
<span><?= /* @escapeNotVerified */ __('Add to Cart') ?></span>
</button>
Original file line number Diff line number Diff line change
@@ -5,27 +5,43 @@

define([
'uiComponent',
'Magento_Customer/js/customer-data'
], function (Component, customerData) {
'Magento_Customer/js/customer-data',
'underscore'
], function (Component, customerData, _) {
'use strict';

return Component.extend({
defaults: {
isShowAddToCart: false
},

/** @inheritdoc */
initialize: function () {
var isShowAddToCart = false,
item;

this._super();
this.lastOrderedItems = customerData.get('last-ordered-items');
this.lastOrderedItems.subscribe(this.checkSalableItems.bind(this));
this.checkSalableItems();

return this;
},

/** @inheritdoc */
initObservable: function () {
this._super()
.observe('isShowAddToCart');

return this;
},

for (item in this.lastOrderedItems.items) {
if (item['is_saleable']) {
isShowAddToCart = true;
break;
}
}
/**
* Check if items is_saleable and change add to cart button visibility.
*/
checkSalableItems: function () {
var isShowAddToCart = _.some(this.lastOrderedItems().items, {
'is_saleable': true
});

this.lastOrderedItems.isShowAddToCart = isShowAddToCart;
this.isShowAddToCart(isShowAddToCart);
}
});
});
8 changes: 5 additions & 3 deletions app/code/Magento/Ui/view/base/web/templates/form/field.html
Original file line number Diff line number Diff line change
@@ -8,9 +8,11 @@
visible="visible"
css="$data.additionalClasses"
attr="'data-index': index">
<span class="admin__field-label" if="$data.label" visible="$data.labelVisible">
<label translate="label" attr="'data-config-scope': $data.scopeLabel, for: uid"/>
</span>
<div class="admin__field-label">
<label if="$data.label" visible="$data.labelVisible" attr="for: uid">
<span translate="label" attr="'data-config-scope': $data.scopeLabel" />
</label>
</div>
<div class="admin__field-control"
css="'_with-tooltip': $data.tooltip, '_with-reset': $data.showFallbackReset && $data.isDifferedFromDefault">
<render args="elementTmpl" ifnot="hasAddons()"/>
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@
&._required {
> .admin__field-label {
span {
padding-left: 1.5rem;

&:after {
left: 0;
margin-left: @temp_gutter;
Original file line number Diff line number Diff line change
@@ -221,7 +221,7 @@
overflow: hidden;
}

label {
span {
display: inline-block;
line-height: @field-label__line-height;
vertical-align: middle;
@@ -239,7 +239,7 @@

.required > &, // ToDo UI: change classes 'required' to '_required'.
._required > & {
> label {
span {
&:after {
color: @validation__color;
content: '*';
@@ -526,7 +526,7 @@
position: absolute;
top: 0;

label {
span {
&:before {
display: block;
}
@@ -541,7 +541,7 @@
}

& > .admin__field-label {
label {
span {
&:before {
display: none;
}
20 changes: 20 additions & 0 deletions app/design/adminhtml/Magento/backend/web/css/styles-old.less
Original file line number Diff line number Diff line change
@@ -3845,6 +3845,26 @@

.rule-param-edit .element {
display: inline;
position: relative;
}

.rule-param-edit .element input.input-date,
.rule-param-edit .element input.input-date[readonly] {
background-color: @color-white;
min-width: 140px;
width: 140px !important;
cursor: pointer;
text-align: center;
opacity: 1;
margin-right: 10px;
padding-right: 40px;

+ .ui-datepicker-trigger {
position: absolute;
width: 140px;
text-align: right;
left: 0;
}
}

.rule-param-edit .element .addafter {
4 changes: 4 additions & 0 deletions app/design/frontend/Magento/luma/web/css/source/_extends.less
Original file line number Diff line number Diff line change
@@ -1506,6 +1506,10 @@
position: relative;
z-index: 1;
}
.limiter {
display: inline-block;
float: right;
}

.toolbar-amount {
.lib-css(line-height, @pager__line-height);
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@

namespace Magento\Mtf\Client\Element;

use Magento\Mtf\ObjectManager;
use Magento\Mtf\Client\Locator;
use Magento\Mtf\Client\ElementInterface;
use Magento\Mtf\Client\Locator;
use Magento\Mtf\ObjectManager;

/**
* Typified element class for conditions.
@@ -135,6 +135,13 @@ class ConditionsElement extends SimpleElement
*/
protected $chooserGridLocator = 'div[id*=chooser]';

/**
* Datepicker xpath.
*
* @var string
*/
private $datepicker = './/*[contains(@class,"ui-datepicker-trigger")]';

/**
* Key of last find param.
*
@@ -189,10 +196,7 @@ class ConditionsElement extends SimpleElement
protected $exception;

/**
* Set value to conditions.
*
* @param string $value
* @return void
* @inheritdoc
*/
public function setValue($value)
{
@@ -411,7 +415,16 @@ protected function fillText($rule, ElementInterface $param)
{
$value = $param->find('input', Locator::SELECTOR_TAG_NAME);
if ($value->isVisible()) {
$value->setValue($rule);
if (!$value->getAttribute('readonly')) {
$value->setValue($rule);
} else {
$datepicker = $param->find(
$this->datepicker,
Locator::SELECTOR_XPATH,
DatepickerElement::class
);
$datepicker->setValue($rule);
}

$apply = $param->find('.//*[@class="rule-param-apply"]', Locator::SELECTOR_XPATH);
if ($apply->isVisible()) {
Loading

0 comments on commit c59e602

Please sign in to comment.