Skip to content

Commit

Permalink
Merge pull request #4893 from magento-engcom/2.3-develop-fast-lane-prs
Browse files Browse the repository at this point in the history
[Magento Community Engineering] Community Contributions - 2.3-develop latest changes
  • Loading branch information
VladimirZaets authored Oct 15, 2019
2 parents 0dcb19e + e1c26f0 commit 55519da
Show file tree
Hide file tree
Showing 65 changed files with 1,033 additions and 623 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Please see LICENSE_EE.txt for the full text of the MEE License or visit https://

## Community Engineering Slack

To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us a request at [[email protected]](mailto:[email protected]) or [self signup](https://tinyurl.com/engcom-slack).
To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us a request at [[email protected]](mailto:[email protected]) or [self signup](https://opensource.magento.com/slack).


We have channels for each project. These channels are recommended for new members:
Expand Down
19 changes: 6 additions & 13 deletions app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@
* See COPYING.txt for license details.
*/

(function (factory) {
if (typeof define === 'function' && define.amd) {
define([
'jquery',
'mage/backend/validation',
'prototype'
], factory);
} else {
factory(jQuery);
}
}(function (jQuery) {

define([
'jquery',
'mage/backend/validation',
'prototype'
], function (jQuery) {
window.directPost = Class.create();
directPost.prototype = {
initialize: function (methodCode, iframeId, controller, orderSaveUrl, cgiUrl, nativeAction) {
Expand Down Expand Up @@ -349,4 +342,4 @@
}
}
};
}));
});
16 changes: 5 additions & 11 deletions app/code/Magento/Backend/view/adminhtml/web/js/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
*/

/* eslint-disable strict */
(function (factory) {
if (typeof define === 'function' && define.amd) {
define([
'jquery',
'mage/mage'
], factory);
} else {
factory(jQuery);
}
}(function ($) {
define([
'jquery',
'mage/mage'
], function ($) {
$.extend(true, $, {
mage: {
translate: (function () {
Expand Down Expand Up @@ -51,4 +45,4 @@
$.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate);

return $.mage.__;
}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,8 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType =
} else {
return parent::addAttributeToFilter($attribute, $condition, $joinType);
}

return $this;
}

/**
Expand Down
18 changes: 5 additions & 13 deletions app/code/Magento/Catalog/view/frontend/web/js/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,10 @@
* See COPYING.txt for license details.
*/

(function (factory) {
'use strict';

if (typeof define === 'function' && define.amd) {
define([
'jquery',
'jquery-ui-modules/widget'
], factory);
} else {
factory(jQuery);
}
}(function ($) {
define([
'jquery',
'jquery-ui-modules/widget'
], function ($) {
'use strict';

$.widget('mage.gallery', {
Expand Down Expand Up @@ -49,4 +41,4 @@
});

return $.mage.gallery;
}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@
* See COPYING.txt for license details.
*/

(function (factory) {
'use strict';

if (typeof define === 'function' && define.amd) {
define([
'jquery',
'jquery-ui-modules/widget',
'mage/validation/validation'
], factory);
} else {
factory(jQuery);
}
}(function ($) {
define([
'jquery',
'jquery-ui-modules/widget',
'mage/validation/validation'
], function ($) {
'use strict';

$.widget('mage.validation', $.mage.validation, {
Expand Down Expand Up @@ -97,4 +89,4 @@
});

return $.mage.validation;
}));
});
2 changes: 2 additions & 0 deletions app/code/Magento/Customer/Block/Widget/Dob.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ public function getHtmlExtraParams()
$validators['validate-date'] = [
'dateFormat' => $this->getDateFormat()
];
$validators['validate-dob'] = true;

return 'data-validate="' . $this->_escaper->escapeHtml(json_encode($validators)) . '"';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@
namespace Magento\Customer\Model\ResourceModel;

use Magento\Customer\Api\CustomerMetadataInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory;
use Magento\Framework\Api\ExtensibleDataObjectConverter;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Customer\Model\Customer as CustomerModel;
use Magento\Customer\Model\Customer\NotificationStorage;
use Magento\Customer\Model\CustomerFactory;
use Magento\Customer\Model\CustomerRegistry;
use Magento\Customer\Model\Data\CustomerSecureFactory;
use Magento\Customer\Model\Customer\NotificationStorage;
use Magento\Customer\Model\Delegation\Data\NewOperation;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Customer\Model\Delegation\Storage as DelegatedStorage;
use Magento\Framework\Api\DataObjectHelper;
use Magento\Framework\Api\ExtensibleDataObjectConverter;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Framework\Api\ImageProcessorInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Event\ManagerInterface;
use Magento\Customer\Model\Delegation\Storage as DelegatedStorage;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Event\ManagerInterface;
use Magento\Store\Model\StoreManagerInterface;

/**
Expand Down Expand Up @@ -203,7 +204,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
$customer->setAddresses([]);
$customerData = $this->extensibleDataObjectConverter->toNestedArray($customer, [], CustomerInterface::class);
$customer->setAddresses($origAddresses);
/** @var Customer $customerModel */
/** @var CustomerModel $customerModel */
$customerModel = $this->customerFactory->create(['data' => $customerData]);
//Model's actual ID field maybe different than "id" so "id" field from $customerData may be ignored.
$customerModel->setId($customer->getId());
Expand Down
18 changes: 11 additions & 7 deletions app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
use Magento\Customer\Api\CustomerMetadataInterface;
use Magento\Customer\Api\Data\AttributeMetadataInterface;
use Magento\Customer\Api\Data\ValidationRuleInterface;
use Magento\Customer\Block\Widget\Dob;
use Magento\Customer\Helper\Address;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\Cache\FrontendInterface;
use Magento\Framework\Data\Form\FilterFactory;
use Magento\Framework\Escaper;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Customer\Block\Widget\Dob;
use Magento\Framework\Locale\Resolver;
use Magento\Framework\Locale\ResolverInterface;
use Magento\Framework\Stdlib\DateTime\Timezone;
Expand Down Expand Up @@ -536,16 +536,16 @@ public function testGetHtmlExtraParamsWithoutRequiredOption()
{
$this->escaper->expects($this->any())
->method('escapeHtml')
->with('{"validate-date":{"dateFormat":"M\/d\/Y"}}')
->will($this->returnValue('{"validate-date":{"dateFormat":"M\/d\/Y"}}'));
->with('{"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}')
->will($this->returnValue('{"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}'));

$this->attribute->expects($this->once())
->method("isRequired")
->willReturn(false);

$this->assertEquals(
$this->_block->getHtmlExtraParams(),
'data-validate="{"validate-date":{"dateFormat":"M\/d\/Y"}}"'
'data-validate="{"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}"'
);
}

Expand All @@ -559,13 +559,17 @@ public function testGetHtmlExtraParamsWithRequiredOption()
->willReturn(true);
$this->escaper->expects($this->any())
->method('escapeHtml')
->with('{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"}}')
->will($this->returnValue('{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"}}'));
->with('{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}')
->will(
$this->returnValue(
'{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}'
)
);

$this->context->expects($this->any())->method('getEscaper')->will($this->returnValue($this->escaper));

$this->assertEquals(
'data-validate="{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"}}"',
'data-validate="{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}"',
$this->_block->getHtmlExtraParams()
);
}
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Customer/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,4 @@ Addresses,Addresses
"Prefix","Prefix"
"Middle Name/Initial","Middle Name/Initial"
"Suffix","Suffix"
"The Date of Birth should not be greater than today.","The Date of Birth should not be greater than today."
10 changes: 10 additions & 0 deletions app/code/Magento/Customer/view/base/ui_component/customer_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,20 @@
<settings>
<validation>
<rule name="validate-date" xsi:type="boolean">true</rule>
<rule name="validate-dob" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<visible>true</visible>
</settings>
<formElements>
<date>
<settings>
<options>
<option name="maxDate" xsi:type="string">-1d</option>
</options>
</settings>
</date>
</formElements>
</field>
<field name="taxvat" formElement="input">
<argument name="data" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ $fieldCssClass .= $block->isRequired() ? ' required' : '';
<?php endif; ?>
</div>
</div>

<script type="text/x-magento-init">
{
"*": {
"Magento_Customer/js/validation": {}
}
}
</script>
20 changes: 20 additions & 0 deletions app/code/Magento/Customer/view/frontend/web/js/validation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
define([
'jquery',
'moment',
'jquery/validate',
'mage/translate'
], function ($, moment) {
'use strict';

$.validator.addMethod(
'validate-dob',
function (value) {
if (value === '') {
return true;
}

return moment(value).isBefore(moment());
},
$.mage.__('The Date of Birth should not be greater than today.')
);
});
8 changes: 4 additions & 4 deletions app/code/Magento/Deploy/Package/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,17 +459,17 @@ public function getParentMap()
*/
public function getParentFiles($type = null)
{
$files = [];
$files = [[]];
foreach ($this->getParentPackages() as $parentPackage) {
if ($type === null) {
// phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge
$files = array_merge($files, $parentPackage->getFiles());
$files[] = $parentPackage->getFiles();
} else {
// phpcs:ignore Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge
$files = array_merge($files, $parentPackage->getFilesByType($type));
$files[] = $parentPackage->getFilesByType($type);
}
}
return $files;
return array_merge(...$files);
}

/**
Expand Down
34 changes: 17 additions & 17 deletions app/code/Magento/Deploy/Service/DeployPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,30 +249,30 @@ private function checkFileSkip($filePath, array $options)
*/
private function register(Package $package, PackageFile $file = null, $skipLogging = false)
{
$logMessage = '.';
if ($file) {
$logMessage = "Processing file '{$file->getSourcePath()}'";
if ($file->getArea()) {
$logMessage .= " for area '{$file->getArea()}'";
}
if ($file->getTheme()) {
$logMessage .= ", theme '{$file->getTheme()}'";
}
if ($file->getLocale()) {
$logMessage .= ", locale '{$file->getLocale()}'";
}
if ($file->getModule()) {
$logMessage .= "module '{$file->getModule()}'";
}
}

$info = [
'count' => $this->count,
'last' => $file ? $file->getSourcePath() : ''
];
$this->deployStaticFile->writeTmpFile('info.json', $package->getPath(), json_encode($info));

if (!$skipLogging) {
$logMessage = '.';
if ($file) {
$logMessage = "Processing file '{$file->getSourcePath()}'";
if ($file->getArea()) {
$logMessage .= " for area '{$file->getArea()}'";
}
if ($file->getTheme()) {
$logMessage .= ", theme '{$file->getTheme()}'";
}
if ($file->getLocale()) {
$logMessage .= ", locale '{$file->getLocale()}'";
}
if ($file->getModule()) {
$logMessage .= "module '{$file->getModule()}'";
}
}

$this->logger->info($logMessage);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<element name="downloadableLinkSampleByTitle" type="text" selector="//label[contains(., '{{title}}')]/a[contains(@class, 'sample link')]" parameterized="true"/>
<element name="downloadableSampleLabel" type="text" selector="//a[contains(.,normalize-space('{{title}}'))]" parameterized="true" timeout="30"/>
<element name="downloadableLinkSelectAllCheckbox" type="checkbox" selector="#links_all" />
<element name="downloadableLinkSelectAllLabel" type="text" selector="label[for='links_all']" />
</section>
</sections>
Loading

0 comments on commit 55519da

Please sign in to comment.