Skip to content

Commit

Permalink
Merge pull request #1192 from magento-engcom/develop-prs
Browse files Browse the repository at this point in the history
Public Pull Requests:
#9932
#9905
#8879
#9525
#9251
#4891
#7758
  • Loading branch information
Oleksii Korshenko authored Jun 13, 2017
2 parents 2c89e48 + 5d5690e commit ec99590
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 39 deletions.
1 change: 0 additions & 1 deletion app/code/Magento/Catalog/etc/mview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<table name="catalog_product_entity_decimal" entity_column="entity_id" />
<table name="catalog_product_entity_gallery" entity_column="entity_id" />
<table name="catalog_product_entity_int" entity_column="entity_id" />
<table name="catalog_product_entity_media_gallery" entity_column="value_id" />
<table name="catalog_product_entity_media_gallery_value" entity_column="entity_id" />
<table name="catalog_product_entity_text" entity_column="entity_id" />
<table name="catalog_product_entity_tier_price" entity_column="entity_id" />
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/CatalogRule/etc/mview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<table name="catalog_product_entity_decimal" entity_column="entity_id" />
<table name="catalog_product_entity_gallery" entity_column="entity_id" />
<table name="catalog_product_entity_int" entity_column="entity_id" />
<table name="catalog_product_entity_media_gallery" entity_column="value_id" />
<table name="catalog_product_entity_media_gallery_value" entity_column="entity_id" />
<table name="catalog_product_entity_text" entity_column="entity_id" />
<table name="catalog_product_entity_tier_price" entity_column="entity_id" />
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ protected function getDefaultValue($attributeCode)
return $this->getCustomer()->getFirstname();
}
break;
case 'middlename':
if ($this->getCustomer()) {
return $this->getCustomer()->getMiddlename();
}
break;
case 'lastname':
if ($this->getCustomer()) {
return $this->getCustomer()->getLastname();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
-->
<div class="billing-address-details" data-bind="if: isAddressDetailsVisible() && currentBillingAddress()">
<!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname --><!-- /ko -->
<!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname --><!-- /ko --> <!-- ko text: currentBillingAddress().middlename --><!-- /ko -->
<!-- ko text: currentBillingAddress().lastname --><!-- /ko --> <!-- ko text: currentBillingAddress().suffix --><!-- /ko --><br/>
<!-- ko text: currentBillingAddress().street --><!-- /ko --><br/>
<!-- ko text: currentBillingAddress().city --><!-- /ko -->, <span data-bind="html: currentBillingAddress().region"></span> <!-- ko text: currentBillingAddress().postcode --><!-- /ko --><br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
-->
<div class="shipping-address-item" data-bind="css: isSelected() ? 'selected-item' : 'not-selected-item'">
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko --> <!-- ko text: address().middlename --><!-- /ko -->
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
<!-- ko text: address().street --><!-- /ko --><br/>
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
-->
<!-- ko if: (visible()) -->
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko --> <!-- ko text: address().middlename --><!-- /ko -->
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
<!-- ko text: address().street --><!-- /ko --><br/>
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
Expand Down
13 changes: 12 additions & 1 deletion app/code/Magento/Eav/Setup/EavSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ public function updateAttribute($entityTypeId, $id, $field, $value = null, $sort
* @param mixed $value
* @param int $sortOrder
* @return $this
* @throws LocalizedException
*/
private function _updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null)
{
Expand Down Expand Up @@ -972,11 +973,15 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so
return $this;
}
}
$attributeId = $this->getAttributeId($entityTypeId, $id);
if (false === $attributeId) {
throw new LocalizedException(__('Attribute with ID: "%1" does not exist', $id));
}

$this->setup->updateTableRow(
'eav_attribute',
'attribute_id',
$this->getAttributeId($entityTypeId, $id),
$attributeId,
$field,
$value,
'entity_type_id',
Expand All @@ -994,6 +999,7 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so
* @param string|array $field
* @param mixed $value
* @return $this
* @throws LocalizedException
*/
private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $value = null)
{
Expand Down Expand Up @@ -1022,6 +1028,11 @@ private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $val
return $this;
}
}

