Skip to content

Commit

Permalink
Merge remote-tracking branch 'commerce/2.4-develop' into platform-health
Browse files Browse the repository at this point in the history
  • Loading branch information
xmav committed Dec 10, 2021
2 parents 8231eee + c4003e8 commit f41fa21
Show file tree
Hide file tree
Showing 17 changed files with 2,577 additions and 2,337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,15 @@ public function isAttributeValid($attrCode, array $attrParams, array $rowData)
return $valid;
}

if (!strlen(trim($rowData[$attrCode]))) {
if ($rowData[$attrCode] === null || trim($rowData[$attrCode]) === '') {
return true;
}

if ($rowData[$attrCode] === $this->context->getEmptyAttributeValueConstant() && !$attrParams['is_required']) {
return true;
}

$valid = false;
switch ($attrParams['type']) {
case 'varchar':
case 'text':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,29 @@ class PersonalInfo extends \Magento\Backend\Block\Template
* since his last activity. Used only if it's impossible to get such setting
* from configuration.
*/
const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;
public const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;

/**
* Customer
*
* @var \Magento\Customer\Api\Data\CustomerInterface
*/
protected $customer;

/**
* Customer log
*
* @var \Magento\Customer\Model\Log
*/
protected $customerLog;

/**
* Customer logger
*
* @var \Magento\Customer\Model\Logger
*/
protected $customerLogger;

/**
* Customer registry
*
* @var \Magento\Customer\Model\CustomerRegistry
*/
protected $customerRegistry;

/**
* Account management
*
* @var AccountManagementInterface
*/
protected $accountManagement;
Expand All @@ -68,43 +58,31 @@ class PersonalInfo extends \Magento\Backend\Block\Template
protected $groupRepository;

/**
* Customer data factory
*
* @var \Magento\Customer\Api\Data\CustomerInterfaceFactory
*/
protected $customerDataFactory;

/**
* Address helper
*
* @var \Magento\Customer\Helper\Address
*/
protected $addressHelper;

/**
* Date time
*
* @var \Magento\Framework\Stdlib\DateTime
*/
protected $dateTime;

/**
* Core registry
*
* @var \Magento\Framework\Registry
*/
protected $coreRegistry;

/**
* Address mapper
*
* @var Mapper
*/
protected $addressMapper;

/**
* Data object helper
*
* @var \Magento\Framework\Api\DataObjectHelper
*/
protected $dataObjectHelper;
Expand Down Expand Up @@ -439,7 +417,8 @@ public function getLastLoginDate()
*/
public function getStoreLastLoginDate()
{
$date = strtotime($this->getCustomerLog()->getLastLoginAt());
$lastLogin = $this->getCustomerLog()->getLastLoginAt();
$date = $lastLogin !== null ? strtotime($lastLogin) : false;

if ($date) {
$date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true);
Expand Down
11 changes: 5 additions & 6 deletions app/code/Magento/Customer/Model/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getNamePrefixOptions($store = null)
{
return $this->prepareNamePrefixSuffixOptions(
$this->addressHelper->getConfig('prefix_options', $store),
$this->addressHelper->getConfig('prefix_show', $store) == NooptreqSource::VALUE_OPTIONAL
$this->addressHelper->getConfig('prefix_show', $store) === NooptreqSource::VALUE_OPTIONAL
);
}

Expand All @@ -63,7 +63,7 @@ public function getNameSuffixOptions($store = null)
{
return $this->prepareNamePrefixSuffixOptions(
$this->addressHelper->getConfig('suffix_options', $store),
$this->addressHelper->getConfig('suffix_show', $store) == NooptreqSource::VALUE_OPTIONAL
$this->addressHelper->getConfig('suffix_show', $store) === NooptreqSource::VALUE_OPTIONAL
);
}

Expand Down Expand Up @@ -93,13 +93,12 @@ protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false
*/
private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
{
$options = trim($options);
if (empty($options)) {
if ($options === null || empty(trim($options))) {
return false;
}

$result = [];
$options = explode(';', $options);
$options = explode(';', trim($options));

foreach ($options as $value) {
$result[] = $this->escaper->escapeHtml(trim($value)) ?: ' ';
}
Expand Down
5 changes: 3 additions & 2 deletions app/code/Magento/Dhl/Model/Carrier.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,12 @@ public function setRequest(\Magento\Framework\DataObject $request)
);

$shippingWeight = $request->getPackageWeight();
$destStreet = $request->getDestStreet() !== null ? str_replace("\n", '', $request->getDestStreet()) : '';

$requestObject->setValue(sprintf('%.2f', $request->getPackageValue()))
->setValueWithDiscount($request->getPackageValueWithDiscount())
->setCustomsValue($request->getPackageCustomsValue())
->setDestStreet($this->string->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35))
->setDestStreet($this->string->substr($destStreet, 0, 35))
->setDestStreetLine2($request->getDestStreetLine2())
->setDestCity($request->getDestCity())
->setOrigCompanyName($request->getOrigCompanyName())
Expand Down Expand Up @@ -939,7 +940,7 @@ protected function _getDimension($dimension, $configWeightUnit = false)
);
}

return round($dimension, 3);
return round((float) $dimension, 3);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Elasticsearch/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"magento/module-store": "*",
"magento/module-catalog-inventory": "*",
"magento/framework": "*",
"elasticsearch/elasticsearch": "~7.15.0"
"elasticsearch/elasticsearch": "~7.16.0"
},
"suggest": {
"magento/module-config": "*"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Elasticsearch6/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"magento/module-catalog-search": "*",
"magento/module-search": "*",
"magento/module-elasticsearch": "*",
"elasticsearch/elasticsearch": "~7.15.0"
"elasticsearch/elasticsearch": "~7.16.0"
},
"suggest": {
"magento/module-config": "*"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Elasticsearch7/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-elasticsearch": "*",
"elasticsearch/elasticsearch": "~7.15.0",
"elasticsearch/elasticsearch": "~7.16.0",
"magento/module-advanced-search": "*",
"magento/module-catalog-search": "*"
},
Expand Down
6 changes: 2 additions & 4 deletions app/code/Magento/GoogleAnalytics/Block/Ga.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
class Ga extends \Magento\Framework\View\Element\Template
{
/**
* Google analytics data
*
* @var \Magento\GoogleAnalytics\Helper\Data
*/
protected $_googleAnalyticsData = null;
Expand Down Expand Up @@ -261,8 +259,8 @@ public function getOrdersTrackingData()
private function getOptPageUrl()
{
$optPageURL = '';
$pageName = trim($this->getPageName());
if ($pageName && substr($pageName, 0, 1) == '/' && strlen($pageName) > 1) {
$pageName = $this->getPageName() !== null ? trim($this->getPageName()) : '';
if ($pageName && substr($pageName, 0, 1) === '/' && strlen($pageName) > 1) {
$optPageURL = ", '" . $this->escapeHtmlAttr($pageName, false) . "'";
}
return $optPageURL;
Expand Down
6 changes: 4 additions & 2 deletions app/code/Magento/Payment/Model/Method/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ public function assignData(\Magento\Framework\DataObject $data)
[
'cc_type' => $additionalData->getCcType(),
'cc_owner' => $additionalData->getCcOwner(),
'cc_last_4' => substr($additionalData->getCcNumber(), -4),
'cc_last_4' => $additionalData->getCcNumber() !== null ?
substr($additionalData->getCcNumber(), -4) : '',
'cc_number' => $additionalData->getCcNumber(),
'cc_cid' => $additionalData->getCcCid(),
'cc_exp_month' => $additionalData->getCcExpMonth(),
Expand Down Expand Up @@ -323,8 +324,9 @@ public function validateCcNum($ccNumber)
{
$cardNumber = strrev($ccNumber);
$numSum = 0;
$length = strlen($cardNumber);

for ($i = 0; $i < strlen($cardNumber); $i++) {
for ($i = 0; $i < $length; $i++) {
$currentNum = substr($cardNumber, $i, 1);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function _getElementHtml(AbstractElement $element)
{
$_months = [];
for ($i = 1; $i <= 12; $i++) {
$month = $this->_localeDate->date(mktime(null, null, null, $i, 1))
$month = $this->_localeDate->date(mktime(0, 0, 0, $i, 1))
->format('m');
$_months[$month] = $month;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\Result\Json;
use Magento\Framework\Controller\ResultFactory;
use Magento\Tax\Model\Rate\Provider as RatesProvider;
Expand All @@ -17,7 +18,7 @@
* Class AjaxLoadRates is intended to load existing
* Tax rates as options for a select element.
*/
class AjaxLoadRates extends Action
class AjaxLoadRates extends Action implements HttpGetActionInterface
{
/**
* @var RatesProvider
Expand Down Expand Up @@ -53,7 +54,7 @@ public function __construct(
public function execute()
{
$ratesPage = (int) $this->getRequest()->getParam('p');
$ratesFilter = trim($this->getRequest()->getParam('s'));
$ratesFilter = trim($this->getRequest()->getParam('s', ''));

try {
if (!empty($ratesFilter)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ class SaveRole extends \Magento\User\Controller\Adminhtml\User\Role implements H
/**
* Session keys for Info form data
*/
const ROLE_EDIT_FORM_DATA_SESSION_KEY = 'role_edit_form_data';
public const ROLE_EDIT_FORM_DATA_SESSION_KEY = 'role_edit_form_data';

/**
* Session keys for Users form data
*/
const IN_ROLE_USER_FORM_DATA_SESSION_KEY = 'in_role_user_form_data';
public const IN_ROLE_USER_FORM_DATA_SESSION_KEY = 'in_role_user_form_data';

/**
* Session keys for original Users form data
*/
const IN_ROLE_OLD_USER_FORM_DATA_SESSION_KEY = 'in_role_old_user_form_data';
public const IN_ROLE_OLD_USER_FORM_DATA_SESSION_KEY = 'in_role_old_user_form_data';

/**
* Session keys for Use all resources flag form data
*/
const RESOURCE_ALL_FORM_DATA_SESSION_KEY = 'resource_all_form_data';
public const RESOURCE_ALL_FORM_DATA_SESSION_KEY = 'resource_all_form_data';

/**
* Session keys for Resource form data
*/
const RESOURCE_FORM_DATA_SESSION_KEY = 'resource_form_data';
public const RESOURCE_FORM_DATA_SESSION_KEY = 'resource_form_data';

/**
* @var SecurityCookie
Expand Down Expand Up @@ -155,7 +155,7 @@ protected function validateUser()
*/
private function parseRequestVariable($paramName): array
{
$value = $this->getRequest()->getParam($paramName, null);
$value = $this->getRequest()->getParam($paramName, '');
// phpcs:ignore Magento2.Functions.DiscouragedFunction
parse_str($value, $value);
$value = array_keys($value);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected function _addField($parameter)
}
} else {
// phpcs:ignore Magento2.Functions.DiscouragedFunction
$data['value'] = html_entity_decode($data['value']);
$data['value'] = \is_string($data['value']) ? html_entity_decode($data['value']) : '';
}

// prepare element dropdown values
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"colinmollenhour/credis": "1.12.1",
"colinmollenhour/php-redis-session-abstract": "~1.4.5",
"composer/composer": "^1.9 || ^2.0",
"elasticsearch/elasticsearch": "~7.15.0",
"elasticsearch/elasticsearch": "~7.16.0",
"guzzlehttp/guzzle": "^7.3.0",
"laminas/laminas-captcha": "^2.11",
"laminas/laminas-code": "~4.5.0",
Expand Down
19 changes: 10 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f41fa21

Please sign in to comment.