Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
[EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
 - merged latest code from mainline branch
  • Loading branch information
magento-engcom-team authored Apr 16, 2019
2 parents a4966fe + 3290565 commit 9ebee4b
Show file tree
Hide file tree
Showing 22 changed files with 127 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

namespace Magento\ConfigurableProduct\Setup\Patch\Data;

use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;

/**
* Class InstallInitialConfigurableAttributes
*
* @package Magento\ConfigurableProduct\Setup\Patch
*/
class InstallInitialConfigurableAttributes implements DataPatchInterface, PatchVersionInterface
Expand All @@ -24,6 +24,7 @@ class InstallInitialConfigurableAttributes implements DataPatchInterface, PatchV
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @var EavSetupFactory
*/
Expand All @@ -43,7 +44,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function apply()
{
Expand All @@ -64,40 +65,43 @@ public function apply()
'color'
];
foreach ($attributes as $attributeCode) {
$relatedProductTypes = explode(
',',
$eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to')
);
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
$relatedProductTypes[] = Configurable::TYPE_CODE;
$eavSetup->updateAttribute(
\Magento\Catalog\Model\Product::ENTITY,
$attributeCode,
'apply_to',
implode(',', $relatedProductTypes)
$attribute = $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to');
if ($attribute) {
$relatedProductTypes = explode(
',',
$attribute
);
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
$relatedProductTypes[] = Configurable::TYPE_CODE;
$eavSetup->updateAttribute(
\Magento\Catalog\Model\Product::ENTITY,
$attributeCode,
'apply_to',
implode(',', $relatedProductTypes)
);
}
}
}
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public static function getVersion()
{
return '2.0.0';
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getAliases()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="CustomerLogoutStorefrontByMenuItemsActionGroup">
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcome}}"
dependentSelector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
<conditionalClick selector="{{StorefrontPanelHeaderSection.customerWelcomeMenu}}"
dependentSelector="{{StorefrontPanelHeaderSection.customerLogoutLink}}"
visible="false"
stepKey="clickHeaderCustomerMenuButton" />
<click selector="{{StorefrontPanelHeaderSection.customerLogoutLink}}" stepKey="clickSignOutButton" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<element name="welcomeMessage" type="text" selector="header>.panel .greet.welcome" />
<element name="createAnAccountLink" type="select" selector="//div[@class='panel wrapper']//li/a[contains(.,'Create an Account')]" timeout="30"/>
<element name="notYouLink" type="button" selector=".greet.welcome span a"/>
<element name="customerWelcome" type="text" selector=".panel.header .customer-welcome"/>
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-menu"/>
<element name="customerWelcome" type="text" selector=".panel.header .greet.welcome"/>
<element name="customerWelcomeMenu" type="text" selector=".panel.header .customer-welcome .customer-name"/>
<element name="customerLoginLink" type="button" selector=".panel.header .header.links .authorization-link a" timeout="30"/>
<element name="customerLogoutLink" type="text" selector=".panel.header .customer-welcome .customer-menu .authorization-link a" timeout="30"/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
data-toggle="dropdown"
data-trigger-keypress-button="true"
data-bind="scope: 'customer'">
<span data-bind="text: customer().fullname"></span>
<button type="button"
class="action switch"
tabindex="-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Magento\Store\Model\ScopeInterface;

/**
* Saves data from order to purchased links.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class SaveDownloadableOrderItemObserver implements ObserverInterface
Expand Down Expand Up @@ -92,9 +94,15 @@ public function execute(\Magento\Framework\Event\Observer $observer)
if ($purchasedLink->getId()) {
return $this;
}
$storeId = $orderItem->getOrder()->getStoreId();
$orderStatusToEnableItem = $this->_scopeConfig->getValue(
\Magento\Downloadable\Model\Link\Purchased\Item::XML_PATH_ORDER_ITEM_STATUS,
ScopeInterface::SCOPE_STORE,
$storeId
);
if (!$product) {
$product = $this->_createProductModel()->setStoreId(
$orderItem->getOrder()->getStoreId()
$storeId
)->load(
$orderItem->getProductId()
);
Expand Down Expand Up @@ -150,6 +158,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
)->setNumberOfDownloadsBought(
$numberOfDownloads
)->setStatus(
\Magento\Sales\Model\Order\Item::STATUS_PENDING == $orderStatusToEnableItem ?
\Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_AVAILABLE :
\Magento\Downloadable\Model\Link\Purchased\Item::LINK_STATUS_PENDING
)->setCreatedAt(
$orderItem->getCreatedAt()
Expand All @@ -165,6 +175,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
}

/**
* Create purchased model.
*
* @return \Magento\Downloadable\Model\Link\Purchased
*/
protected function _createPurchasedModel()
Expand All @@ -173,6 +185,8 @@ protected function _createPurchasedModel()
}

/**
* Create product model.
*
* @return \Magento\Catalog\Model\Product
*/
protected function _createProductModel()
Expand All @@ -181,6 +195,8 @@ protected function _createProductModel()
}

/**
* Create purchased item model.
*
* @return \Magento\Downloadable\Model\Link\Purchased\Item
*/
protected function _createPurchasedItemModel()
Expand All @@ -189,6 +205,8 @@ protected function _createPurchasedItemModel()
}

