Skip to content

Commit

Permalink
Merge pull request #1 from magento/2.4-develop
Browse files Browse the repository at this point in the history
allineamento
  • Loading branch information
aleromano89 authored Jan 4, 2020
2 parents 10ab84e + 3e23510 commit 95fc06f
Show file tree
Hide file tree
Showing 64 changed files with 922 additions and 1,204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ public function getData(array $data): array
__('Required parameter "authorizenet_acceptjs" for "payment_method" is missing.')
);
}
if (!isset($data[self::PATH_ADDITIONAL_DATA]['opaque_data_descriptor'])) {
throw new GraphQlInputException(
__('Required parameter "opaque_data_descriptor" for "authorizenet_acceptjs" is missing.')
);
}
if (!isset($data[self::PATH_ADDITIONAL_DATA]['opaque_data_value'])) {
throw new GraphQlInputException(
__('Required parameter "opaque_data_value" for "authorizenet_acceptjs" is missing.')
);
}
if (!isset($data[self::PATH_ADDITIONAL_DATA]['cc_last_4'])) {
throw new GraphQlInputException(
__('Required parameter "cc_last_4" for "authorizenet_acceptjs" is missing.')
);
}

$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $data);
foreach ($additionalData as $key => $value) {
Expand Down
13 changes: 0 additions & 13 deletions app/code/Magento/BraintreeGraphQl/Model/BraintreeDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ public function getData(array $args): array
__('Required parameter "braintree" for "payment_method" is missing.')
);
}

if (!isset($args[self::PATH_ADDITIONAL_DATA]['payment_method_nonce'])) {
throw new GraphQlInputException(
__('Required parameter "payment_method_nonce" for "braintree" is missing.')
);
}

if (!isset($args[self::PATH_ADDITIONAL_DATA]['is_active_payment_token_enabler'])) {
throw new GraphQlInputException(
__('Required parameter "is_active_payment_token_enabler" for "braintree" is missing.')
);
}

return $args[self::PATH_ADDITIONAL_DATA];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<actionGroup ref="logout" stepKey="logout"/>
</after>
<!-- Generate the datetime default value -->
<generateDate date="now" format="m/j/y g:i A" stepKey="generateDefaultValue"/>
<generateDate date="now" format="n/j/y g:i A" stepKey="generateDefaultValue"/>
<!-- Create new datetime product attribute -->
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/>
<waitForPageLoad stepKey="waitForPageLoadAttributes"/>
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/CatalogGraphQl/etc/graphql/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,10 @@
</argument>
</arguments>
</type>

<type name="Magento\Catalog\Helper\Data">
<arguments>
<argument name="templateFilterModel" xsi:type="string">Magento\Widget\Model\Template\FilterEmulate</argument>
</arguments>
</type>
</config>
6 changes: 2 additions & 4 deletions app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
<label>Create Permanent Redirect for URLs if URL Key Changed</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="generate_category_product_rewrites" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<field id="generate_category_product_rewrites" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Generate "category/product" URL Rewrites</label>
<backend_model>Magento\CatalogUrlRewrite\Model\TableCleaner</backend_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>
<![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.]]>
</comment>
<comment><![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.]]></comment>
<frontend_class>generate_category_product_rewrites</frontend_class>
</field>
</group>
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"Product URL Suffix","Product URL Suffix"
"Use Categories Path for Product URLs","Use Categories Path for Product URLs"
"Create Permanent Redirect for URLs if URL Key Changed","Create Permanent Redirect for URLs if URL Key Changed"
"Generate "category/product" URL Rewrites","Generate "category/product" URL Rewrites"
"Generate ""category/product"" URL Rewrites","Generate ""category/product"" URL Rewrites"
"URL key ""%1"" matches a reserved endpoint name (%2). Use another URL key.","URL key ""%1"" matches a reserved endpoint name (%2). Use another URL key."
"<strong style=""color:red"">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.","<strong style=""color:red"">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them."
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Magento\Customer\Model\Data\CustomerSecureFactory;
use Magento\Customer\Model\Delegation\Data\NewOperation;
use Magento\Customer\Model\Delegation\Storage as DelegatedStorage;
use Magento\Customer\Model\ResourceModel\Customer\Collection;
use Magento\Framework\Api\DataObjectHelper;
use Magento\Framework\Api\ExtensibleDataObjectConverter;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
Expand All @@ -31,6 +32,8 @@
/**
* Customer repository.
*
* CRUD operations for customer entity
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
*/
Expand Down Expand Up @@ -187,8 +190,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
{
/** @var NewOperation|null $delegatedNewOperation */
$delegatedNewOperation = !$customer->getId() ? $this->delegatedStorage->consumeNewOperation() : null;
$prevCustomerData = null;
$prevCustomerDataArr = null;
$prevCustomerData = $prevCustomerDataArr = null;
if ($customer->getId()) {
$prevCustomerData = $this->getById($customer->getId());
$prevCustomerDataArr = $prevCustomerData->__toArray();
Expand All @@ -214,6 +216,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
$prevCustomerData ? $prevCustomerData->getStoreId() : $this->storeManager->getStore()->getId()
);
}
$this->setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr);
// Need to use attribute set or future updates can cause data loss
if (!$customerModel->getAttributeSetId()) {
$customerModel->setAttributeSetId(CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER);
Expand Down Expand Up @@ -452,4 +455,18 @@ private function setValidationFlag($customerArray, $customerModel)
$customerModel->setData('ignore_validation_flag', true);
}
}