$attributeId = $this->getAttributeId($entityTypeId, $id);
if (false === $attributeId) {
throw new LocalizedException(__('Attribute with ID: "%1" does not exist', $id));
}
$this->setup->updateTableRow(
$this->setup->getTable($additionalTable),
'attribute_id',
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/GiftMessage/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ OK,OK
"Gift Options","Gift Options"
"Gift Message","Gift Message"
"Do you have any gift items in your order?","Do you have any gift items in your order?"
"Add gift options","Add gift options"
"Add Gift Options","Add Gift Options"
"Gift Options for the Entire Order","Gift Options for the Entire Order"
"Leave this box blank if you don\'t want to leave a gift message for the entire order.","Leave this box blank if you don\'t want to leave a gift message for the entire order."
"Gift Options for Individual Items","Gift Options for Individual Items"
"<span>Item %1</span> of %2","<span>Item %1</span> of %2"
"Leave a box blank if you don\'t want to add a gift message for that item.","Leave a box blank if you don\'t want to add a gift message for that item."
"Add Gift Options for the Entire Order","Add Gift Options for the Entire Order"
"You can leave this box blank if you don\'t want to add a gift message for this address.","You can leave this box blank if you don\'t want to add a gift message for this address."
"Add gift options for Individual Items","Add gift options for Individual Items"
"Add Gift Options for Individual Items","Add Gift Options for Individual Items"
"You can leave this box blank if you don\'t want to add a gift message for the item.","You can leave this box blank if you don\'t want to add a gift message for the item."
"Gift Message (optional)","Gift Message (optional)"
To:,To:
From:,From:
Message:,Message:
Update,Update
"Gift options","Gift options"
"Gift Options","Gift Options"
Edit,Edit
Delete,Delete
"Allow Gift Messages on Order Level","Allow Gift Messages on Order Level"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="field choice" id="add-gift-options-<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>">
<input type="checkbox" name="allow_gift_options" id="allow_gift_options" data-mage-init='{"giftOptions":{}}' value="1" data-selector='{"id":"#allow-gift-options-container"}'<?php if ($block->getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked"<?php endif; ?> class="checkbox" />
<label for="allow_gift_options" class="label"><span><?php /* @escapeNotVerified */ echo __('Add gift options') ?></span></label>
<label for="allow_gift_options" class="label"><span><?php /* @escapeNotVerified */ echo __('Add Gift Options') ?></span></label>
</div>

<dl class="options-items" id="allow-gift-options-container">
Expand Down Expand Up @@ -148,7 +148,7 @@

<div class="field choice" id="add-gift-options-<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>">
<input type="checkbox" name="allow_gift_options_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" id="allow_gift_options_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" data-mage-init='{"giftOptions":{}}' value="1" data-selector='{"id":"#allow-gift-options-container-<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>"}'<?php if ($block->getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked"<?php endif; ?> class="checkbox" />
<label for="allow_gift_options_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Add gift options') ?></span></label>
<label for="allow_gift_options_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Add Gift Options') ?></span></label>
</div>

<dl class="options-items" id="allow-gift-options-container-<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>">
Expand Down Expand Up @@ -197,7 +197,7 @@
<dt id="add-gift-options-for-items-<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" class="order-title individual">
<div class="field choice">
<input type="checkbox" name="allow_gift_options_for_items_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" id="allow_gift_options_for_items_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" data-mage-init='{"giftOptions":{}}' value="1" data-selector='{"id":"#allow-gift-options-for-items-container-<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>"}'<?php if ($block->getItemsHasMesssages()): ?> checked="checked"<?php endif; ?> class="checkbox" />
<label for="allow_gift_options_for_items_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Add gift options for Individual Items') ?></span></label>
<label for="allow_gift_options_for_items_<?php /* @escapeNotVerified */ echo $block->getEntity()->getId() ?>" class="label"><span><?php /* @escapeNotVerified */ echo __('Add Gift Options for Individual Items') ?></span></label>
</div>
</dt>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Shipping extends Form
protected $shippingMethod = '//span[text()="%s"]/following::label[contains(., "%s")]/../input';

/**
* From with shipping available shipping methods.
* Form with shipping available shipping methods.
*
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ private function validateComposerJsonFile($path)
/** @var \Magento\Framework\Composer\MagentoComposerApplicationFactory $appFactory */
$appFactory = self::$objectManager->get(\Magento\Framework\Composer\MagentoComposerApplicationFactory::class);
$app = $appFactory->create();
$app->runComposerCommand(['command' => 'validate'], $path);

try {
$app->runComposerCommand(['command' => 'validate'], $path);
} catch (\RuntimeException $exception) {
$this->fail($exception->getMessage());
}
}

/**
Expand Down
19 changes: 13 additions & 6 deletions lib/internal/Magento/Framework/Validator/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\Framework\Validator;

use Magento\Framework\Validator\Constraint\OptionInterface;
Expand Down Expand Up @@ -257,7 +255,11 @@ protected function _createConstraint(array $data)
}

if (\Magento\Framework\Validator\Config::CONSTRAINT_TYPE_PROPERTY == $data['type']) {
$result = new \Magento\Framework\Validator\Constraint\Property($validator, $data['property'], $data['alias']);
$result = new \Magento\Framework\Validator\Constraint\Property(
$validator,
$data['property'],
$data['alias']
);
} else {
$result = $this->_constraintFactory->create(['validator' => $validator, 'alias' => $data['alias']]);
}
Expand Down Expand Up @@ -286,7 +288,10 @@ protected function _createConstraintValidator(array $data)
// Check validator type
if (!$validator instanceof \Magento\Framework\Validator\ValidatorInterface) {
throw new \InvalidArgumentException(
sprintf('Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface', $data['class'])
sprintf(
'Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface',
$data['class']
)
);
}

Expand All @@ -300,8 +305,10 @@ protected function _createConstraintValidator(array $data)
* @param array $options
* @return void
*/
protected function _configureConstraintValidator(\Magento\Framework\Validator\ValidatorInterface $validator, array $options)
{
protected function _configureConstraintValidator(
\Magento\Framework\Validator\ValidatorInterface $validator,
array $options
) {
// Call all validator methods according to configuration
if (isset($options['methods'])) {
foreach ($options['methods'] as $methodData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace Magento\Framework\Validator\Constraint;

class Property extends \Magento\Framework\Validator\Constraint
Expand All @@ -33,8 +31,8 @@ public function __construct(\Magento\Framework\Validator\ValidatorInterface $val
}

/**
* Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or \ArrayAccess or array
* is passed
* Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or
* \ArrayAccess or array is passed
*
* @param mixed $value
* @return mixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* Factory class for \Magento\Framework\Validator\Constraint
*/
Expand Down Expand Up @@ -33,8 +31,10 @@ class ConstraintFactory
* @param \Magento\Framework\ObjectManagerInterface $objectManager
* @param string $instanceName
*/
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName = \Magento\Framework\Validator\Constraint::class)
{
public function __construct(
\Magento\Framework\ObjectManagerInterface $objectManager,
$instanceName = \Magento\Framework\Validator\Constraint::class
) {
$this->_objectManager = $objectManager;
$this->_instanceName = $instanceName;
}
Expand Down
28 changes: 17 additions & 11 deletions lib/internal/Magento/Framework/Validator/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Framework\Validator;

use Magento\Framework\Cache\FrontendInterface;

/**
* @codingStandardsIgnoreFile
*/
class Factory
{
/**
* Cache key
*/
/** cache key */
const CACHE_KEY = __CLASS__;

/**
Expand Down Expand Up @@ -73,14 +69,19 @@ public function __construct(

/**
* Init cached list of validation files
*
* @return void
*/
protected function _initializeConfigList()
{
if (!$this->_configFiles) {
$this->_configFiles = $this->cache->load(self::CACHE_KEY);
if (!$this->_configFiles) {
$this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml');
$this->cache->save($this->getSerializer()->serialize($this->_configFiles->toArray()), self::CACHE_KEY);
$this->cache->save(
$this->getSerializer()->serialize($this->_configFiles->toArray()),
self::CACHE_KEY
);
} else {
$filesArray = $this->getSerializer()->unserialize($this->_configFiles);
$this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($filesArray));
Expand Down Expand Up @@ -121,7 +122,9 @@ public function getValidatorConfig()
$this->_initializeConfigList();
$this->_initializeDefaultTranslator();
return $this->_objectManager->create(
\Magento\Framework\Validator\Config::class, ['configFiles' => $this->_configFiles]);
\Magento\Framework\Validator\Config::class,
['configFiles' => $this->_configFiles]
);
}

/**
Expand Down Expand Up @@ -161,7 +164,9 @@ public function createValidator($entityName, $groupName, array $builderConfig =
private function getSerializer()
{
if ($this->serializer === null) {
$this->serializer = $this->_objectManager->get(\Magento\Framework\Serialize\SerializerInterface::class);
$this->serializer = $this->_objectManager->get(
\Magento\Framework\Serialize\SerializerInterface::class
);
}
return $this->serializer;
}
Expand All @@ -175,8 +180,9 @@ private function getSerializer()
private function getFileIteratorFactory()
{
if ($this->fileIteratorFactory === null) {
$this->fileIteratorFactory = $this->_objectManager
->get(\Magento\Framework\Config\FileIteratorFactory::class);
$this->fileIteratorFactory = $this->_objectManager->get(
\Magento\Framework\Config\FileIteratorFactory::class
);
}
return $this->fileIteratorFactory;
}
Expand Down

0 comments on commit ec99590

Please sign in to comment.