Skip to content

Commit

Permalink
Merge branch '2.4-develop' of http://github.com/magento/magento2 into…
Browse files Browse the repository at this point in the history
… 2.3-developPR26345
  • Loading branch information
engcom-Echo committed Feb 20, 2020
2 parents 43f9e2b + a1fad2b commit 7ba11b8
Show file tree
Hide file tree
Showing 788 changed files with 27,685 additions and 5,838 deletions.
3 changes: 1 addition & 2 deletions app/code/Magento/AdvancedPricingImportExport/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_AdvancedPricingImportExport" >
</module>
<module name="Magento_AdvancedPricingImportExport"/>
</config>
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/Model/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
public function execute($commandName)
{
if (!array_key_exists($commandName, $this->commands)) {
throw new NotFoundException(__('Command was not found.'));
throw new NotFoundException(__('Command "%1" was not found.', $commandName));
}

/** @var \Magento\Analytics\Model\Connector\CommandInterface $command */
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Analytics/Test/Unit/Model/ConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ public function testExecute()
}

/**
* Executing non-existing command
*
* @expectedException \Magento\Framework\Exception\NotFoundException
* @expectedExceptionMessage Command "register" was not found.
* @return void
*/
public function testExecuteCommandNotFound()
public function testExecuteCommandNotFound(): void
{
$commandName = 'register';
$this->connector->execute($commandName);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"There was an error save new configuration value.","There was an error save new configuration value."
"Please select an industry.","Please select an industry."
"--Please Select--","--Please Select--"
"Command was not found.","Command was not found."
"Command "%1" was not found.","Command "%1" was not found."
"Input data must be string or convertible into string.","Input data must be string or convertible into string."
"Input data must be non-empty string.","Input data must be non-empty string."
"Not valid cipher method.","Not valid cipher method."
Expand Down
41 changes: 15 additions & 26 deletions app/code/Magento/Backend/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/
class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
{
/**
* Api URL
*/
const API_URL = 'https://image-charts.com/chart';

/**
Expand Down Expand Up @@ -190,8 +187,8 @@ public function getChartUrl($directUrl = true)
$params = [
'cht' => 'lc',
'chls' => '7',
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
'chm' => 'B,f4d4b2,0,0,0',
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
'chm' => 'B,f4d4b2,0,0,0',
'chco' => 'db4814',
'chxs' => '0,0,11|1,0,11',
'chma' => '15,15,15,15'
Expand Down Expand Up @@ -237,7 +234,7 @@ public function getChartUrl($directUrl = true)
case '1y':
case '2y':
$d = $dateStart->format('Y-m');
$dateStart->modify('+1 month');
$dateStart->modify('first day of next month');
break;
default:
$d = $dateStart->format('Y-m-d H:00');
Expand Down Expand Up @@ -300,20 +297,23 @@ public function getChartUrl($directUrl = true)
$minvalue = min($localminvalue);

// default values
$yLabels = [];
$miny = 0;
$maxy = 0;
$yorigin = 0;
$xAxis = 'x';
$xAxisIndex = 0;
$yAxisIndex = 1;

if ($minvalue >= 0 && $maxvalue >= 0) {
if ($maxvalue > 10) {
$p = pow(10, $this->_getPow((int) $maxvalue));
$p = pow(10, $this->_getPow((int)$maxvalue));
$maxy = ceil($maxvalue / $p) * $p;
$yLabels = range($miny, $maxy, $p);
$yRange = "$yAxisIndex,$miny,$maxy,$p";
} else {
$maxy = ceil($maxvalue + 1);
$yLabels = range($miny, $maxy, 1);
$yRange = "$yAxisIndex,$miny,$maxy,1";
}
$params['chxr'] = $yRange;
$yorigin = 0;
}

Expand Down Expand Up @@ -341,22 +341,11 @@ public function getChartUrl($directUrl = true)

$params['chd'] .= $buffer;

$valueBuffer = [];

if (count($this->_axisLabels) > 0) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
$indexid = 0;
foreach ($this->_axisLabels as $idx => $labels) {
if ($idx == 'x') {
$this->formatAxisLabelDate((string) $idx, (string) $timezoneLocal);
$tmpstring = implode('|', $this->_axisLabels[$idx]);
$valueBuffer[] = $indexid . ":|" . $tmpstring;
} elseif ($idx == 'y') {
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
}
$indexid++;
}
$params['chxl'] = implode('|', $valueBuffer);
$this->formatAxisLabelDate($xAxis, (string)$timezoneLocal);
$customAxisLabels = $xAxisIndex . ":|" . implode('|', $this->_axisLabels[$xAxis]);
$params['chxl'] = $customAxisLabels . $dataSetdelimiter;
}

// chart size
Expand All @@ -368,7 +357,7 @@ public function getChartUrl($directUrl = true)
foreach ($params as $name => $value) {
$p[] = $name . '=' . urlencode($value);
}
return (string) self::API_URL . '?' . implode('&', $p);
return (string)self::API_URL . '?' . implode('&', $p);
}
$gaData = urlencode(base64_encode(json_encode($params)));
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
Expand All @@ -392,7 +381,7 @@ private function formatAxisLabelDate($idx, $timezoneLocal)
switch ($this->getDataHelper()->getParam('period')) {
case '24h':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
$period->setTime((int) $period->format('H'), 0, 0),
$period->setTime((int)$period->format('H'), 0, 0),
\IntlDateFormatter::NONE,
\IntlDateFormatter::SHORT
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Magento\Framework\DataObject;

/**
* Produce html output using the given data source.
*
* phpcs:disable Magento2.Classes.AbstractApi
* Backend grid item abstract renderer
* @api
* @SuppressWarnings(PHPMD.NumberOfChildren)
Expand Down Expand Up @@ -53,7 +56,7 @@ public function getColumn()
* Renders grid column
*
* @param DataObject $row
* @return string
* @return string
*/
public function render(DataObject $row)
{
Expand All @@ -62,7 +65,7 @@ public function render(DataObject $row)
$result .= $this->getColumn()->getEditOnly() ? ''
: '<span class="admin__grid-control-value">' . $this->_getValue($row) . '</span>';

return $result . $this->_getInputValueElement($row) . '</div>' ;
return $result . $this->_getInputValueElement($row) . '</div>';
}
return $this->_getValue($row);
}
Expand Down Expand Up @@ -90,6 +93,7 @@ protected function _getValue(DataObject $row)
if (is_string($getter)) {
return $row->{$getter}();
} elseif (is_callable($getter)) {
//phpcs:ignore Magento2.Functions.DiscouragedFunction
return call_user_func($getter, $row);
}
return '';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSetStoreInformationConfigurationActionGroup">
<annotations>
<description>Set Store Information configurations</description>
</annotations>
<arguments>
<argument name="storeName" type="string" defaultValue="{{AdminGeneralSetStoreNameConfigData.value}}"/>
<argument name="storeHoursOfOperation" type="string" defaultValue="{{AdminGeneralSetStoreHoursConfigData.value}}"/>
<argument name="vatNumber" type="string" defaultValue="{{AdminGeneralSetVatNumberConfigData.value}}"/>
<argument name="telephone" type="string" defaultValue="{{US_Address_TX.telephone}}"/>
<argument name="country" type="string" defaultValue="{{US_Address_TX.country_id}}"/>
<argument name="state" type="string" defaultValue="{{US_Address_TX.state}}"/>
<argument name="city" type="string" defaultValue="{{US_Address_TX.city}}"/>
<argument name="postcode" type="string" defaultValue="{{US_Address_TX.postcode}}"/>
<argument name="street" type="string" defaultValue="{{US_Address_TX.street[0]}}"/>
</arguments>
<magentoCLI command="config:set {{AdminGeneralSetStoreNameConfigData.path}} '{{storeName}}'" stepKey="setStoreInformationName"/>
<magentoCLI command="config:set {{AdminGeneralSetStorePhoneConfigData.path}} '{{telephone}}'" stepKey="setStoreInformationPhone"/>
<magentoCLI command="config:set {{AdminGeneralSetStoreHoursConfigData.path}} '{{storeHoursOfOperation}}'" stepKey="setStoreHoursInformation"/>
<magentoCLI command="config:set {{AdminGeneralSetCountryConfigData.path}} '{{country}}'" stepKey="setStoreInformationCountry"/>
<magentoCLI command="config:set {{AdminGeneralSetStateConfigData.path}} '{{state}}'" stepKey="setStoreInformationState"/>
<magentoCLI command="config:set {{AdminGeneralSetCityConfigData.path}} '{{city}}'" stepKey="setStoreInformationCity"/>
<magentoCLI command="config:set {{AdminGeneralSetPostcodeConfigData.path}} '{{postcode}}'" stepKey="setStoreInformationPostcode"/>
<magentoCLI command="config:set {{AdminGeneralSetStreetAddressConfigData.path}} '{{street}}'" stepKey="setStoreInformationStreetAddress"/>
<magentoCLI command="config:set {{AdminGeneralSetVatNumberConfigData.path}} '{{vatNumber}}'" stepKey="setStoreInformationVatNumber"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="LoginActionGroup">
<annotations>
<description>Login to Backend Admin using ENV Admin credentials. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.</description>
<description>DEPRECATED. Please use LoginAsAdmin instead.
Login to Backend Admin using ENV Admin credentials. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.</description>
</annotations>

<amOnPage url="{{_ENV.MAGENTO_BACKEND_NAME}}" stepKey="navigateToAdmin"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@
<entity name="AdminGeneralSetStreetAddress2ConfigData">
<data key="path">general/store_information/street_line2</data>
</entity>
<entity name="AdminGeneralSetStateConfigData">
<data key="path">general/store_information/region_id</data>
</entity>
<entity name="AdminGeneralSetStoreHoursConfigData">
<data key="path">general/store_information/hours</data>
<data key="value">8AM-8PM</data>
</entity>
</entities>
4 changes: 2 additions & 2 deletions app/code/Magento/Backend/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@
<label>Enable Template Path Hints for Storefront</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="template_hints_storefront_show_with_parameter" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="template_hints_storefront_show_with_parameter" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Hints for Storefront with URL Parameter</label>
<depends>
<field id="*/*/template_hints_storefront">1</field>
</depends>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Use URL parameter to enable template path hints for Storefront</comment>
</field>
<field id="template_hints_parameter_value" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<field id="template_hints_parameter_value" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Parameter Value</label>
<depends>
<field id="*/*/template_hints_storefront">1</field>
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Backend/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,5 @@ Pagination,Pagination
"Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used.","Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used."
"Anchor Text for Next","Anchor Text for Next"
"Theme Name","Theme Name"
"Use URL parameter to enable template path hints for Storefront","Use URL parameter to enable template path hints for Storefront"
"Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]","Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]"
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;

/**
* Class CaptureStrategyCommand
* Braintree capture implementation.
*
* @SuppressWarnings(PHPMD)
*/
class CaptureStrategyCommand implements CommandInterface
Expand Down Expand Up @@ -84,7 +85,7 @@ class CaptureStrategyCommand implements CommandInterface
* @param FilterBuilder $filterBuilder
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param SubjectReader $subjectReader
* @param BraintreeAdapterFactory $braintreeAdapterFactory,
* @param BraintreeAdapterFactory $braintreeAdapterFactory
* @param BraintreeSearchAdapter $braintreeSearchAdapter
*/
public function __construct(
Expand Down Expand Up @@ -112,9 +113,9 @@ public function execute(array $commandSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObjectInterface $paymentDO */
$paymentDO = $this->subjectReader->readPayment($commandSubject);

$command = $this->getCommand($paymentDO);
$this->commandPool->get($command)->execute($commandSubject);

return $this->commandPool->get($command)->execute($commandSubject);
}

/**
Expand All @@ -128,11 +129,8 @@ private function getCommand(PaymentDataObjectInterface $paymentDO)
$payment = $paymentDO->getPayment();
ContextHelper::assertOrderPayment($payment);

// if auth transaction does not exist then execute authorize&capture command
// if capture transaction does not exist then execute capture command
$existsCapture = $this->isExistsCaptureTransaction($payment);
if (!$payment->getAuthorizationTransaction() && !$existsCapture) {
return self::SALE;
}

// do capture for authorization transaction
if (!$existsCapture && !$this->isExpiredAuthorization($payment, $paymentDO->getOrder())) {
Expand Down
Loading

0 comments on commit 7ba11b8

Please sign in to comment.