/**
* Set customer group id
*
* @param Customer $customerModel
* @param array $customerArr
* @param array $prevCustomerDataArr
*/
private function setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr)
{
if (!isset($customerArr['group_id']) && $prevCustomerDataArr && isset($prevCustomerDataArr['group_id'])) {
$customerModel->setGroupId($prevCustomerDataArr['group_id']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function testSave()
'setFirstFailure',
'setLockExpires',
'save',
'setGroupId'
]
);

Expand Down Expand Up @@ -245,9 +246,15 @@ public function testSave()
$this->customer->expects($this->atLeastOnce())
->method('getId')
->willReturn($customerId);
$this->customer->expects($this->atLeastOnce())
$this->customer->expects($this->at(4))
->method('__toArray')
->willReturn([]);
$this->customer->expects($this->at(3))
->method('__toArray')
->willReturn(['group_id' => 1]);
$customerModel->expects($this->once())
->method('setGroupId')
->with(1);
$this->customerRegistry->expects($this->atLeastOnce())
->method('retrieve')
->with($customerId)
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Payment/Model/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Info extends AbstractExtensibleModel implements InfoInterface
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
Expand Down Expand Up @@ -188,6 +188,7 @@ public function getAdditionalInformation($key = null)
*/
public function unsAdditionalInformation($key = null)
{
$this->_initAdditionalInformation();
if ($key && isset($this->_additionalInformation[$key])) {
unset($this->_additionalInformation[$key]);
return $this->setData('additional_information', $this->_additionalInformation);
Expand Down
10 changes: 10 additions & 0 deletions app/code/Magento/Sales/Block/Order/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,14 @@ public function getBackUrl()
{
return $this->getUrl('customer/account/');
}

/**
* Get message for no orders.
*
* @return \Magento\Framework\Phrase
*/
public function getEmptyOrdersMessage()
{
return __('You have placed no orders.');
}
}
1 change: 1 addition & 0 deletions app/code/Magento/Sales/Model/Order/Payment/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public function getAdditionalInformation($key = null)
*/
public function unsAdditionalInformation($key = null)
{
$this->initAdditionalInformation();
if ($key && isset($this->additionalInformation[$key])) {
unset($this->additionalInformation[$key]);
return $this->setData('additional_information', $this->additionalInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@
<div class="order-products-toolbar toolbar bottom"><?= $block->getPagerHtml() ?></div>
<?php endif ?>
<?php else : ?>
<div class="message info empty"><span><?= $block->escapeHtml(__('You have placed no orders.')) ?></span></div>
<div class="message info empty"><span><?= $block->escapeHtml($block->getEmptyOrdersMessage()) ?></span></div>
<?php endif ?>
46 changes: 24 additions & 22 deletions app/code/Magento/Theme/view/frontend/templates/html/pager.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,33 @@
* @see \Magento\Theme\Block\Html\Pager
*/
?>
<?php if ($block->getCollection()->getSize()) : ?>
<?php if ($block->getCollection()->getSize()): ?>

<?php if ($block->getUseContainer()) : ?>
<?php if ($block->getUseContainer()): ?>
<div class="pager">
<?php endif ?>

<?php if ($block->getShowAmounts()) : ?>
<?php if ($block->getShowAmounts()): ?>
<p class="toolbar-amount">
<span class="toolbar-number">
<?php if ($block->getLastPageNum()>1) : ?>
<?= $block->escapeHtml(__('Items %1 to %2 of %3 total', $block->getFirstNum(), $block->getLastNum(), $block->getTotalNum())) ?>
<?php elseif ($block->getTotalNum() == 1) : ?>
<?php if ($block->getLastPageNum()>1): ?>
<?= $block->escapeHtml(
__('Items %1 to %2 of %3 total', $block->getFirstNum(), $block->getLastNum(), $block->getTotalNum())
) ?>
<?php elseif ($block->getTotalNum() == 1): ?>
<?= $block->escapeHtml(__('%1 Item', $block->getTotalNum())) ?>
<?php else : ?>
<?php else: ?>
<?= $block->escapeHtml(__('%1 Item(s)', $block->getTotalNum())) ?>
<?php endif; ?>
</span>
</p>
<?php endif ?>

<?php if ($block->getLastPageNum()>1) : ?>
<?php if ($block->getLastPageNum()>1): ?>
<div class="pages">
<strong class="label pages-label" id="paging-label"><?= $block->escapeHtml(__('Page')) ?></strong>
<ul class="items pages-items" aria-labelledby="paging-label">
<?php if (!$block->isFirstPage()) : ?>
<?php if (!$block->isFirstPage()): ?>
<li class="item pages-item-previous">
<?php $text = $block->getAnchorTextForPrevious() ? $block->getAnchorTextForPrevious() : '';?>
<a class="<?= $block->escapeHtmlAttr($text ? 'link ' : 'action ') ?> previous"
Expand All @@ -46,7 +48,7 @@
</li>
<?php endif;?>

<?php if ($block->canShowFirst()) : ?>
<?php if ($block->canShowFirst()): ?>
<li class="item">
<a class="page first" href="<?= $block->escapeUrl($block->getFirstPageUrl()) ?>">
<span class="label"><?= $block->escapeHtml(__('Page')) ?></span>
Expand All @@ -55,7 +57,7 @@
</li>
<?php endif;?>

<?php if ($block->canShowPreviousJump()) : ?>
<?php if ($block->canShowPreviousJump()): ?>
<li class="item">
<a class="page previous jump"
title=""
Expand All @@ -65,15 +67,15 @@
</li>
<?php endif;?>

<?php foreach ($block->getFramePages() as $_page) : ?>
<?php if ($block->isPageCurrent($_page)) : ?>
<?php foreach ($block->getFramePages() as $_page): ?>
<?php if ($block->isPageCurrent($_page)): ?>
<li class="item current">
<strong class="page">
<span class="label"><?= $block->escapeHtml(__('You\'re currently reading page')) ?></span>
<span><?= $block->escapeHtml($_page) ?></span>
</strong>
</li>
<?php else : ?>
<?php else: ?>
<li class="item">
<a href="<?= $block->escapeUrl($block->getPageUrl($_page)) ?>" class="page">
<span class="label"><?= $block->escapeHtml(__('Page')) ?></span>
Expand All @@ -83,15 +85,15 @@
<?php endif;?>
<?php endforeach;?>

<?php if ($block->canShowNextJump()) : ?>
<?php if ($block->canShowNextJump()): ?>
<li class="item">
<a class="page next jump" title="" href="<?= $block->escapeUrl($block->getNextJumpUrl()) ?>">
<span>...</span>
</a>
</li>
<?php endif;?>

<?php if ($block->canShowLast()) : ?>
<?php if ($block->canShowLast()): ?>
<li class="item">
<a class="page last" href="<?= $block->escapeUrl($block->getLastPageUrl()) ?>">
<span class="label"><?= $block->escapeHtml(__('Page')) ?></span>
Expand All @@ -100,7 +102,7 @@
</li>
<?php endif;?>

<?php if (!$block->isLastPage()) : ?>
<?php if (!$block->isLastPage()): ?>
<li class="item pages-item-next">
<?php $text = $block->getAnchorTextForNext() ? $block->getAnchorTextForNext() : '';?>
<a class="<?= /* @noEscape */ $text ? 'link ' : 'action ' ?> next"
Expand All @@ -115,13 +117,13 @@
</div>
<?php endif; ?>

<?php if ($block->isShowPerPage()) : ?>
<?php if ($block->isShowPerPage()): ?>
<div class="limiter">
<strong class="limiter-label"><?= $block->escapeHtml(__('Show')) ?></strong>
<select id="limiter" data-mage-init='{"redirectUrl": {"event":"change"}}' class="limiter-options">
<?php foreach ($block->getAvailableLimit() as $_key => $_limit) : ?>
<option value="<?= $block->escapeHtmlAttr($block->getLimitUrl($_key)) ?>"
<?php if ($block->isLimitCurrent($_key)) : ?>
<?php foreach ($block->getAvailableLimit() as $_key => $_limit): ?>
<option value="<?= $block->escapeUrl($block->getLimitUrl($_key)) ?>"
<?php if ($block->isLimitCurrent($_key)): ?>
selected="selected"<?php endif ?>>
<?= $block->escapeHtml($_limit) ?>
</option>
Expand All @@ -131,7 +133,7 @@
</div>
<?php endif ?>

<?php if ($block->getUseContainer()) : ?>
<?php if ($block->getUseContainer()): ?>
</div>
<?php endif ?>

Expand Down
Loading

0 comments on commit 95fc06f

Please sign in to comment.