Skip to content

Commit 78bb895

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into graphql-issue-230
2 parents d7006f1 + 45a6365 commit 78bb895

File tree

197 files changed

+6488
-1760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+6488
-1760
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4335,7 +4335,7 @@ Tests:
43354335
* Fixed order placing with virtual product using Express Checkout
43364336
* Fixed the error during order placement with Recurring profile payment
43374337
* Fixed wrong redirect after customer registration during multishipping checkout
4338-
* Fixed inability to crate shipping labels
4338+
* Fixed inability to create shipping labels
43394339
* Fixed inability to switch language, if the default language is English
43404340
* Fixed an issue with incorrect XML appearing in cache after some actions on the frontend
43414341
* Fixed product export

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 66 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Backend\Block\Dashboard;
79

810
/**
@@ -15,7 +17,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
1517
/**
1618
* Api URL
1719
*/
18-
const API_URL = 'http://chart.apis.google.com/chart';
20+
const API_URL = 'https://image-charts.com/chart';
1921

2022
/**
2123
* All series
@@ -76,6 +78,7 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
7678
/**
7779
* Google chart api data encoding
7880
*
81+
* @deprecated since the Google Image Charts API not accessible from March 14, 2019
7982
* @var string
8083
*/
8184
protected $_encoding = 'e';
@@ -187,11 +190,12 @@ public function getChartUrl($directUrl = true)
187190
{
188191
$params = [
189192
'cht' => 'lc',
190-
'chf' => 'bg,s,ffffff',
191-
'chco' => 'ef672f',
192193
'chls' => '7',
193-
'chxs' => '0,676056,15,0,l,676056|1,676056,15,0,l,676056',
194-
'chm' => 'h,f2ebde,0,0:1:.1,1,-1',
194+
'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
195+
'chm' => 'B,f4d4b2,0,0,0',
196+
'chco' => 'db4814',
197+
'chxs' => '0,0,11|1,0,11',
198+
'chma' => '15,15,15,15'
195199
];
196200

197201
$this->_allSeries = $this->getRowsData($this->_dataRows);
@@ -279,20 +283,11 @@ public function getChartUrl($directUrl = true)
279283
$this->_axisLabels['x'] = $dates;
280284
$this->_allSeries = $datas;
281285

282-
//Google encoding values
283-
if ($this->_encoding == "s") {
284-
// simple encoding
285-
$params['chd'] = "s:";
286-
$dataDelimiter = "";
287-
$dataSetdelimiter = ",";
288-
$dataMissing = "_";
289-
} else {
290-
// extended encoding
291-
$params['chd'] = "e:";
292-
$dataDelimiter = "";
293-
$dataSetdelimiter = ",";
294-
$dataMissing = "__";
295-
}
286+
// Image-Charts Awesome data format values
287+
$params['chd'] = "a:";
288+
$dataDelimiter = ",";
289+
$dataSetdelimiter = "|";
290+
$dataMissing = "_";
296291

297292
// process each string in the array, and find the max length
298293
$localmaxvalue = [0];
@@ -306,7 +301,6 @@ public function getChartUrl($directUrl = true)
306301
$minvalue = min($localminvalue);
307302

308303
// default values
309-
$yrange = 0;
310304
$yLabels = [];
311305
$miny = 0;
312306
$maxy = 0;
@@ -321,52 +315,21 @@ public function getChartUrl($directUrl = true)
321315
$maxy = ceil($maxvalue + 1);
322316
$yLabels = range($miny, $maxy, 1);
323317
}
324-
$yrange = $maxy;
325318
$yorigin = 0;
326319
}
327320

328321
$chartdata = [];
329322