/**
* Create items collection.
*
* @return \Magento\Downloadable\Model\ResourceModel\Link\Purchased\Item\Collection
*/
protected function _createItemsCollection()
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Quote/Model/Quote/Item/Compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function getOptionValues($value)
if (is_string($value) && $this->jsonValidator->isValid($value)) {
$value = $this->serializer->unserialize($value);
if (is_array($value)) {
unset($value['qty'], $value['uenc']);
unset($value['qty'], $value['uenc'], $value['related_product'], $value['item']);
$value = array_filter($value, function ($optionValue) {
return !empty($optionValue);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function __construct(
* @param bool $forceSyncMode
*
* @return bool
* @throws \Exception
*/
public function send(
\Magento\Sales\Api\Data\OrderInterface $order,
\Magento\Sales\Api\Data\CreditmemoInterface $creditmemo,
\Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment = null,
$forceSyncMode = false
) {
$creditmemo->setSendEmail(true);
$creditmemo->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -145,6 +146,7 @@ public function send(
* @param \Magento\Sales\Api\Data\OrderInterface $order
*
* @return string
* @throws \Exception
*/
private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class CreditmemoSender extends Sender
* @param CreditmemoIdentity $identityContainer
* @param Order\Email\SenderBuilderFactory $senderBuilderFactory
* @param \Psr\Log\LoggerInterface $logger
* @param Renderer $addressRenderer
* @param PaymentHelper $paymentHelper
* @param CreditmemoResource $creditmemoResource
* @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Expand Down Expand Up @@ -96,10 +96,11 @@ public function __construct(
* @param Creditmemo $creditmemo
* @param bool $forceSyncMode
* @return bool
* @throws \Exception
*/
public function send(Creditmemo $creditmemo, $forceSyncMode = false)
{
$creditmemo->setSendEmail(true);
$creditmemo->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$order = $creditmemo->getOrder();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function send(Creditmemo $creditmemo, $forceSyncMode = false)
*
* @param Order $order
* @return string
* @throws \Exception
*/
protected function getPaymentHtml(Order $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class InvoiceSender extends Sender
* @param InvoiceIdentity $identityContainer
* @param Order\Email\SenderBuilderFactory $senderBuilderFactory
* @param \Psr\Log\LoggerInterface $logger
* @param Renderer $addressRenderer
* @param PaymentHelper $paymentHelper
* @param InvoiceResource $invoiceResource
* @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Expand Down Expand Up @@ -96,10 +96,11 @@ public function __construct(
* @param Invoice $invoice
* @param bool $forceSyncMode
* @return bool
* @throws \Exception
*/
public function send(Invoice $invoice, $forceSyncMode = false)
{
$invoice->setSendEmail(true);
$invoice->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$order = $invoice->getOrder();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function send(Invoice $invoice, $forceSyncMode = false)
*
* @param Order $order
* @return string
* @throws \Exception
*/
protected function getPaymentHtml(Order $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class ShipmentSender extends Sender
* @param ShipmentIdentity $identityContainer
* @param Order\Email\SenderBuilderFactory $senderBuilderFactory
* @param \Psr\Log\LoggerInterface $logger
* @param Renderer $addressRenderer
* @param PaymentHelper $paymentHelper
* @param ShipmentResource $shipmentResource
* @param \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
* @param Renderer $addressRenderer
* @param ManagerInterface $eventManager
*/
public function __construct(
Expand Down Expand Up @@ -96,10 +96,11 @@ public function __construct(
* @param Shipment $shipment
* @param bool $forceSyncMode
* @return bool
* @throws \Exception
*/
public function send(Shipment $shipment, $forceSyncMode = false)
{
$shipment->setSendEmail(true);
$shipment->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$order = $shipment->getOrder();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function send(Shipment $shipment, $forceSyncMode = false)
*
* @param Order $order
* @return string
* @throws \Exception
*/
protected function getPaymentHtml(Order $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function __construct(
* @param bool $forceSyncMode
*
* @return bool
* @throws \Exception
*/
public function send(
\Magento\Sales\Api\Data\OrderInterface $order,
\Magento\Sales\Api\Data\InvoiceInterface $invoice,
\Magento\Sales\Api\Data\InvoiceCommentCreationInterface $comment = null,
$forceSyncMode = false
) {
$invoice->setSendEmail(true);
$invoice->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -145,6 +146,7 @@ public function send(
* @param \Magento\Sales\Api\Data\OrderInterface $order
*
* @return string
* @throws \Exception
*/
private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function __construct(
* @param bool $forceSyncMode
*
* @return bool
* @throws \Exception
*/
public function send(
\Magento\Sales\Api\Data\OrderInterface $order,
\Magento\Sales\Api\Data\ShipmentInterface $shipment,
\Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null,
$forceSyncMode = false
) {
$shipment->setSendEmail(true);
$shipment->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -145,6 +146,7 @@ public function send(
* @param \Magento\Sales\Api\Data\OrderInterface $order
*
* @return string
* @throws \Exception
*/
private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order)
{
Expand Down
Loading

0 comments on commit 9ebee4b

Please sign in to comment.