Skip to content

Commit

Permalink
merge magento/2.2-develop into magento-tsg-csl3/2.2-develop-pr28
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-cicd2 authored May 8, 2019
2 parents 85a4ae6 + d184fce commit 1da969f
Show file tree
Hide file tree
Showing 26 changed files with 365 additions and 2,665 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/**
* Class FlatTableBuilder
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class FlatTableBuilder
Expand Down Expand Up @@ -354,6 +355,7 @@ protected function _updateTemporaryTableByStoreValues(
//Update not simple attributes (eg. dropdown)
$columnName = $attributeCode . $valueFieldSuffix;
if (isset($flatColumns[$columnName])) {
$columnValue = $this->_connection->getIfNullSql('ts.value', 't0.value');
$select = $this->_connection->select();
$select->joinLeft(
['t0' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')],
Expand All @@ -364,8 +366,8 @@ protected function _updateTemporaryTableByStoreValues(
'ts.option_id = et.' . $attributeCode . ' AND ts.store_id = ' . $storeId,
[]
)->columns(
[$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')]
)->where($attributeCode . ' IS NOT NULL');
[$columnName => $columnValue]
)->where($columnValue . ' IS NOT NULL');
if (!empty($changedIds)) {
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
}
Expand All @@ -389,7 +391,7 @@ protected function _getTemporaryTableName($tableName)
}

/**
* Get MetadataPool
* Get metadata pool
*
* @return \Magento\Framework\EntityManager\MetadataPool
*/
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/Product/Gallery/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function addImage(
$mediaGalleryData = $product->getData($attrCode);
$position = 0;

$absoluteFilePath = $this->mediaDirectory->getAbsolutePath($file);
$absoluteFilePath = $this->mediaDirectory->getAbsolutePath($destinationFile);
$imageMimeType = $this->mime->getMimeType($absoluteFilePath);
$imageContent = $this->mediaDirectory->readFile($absoluteFilePath);
$imageBase64 = base64_encode($imageContent);
Expand Down Expand Up @@ -489,7 +489,7 @@ protected function getNotDuplicatedFilename($fileName, $dispretionPath)
/**
* Retrieve data for update attribute
*
* @param \Magento\Catalog\Model\Product $object
* @param \Magento\Catalog\Model\Product $object
* @return array
* @since 101.0.0
*/
Expand Down
15 changes: 10 additions & 5 deletions app/code/Magento/Catalog/Model/ResourceModel/Product/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Magento\Catalog\Model\ResourceModel\Product;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Store\Model\ScopeInterface;

/**
* Catalog product custom option resource model
Expand Down Expand Up @@ -154,21 +155,25 @@ protected function _saveValuePrices(\Magento\Framework\Model\AbstractModel $obje

$scope = (int)$this->_config->getValue(
\Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
ScopeInterface::SCOPE_STORE
);

if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) {
$baseCurrency = $this->_config->getValue(
$website = $this->_storeManager->getStore($object->getStoreId())->getWebsite();

$websiteBaseCurrency = $this->_config->getValue(
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE,
'default'
ScopeInterface::SCOPE_WEBSITE,
$website
);

$storeIds = $this->_storeManager->getStore($object->getStoreId())->getWebsite()->getStoreIds();
$storeIds = $website->getStoreIds();
if (is_array($storeIds)) {
foreach ($storeIds as $storeId) {
if ($object->getPriceType() == 'fixed') {
$storeCurrency = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode();
$rate = $this->_currencyFactory->create()->load($baseCurrency)->getRate($storeCurrency);
$rate = $this->_currencyFactory->create()->load($websiteBaseCurrency)
->getRate($storeCurrency);
if (!$rate) {
$rate = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ define([
allowedProducts,
i,
j,
basePrice = parseFloat(this.options.spConfig.prices.basePrice.amount),
finalPrice = parseFloat(this.options.spConfig.prices.finalPrice.amount),
optionFinalPrice,
optionPriceDiff,
optionPrices = this.options.spConfig.optionPrices,
Expand Down Expand Up @@ -410,7 +410,7 @@ define([
typeof optionPrices[allowedProducts[0]] !== 'undefined') {
allowedProductMinPrice = this._getAllowedProductWithMinPrice(allowedProducts);
optionFinalPrice = parseFloat(optionPrices[allowedProductMinPrice].finalPrice.amount);
optionPriceDiff = optionFinalPrice - basePrice;
optionPriceDiff = optionFinalPrice - finalPrice;

if (optionPriceDiff !== 0) {
options[i].label = options[i].label + ' ' + priceUtils.formatPrice(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
value="<?= /* @escapeNotVerified */ $_link->getId() ?>" <?= /* @escapeNotVerified */ $block->getLinkCheckedValue($_link) ?>
price="<?= /* @escapeNotVerified */ $block->getCurrencyPrice($_link->getPrice()) ?>"/>
<?php endif; ?>
<label for="links_<?= /* @escapeNotVerified */ $_link->getId() ?>" class="label">
<label for="links_<?= /* @escapeNotVerified */ $_link->getId() ?>" class="label admin__field-label">
<?= $block->escapeHtml($_link->getTitle()) ?>
<?php if ($_link->getSampleFile() || $_link->getSampleUrl()): ?>
&nbsp;(<a href="<?= /* @escapeNotVerified */ $block->getLinkSampleUrl($_link) ?>" <?= $block->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':'' ?>><?= /* @escapeNotVerified */ __('sample') ?></a>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="paypal_payflowpro_with_express_checkout" translate="label comment" extends="payment_all_paypal/paypal_payflowpro">
<group id="paypal_payflowpro_with_express_checkout" translate="label" extends="payment_all_paypal/paypal_payflowpro">
<label>Payflow Pro</label>
<attribute type="paypal_ec_separate">0</attribute>
<group id="paypal_payflow_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="10">
Expand All @@ -30,11 +30,11 @@
<field id="enable_paypal_payflow"/>
</requires>
</field>
<field id="enable_express_checkout_bml_payflow" translate="label" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
<field id="enable_express_checkout_bml_payflow" translate="label comment" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
<label>Enable PayPal Credit</label>
<comment><![CDATA[PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href="https:/www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]>
<a href="https://www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]>
</comment>
<config_path>payment/payflow_express_bml/active</config_path>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Paypal/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -697,3 +697,8 @@ User,User
The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
or more. <a href=""https:/financing.paypal.com/ppfinportal/content/forrester"" target=""_blank"">See Details</a>.
"
"PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>","PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>"
90 changes: 54 additions & 36 deletions app/code/Magento/Quote/Model/QuoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Quote\Model;

use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Api\SearchCriteria\CollectionProcessor;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Api\SortOrder;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Api\Data\CartInterface;
use Magento\Quote\Model\Quote;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Quote\Api\Data\CartInterfaceFactory;
use Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory;
use Magento\Quote\Model\QuoteRepository\SaveHandler;
use Magento\Quote\Model\QuoteRepository\LoadHandler;
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
use Magento\Store\Model\StoreManagerInterface;

/**
* Quote repository.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
class QuoteRepository implements CartRepositoryInterface
{
/**
* @var Quote[]
Expand All @@ -37,6 +43,7 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface

/**
* @var QuoteFactory
* @deprecated
*/
protected $quoteFactory;

Expand All @@ -46,13 +53,13 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
protected $storeManager;

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\Collection
* @var QuoteCollection
* @deprecated 100.2.0
*/
protected $quoteCollection;

/**
* @var \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory
* @var CartSearchResultsInterfaceFactory
*/
protected $searchResultsDataFactory;

Expand All @@ -77,43 +84,51 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
private $collectionProcessor;

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory
* @var QuoteCollectionFactory
*/
private $quoteCollectionFactory;

/**
* @var CartInterfaceFactory
*/
private $cartFactory;

/**
* Constructor
*
* @param QuoteFactory $quoteFactory
* @param StoreManagerInterface $storeManager
* @param \Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection
* @param \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory
* @param QuoteCollection $quoteCollection
* @param CartSearchResultsInterfaceFactory $searchResultsDataFactory
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
* @param CollectionProcessorInterface|null $collectionProcessor
* @param \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory|null $quoteCollectionFactory
* @param QuoteCollectionFactory|null $quoteCollectionFactory
* @param CartInterfaceFactory|null $cartFactory
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
QuoteFactory $quoteFactory,
StoreManagerInterface $storeManager,
\Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection,
\Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory,
QuoteCollection $quoteCollection,
CartSearchResultsInterfaceFactory $searchResultsDataFactory,
JoinProcessorInterface $extensionAttributesJoinProcessor,
CollectionProcessorInterface $collectionProcessor = null,
\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $quoteCollectionFactory = null
QuoteCollectionFactory $quoteCollectionFactory = null,
CartInterfaceFactory $cartFactory = null
) {
$this->quoteFactory = $quoteFactory;
$this->storeManager = $storeManager;
$this->searchResultsDataFactory = $searchResultsDataFactory;
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
$this->collectionProcessor = $collectionProcessor ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessor::class);
$this->quoteCollectionFactory = $quoteCollectionFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory::class);
$this->collectionProcessor = $collectionProcessor ?: ObjectManager::getInstance()
->get(CollectionProcessor::class);
$this->quoteCollectionFactory = $quoteCollectionFactory ?: ObjectManager::getInstance()
->get(QuoteCollectionFactory::class);
$this->cartFactory = $cartFactory ?: ObjectManager::getInstance()->get(CartInterfaceFactory::class);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function get($cartId, array $sharedStoreIds = [])
{
Expand All @@ -126,7 +141,7 @@ public function get($cartId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getForCustomer($customerId, array $sharedStoreIds = [])
{
Expand All @@ -140,7 +155,7 @@ public function getForCustomer($customerId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getActive($cartId, array $sharedStoreIds = [])
{
Expand All @@ -152,7 +167,7 @@ public function getActive($cartId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
{
Expand All @@ -164,9 +179,9 @@ public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(\Magento\Quote\Api\Data\CartInterface $quote)
public function save(CartInterface $quote)
{
if ($quote->getId()) {
$currentQuote = $this->get($quote->getId(), [$quote->getStoreId()]);
Expand All @@ -184,9 +199,9 @@ public function save(\Magento\Quote\Api\Data\CartInterface $quote)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
public function delete(CartInterface $quote)
{
$quoteId = $quote->getId();
$customerId = $quote->getCustomerId();
Expand All @@ -203,13 +218,13 @@ public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
* @param int $identifier
* @param int[] $sharedStoreIds
* @throws NoSuchEntityException
* @return Quote
* @return CartInterface
*/
protected function loadQuote($loadMethod, $loadField, $identifier, array $sharedStoreIds = [])
{
/** @var Quote $quote */
$quote = $this->quoteFactory->create();
if ($sharedStoreIds) {
/** @var CartInterface $quote */
$quote = $this->cartFactory->create();
if ($sharedStoreIds && method_exists($quote, 'setSharedStoreIds')) {
$quote->setSharedStoreIds($sharedStoreIds);
}
$quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
Expand All @@ -220,9 +235,9 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
public function getList(SearchCriteriaInterface $searchCriteria)
{
$this->quoteCollection = $this->quoteCollectionFactory->create();
/** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
Expand Down Expand Up @@ -265,6 +280,7 @@ protected function addFilterGroupToCollection(FilterGroup $filterGroup, QuoteCol

/**
* Get new SaveHandler dependency for application code.
*
* @return SaveHandler
* @deprecated 100.1.0
*/
Expand All @@ -277,6 +293,8 @@ private function getSaveHandler()
}

/**
* Get load handler instance.
*
* @return LoadHandler
* @deprecated 100.1.0
*/
Expand Down
Loading

0 comments on commit 1da969f

Please sign in to comment.