330323
foreach ($this->getAllSeries() as $index => $serie) {
331324
$thisdataarray = $serie;
332-
if ($this->_encoding == "s") {
333-
// SIMPLE ENCODING
334-
for ($j = 0; $j < sizeof($thisdataarray); $j++) {
335-
$currentvalue = $thisdataarray[$j];
336-
if (is_numeric($currentvalue)) {
337-
$ylocation = round(
338-
(strlen($this->_simpleEncoding) - 1) * ($yorigin + $currentvalue) / $yrange
339-
);
340-
$chartdata[] = substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter;
341-
} else {
342-
$chartdata[] = $dataMissing . $dataDelimiter;
343-
}
344-
}
345-
} else {
346-
// EXTENDED ENCODING
347-
for ($j = 0; $j < sizeof($thisdataarray); $j++) {
348-
$currentvalue = $thisdataarray[$j];
349-
if (is_numeric($currentvalue)) {
350-
if ($yrange) {
351-
$ylocation = 4095 * ($yorigin + $currentvalue) / $yrange;
352-
} else {
353-
$ylocation = 0;
354-
}
355-
$firstchar = floor($ylocation / 64);
356-
$secondchar = $ylocation % 64;
357-
$mappedchar = substr(
358-
$this->_extendedEncoding,
359-
$firstchar,
360-
1
361-
) . substr(
362-
$this->_extendedEncoding,
363-
$secondchar,
364-
1
365-
);
366-
$chartdata[] = $mappedchar . $dataDelimiter;
367-
} else {
368-
$chartdata[] = $dataMissing . $dataDelimiter;
369-
}
325+
$count = count($thisdataarray);
326+
for ($j = 0; $j < $count; $j++) {
327+
$currentvalue = $thisdataarray[$j];
328+
if (is_numeric($currentvalue)) {
329+
$ylocation = $yorigin + $currentvalue;
330+
$chartdata[] = $ylocation . $dataDelimiter;
331+
} else {
332+
$chartdata[] = $dataMissing . $dataDelimiter;
370333
}
371334
}
372335
$chartdata[] = $dataSetdelimiter;
@@ -381,45 +344,13 @@ public function getChartUrl($directUrl = true)
381344

382345
$valueBuffer = [];
383346

384-
if (sizeof($this->_axisLabels) > 0) {
347+
if (count($this->_axisLabels) > 0) {
385348
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
386349
$indexid = 0;
387350
foreach ($this->_axisLabels as $idx => $labels) {
388351
if ($idx == 'x') {
389-
/**
390-
* Format date
391-
*/
392-
foreach ($this->_axisLabels[$idx] as $_index => $_label) {
393-
if ($_label != '') {
394-
$period = new \DateTime($_label, new \DateTimeZone($timezoneLocal));
395-
switch ($this->getDataHelper()->getParam('period')) {
396-
case '24h':
397-
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
398-
$period->setTime($period->format('H'), 0, 0),
399-
\IntlDateFormatter::NONE,
400-
\IntlDateFormatter::SHORT
401-
);
402-
break;
403-
case '7d':
404-
case '1m':
405-
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
406-
$period,
407-
\IntlDateFormatter::SHORT,
408-
\IntlDateFormatter::NONE
409-
);
410-
break;
411-
case '1y':
412-
case '2y':
413-
$this->_axisLabels[$idx][$_index] = date('m/Y', strtotime($_label));
414-
break;
415-
}
416-
} else {
417-
$this->_axisLabels[$idx][$_index] = '';
418-
}
419-
}
420-
352+
$this->formatAxisLabelDate($idx, $timezoneLocal);
421353
$tmpstring = implode('|', $this->_axisLabels[$idx]);
422-
423354
$valueBuffer[] = $indexid . ":|" . $tmpstring;
424355
} elseif ($idx == 'y') {
425356
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
@@ -447,6 +378,46 @@ public function getChartUrl($directUrl = true)
447378
}
448379
}
449380

381+
/**
382+
* Format dates for axis labels
383+
*
384+
* @param string $idx
385+
* @param string $timezoneLocal
386+
*
387+
* @return void
388+
*/
389+
private function formatAxisLabelDate($idx, $timezoneLocal)
390+
{
391+
foreach ($this->_axisLabels[$idx] as $_index => $_label) {
392+
if ($_label != '') {
393+
$period = new \DateTime($_label, new \DateTimeZone($timezoneLocal));
394+
switch ($this->getDataHelper()->getParam('period')) {
395+
case '24h':
396+
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
397+
$period->setTime($period->format('H'), 0, 0),
398+
\IntlDateFormatter::NONE,
399+
\IntlDateFormatter::SHORT
400+
);
401+
break;
402+
case '7d':
403+
case '1m':
404+
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
405+
$period,
406+
\IntlDateFormatter::SHORT,
407+
\IntlDateFormatter::NONE
408+
);
409+
break;
410+
case '1y':
411+
case '2y':
412+
$this->_axisLabels[$idx][$_index] = date('m/Y', strtotime($_label));
413+
break;
414+
}
415+
} else {
416+
$this->_axisLabels[$idx][$_index] = '';
417+
}
418+
}
419+
}
420+
450421
/**
451422
* Get rows data
452423
*
@@ -540,6 +511,8 @@ protected function getHeight()
540511
}
541512

542513
/**
514+
* Sets data helper
515+
*
543516
* @param \Magento\Backend\Helper\Dashboard\AbstractDashboard $dataHelper
544517
* @return void
545518
*/

app/code/Magento/Backup/Controller/Adminhtml/Index/Create.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function execute()
5858
$this->_coreRegistry->register('backup_manager', $backupManager);
5959

6060
if ($this->getRequest()->getParam('maintenance_mode')) {
61-
if (!$this->maintenanceMode->set(true)) {
61+
$this->maintenanceMode->set(true);
62+
63+
if (!$this->maintenanceMode->isOn()) {
6264
$response->setError(
6365
__(
6466
'You need more permissions to activate maintenance mode right now.'

app/code/Magento/Backup/Controller/Adminhtml/Index/Rollback.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
*/
77
namespace Magento\Backup\Controller\Adminhtml\Index;
88

9+
use Magento\Framework\App\Action\HttpPostActionInterface;
910
use Magento\Framework\App\Filesystem\DirectoryList;
1011
use Magento\Framework\Filesystem;
1112

1213
/**
14+
* Backup rollback controller.
15+
*
1316
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1417
*/
15-
class Rollback extends \Magento\Backup\Controller\Adminhtml\Index
18+
class Rollback extends \Magento\Backup\Controller\Adminhtml\Index implements HttpPostActionInterface
1619
{
1720
/**
1821
* Rollback Action
@@ -82,7 +85,9 @@ public function execute()
8285
}
8386

8487
if ($this->getRequest()->getParam('maintenance_mode')) {
85-
if (!$this->maintenanceMode->set(true)) {
88+
$this->maintenanceMode->set(true);
89+
90+
if (!$this->maintenanceMode->isOn()) {
8691
$response->setError(
8792
__(
8893
'You need more permissions to activate maintenance mode right now.'
@@ -122,6 +127,7 @@ public function execute()
122127
$adminSession->destroy();
123128

124129
$response->setRedirectUrl($this->getUrl('*'));
130+
// phpcs:disable Magento2.Exceptions.ThrowCatch
125131
} catch (\Magento\Framework\Backup\Exception\CantLoadSnapshot $e) {
126132
$errorMsg = __('We can\'t find the backup file.');
127133
} catch (\Magento\Framework\Backup\Exception\FtpConnectionFailed $e) {

app/code/Magento/Braintree/Controller/Paypal/Review.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\Exception\LocalizedException;
1515
use Magento\Framework\App\Action\HttpPostActionInterface;
1616
use Magento\Framework\App\Action\HttpGetActionInterface;
17+
use Magento\Payment\Model\Method\Logger;
1718

1819
/**
1920
* Class Review
@@ -25,6 +26,11 @@ class Review extends AbstractAction implements HttpPostActionInterface, HttpGetA
2526
*/
2627
private $quoteUpdater;
2728

29+
/**
30+
* @var Logger
31+
*/
32+
private $logger;
33+
2834
/**
2935
* @var string
3036
*/
@@ -37,15 +43,18 @@ class Review extends AbstractAction implements HttpPostActionInterface, HttpGetA
3743
* @param Config $config
3844
* @param Session $checkoutSession
3945
* @param QuoteUpdater $quoteUpdater
46+
* @param Logger $logger
4047
*/
4148
public function __construct(
4249
Context $context,
4350
Config $config,
4451
Session $checkoutSession,
45-
QuoteUpdater $quoteUpdater
52+
QuoteUpdater $quoteUpdater,
53+
Logger $logger
4654
) {
4755
parent::__construct($context, $config, $checkoutSession);
4856
$this->quoteUpdater = $quoteUpdater;
57+
$this->logger = $logger;
4958
}
5059

5160
/**
@@ -57,6 +66,7 @@ public function execute()
5766
$this->getRequest()->getPostValue('result', '{}'),
5867
true
5968
);
69+
$this->logger->debug($requestData);
6070
$quote = $this->checkoutSession->getQuote();
6171

6272
try {

app/code/Magento/Braintree/Model/Paypal/Helper/QuoteUpdater.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ private function updateShippingAddress(Quote $quote, array $details)
123123
{
124124
$shippingAddress = $quote->getShippingAddress();
125125

126-
$shippingAddress->setLastname($details['lastName']);
127-
$shippingAddress->setFirstname($details['firstName']);
126+
$shippingAddress->setLastname($this->getShippingRecipientLastName($details));
127+
$shippingAddress->setFirstname($this->getShippingRecipientFirstName($details));
128128
$shippingAddress->setEmail($details['email']);
129129

130130
$shippingAddress->setCollectShippingRates(true);
@@ -188,4 +188,30 @@ private function updateAddressData(Address $address, array $addressData)
188188
$address->setSameAsBilling(false);
189189
$address->setCustomerAddressId(null);
190190
}
191+
192+
/**
193+
* Returns shipping recipient first name.
194+
*
195+
* @param array $details
196+
* @return string
197+
*/
198+
private function getShippingRecipientFirstName(array $details)
199+
{
200+
return isset($details['shippingAddress']['recipientName'])
201+
? explode(' ', $details['shippingAddress']['recipientName'], 2)[0]
202+
: $details['firstName'];
203+
}
204+
205+
/**
206+
* Returns shipping recipient last name.
207+
*
208+
* @param array $details
209+
* @return string
210+
*/
211+
private function getShippingRecipientLastName(array $details)
212+
{
213+
return isset($details['shippingAddress']['recipientName'])
214+
? explode(' ', $details['shippingAddress']['recipientName'], 2)[1]
215+
: $details['lastName'];
216+
}
191217
}

0 commit comments

Comments
 (0)