Skip to content

Commit 1de3379

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.1-develop
Accepted Public Pull Requests: - #16403: [Backport 2.1] Captcha: Added integration tests for checking customer login attempts cleanup (by @rogyar) - #16352: [Backport] Invoice grid shows wrong shipping & handling for partial items invoice. It shows order's shipping & handling instead if invoiced shipping& handling charge (by @gelanivishal) - #16280: MAGETWO-61209: Backport - Fixed issue #7379 with mage/calendar when setting `numberOfM� (by @vasilii-b) Fixed GitHub Issues: - #7379: Calendar widget (jQuery UI DatePicker) with numberOfMonths = 2 or more (reported by @atihomirov) has been fixed in #16280 by @vasilii-b in 2.1-develop branch Related commits: 1. ce38bc8
2 parents 65cceab + b9fc7e2 commit 1de3379

File tree

6 files changed

+149
-6
lines changed

6 files changed

+149
-6
lines changed

app/code/Magento/Sales/etc/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,8 @@
669669
<item name="billing_address" xsi:type="object">BillingAddressAggregator</item>
670670
<item name="shipping_address" xsi:type="object">ShippingAddressAggregator</item>
671671
<item name="shipping_information" xsi:type="string">sales_order.shipping_description</item>
672-
<item name="subtotal" xsi:type="string">sales_order.base_subtotal</item>
673-
<item name="shipping_and_handling" xsi:type="string">sales_order.base_shipping_amount</item>
672+
<item name="subtotal" xsi:type="string">sales_invoice.base_subtotal</item>
673+
<item name="shipping_and_handling" xsi:type="string">sales_invoice.base_shipping_amount</item>
674674
<item name="base_grand_total" xsi:type="string">sales_invoice.base_grand_total</item>
675675
<item name="grand_total" xsi:type="string">sales_invoice.grand_total</item>
676676
<item name="created_at" xsi:type="string">sales_invoice.created_at</item>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Captcha\Observer;
7+
8+
use Magento\Captcha\Model\ResourceModel\Log as CaptchaLog;
9+
use Magento\Captcha\Model\ResourceModel\LogFactory;
10+
use Magento\Framework\Event\ManagerInterface;
11+
use Magento\Framework\ObjectManagerInterface;
12+
13+
/**
14+
* Class ResetAttemptForFrontendAccountEditObserverTest
15+
*
16+
* Test for checking that the customer login attempts are removed after account details edit
17+
*/
18+
class ResetAttemptForFrontendAccountEditObserverTest extends \PHPUnit_Framework_TestCase
19+
{
20+
/**
21+
* @var ObjectManagerInterface
22+
*/
23+
private $objectManager;
24+
25+
public function setUp()
26+
{
27+
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
28+
}
29+
30+
/**
31+
* @magentoDataFixture Magento/Captcha/_files/failed_logins_frontend.php
32+
*/
33+
public function testAccountEditRemovesFailedAttempts()
34+
{
35+
$customerEmail = 'mageuser@dummy.com';
36+
$captchaLogFactory = $this->objectManager->get(LogFactory::class);
37+
$eventManager = $this->objectManager->get(ManagerInterface::class);
38+
39+
$eventManager->dispatch(
40+
'customer_account_edited',
41+
['email' => $customerEmail]
42+
);
43+
44+
/**
45+
* @var CaptchaLog $captchaLog
46+
*/
47+
$captchaLog = $captchaLogFactory->create();
48+
49+
self::assertEquals(0, $captchaLog->countAttemptsByUserLogin($customerEmail));
50+
}
51+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Captcha\Observer;
7+
8+
use Magento\Captcha\Model\ResourceModel\Log as CaptchaLog;
9+
use Magento\Captcha\Model\ResourceModel\LogFactory;
10+
use Magento\Customer\Model\Customer;
11+
use Magento\Customer\Model\CustomerFactory;
12+
use Magento\Framework\Event\ManagerInterface;
13+
use Magento\Framework\ObjectManagerInterface;
14+
15+
/**
16+
* Class ResetAttemptForFrontendObserverTest
17+
*
18+
* Test for checking that the customer login attempts are removed after a successful login
19+
*/
20+
class ResetAttemptForFrontendObserverTest extends \PHPUnit_Framework_TestCase
21+
{
22+
/**
23+
* @var ObjectManagerInterface
24+
*/
25+
private $objectManager;
26+
27+
public function setUp()
28+
{
29+
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
30+
}
31+
32+
/**
33+
* @magentoDataFixture Magento/Captcha/_files/failed_logins_frontend.php
34+
*/
35+
public function testSuccesfulLoginRemovesFailedAttempts()
36+
{
37+
$customerEmail = 'mageuser@dummy.com';
38+
$customerFactory = $this->objectManager->get(CustomerFactory::class);
39+
$captchaLogFactory = $this->objectManager->get(LogFactory::class);
40+
$eventManager = $this->objectManager->get(ManagerInterface::class);
41+
42+
/** @var Customer $customer */
43+
$customer = $customerFactory->create();
44+
$customer->setEmail($customerEmail);
45+
46+
$eventManager->dispatch(
47+
'customer_customer_authenticated',
48+
['model' => $customer, 'password' => 'some_password']
49+
);
50+
51+
/**
52+
* @var CaptchaLog $captchaLog
53+
*/
54+
$captchaLog = $captchaLogFactory->create();
55+
56+
self::assertEquals(0, $captchaLog->countAttemptsByUserLogin($customerEmail));
57+
}
58+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\TestFramework\Helper\Bootstrap;
8+
use Magento\Captcha\Model\ResourceModel\LogFactory;
9+
use Magento\Captcha\Model\ResourceModel\Log;
10+
11+
$objectManager = Bootstrap::getObjectManager();
12+
$logFactory = $objectManager->get(LogFactory::class);
13+
14+
/** @var Log $captchaLog */
15+
$captchaLog = $logFactory->create();
16+
$captchaLog->logAttempt('mageuser@dummy.com');
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\TestFramework\Helper\Bootstrap;
8+
use Magento\Captcha\Model\ResourceModel\LogFactory;
9+
use Magento\Captcha\Model\ResourceModel\Log;
10+
11+
$objectManager = Bootstrap::getObjectManager();
12+
$logFactory = $objectManager->get(LogFactory::class);
13+
14+
/** @var Log $captchaLog */
15+
$captchaLog = $logFactory->create();
16+
$captchaLog->deleteUserAttempts('mageuser@dummy.com');

lib/web/mage/calendar.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,14 @@
238238
firstDay = parseInt(this._get(inst, 'firstDay'), 10);
239239
firstDay = isNaN(firstDay) ? 0 : firstDay;
240240

241-
for (row; row < numMonths[0]; row++) {
241+
for (row = 0; row < numMonths[0]; row++) {
242242
this.maxRows = 4;
243243

244-
for (col; col < numMonths[1]; col++) {
244+
for (col = 0; col < numMonths[1]; col++) {
245245
selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
246246

247+
calender = '';
248+
247249
if (isMultiMonth) {
248250
calender += '<div class="ui-datepicker-group';
249251

@@ -273,7 +275,7 @@
273275
thead = showWeek ?
274276
'<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '';
275277

276-
for (dow; dow < 7; dow++) { // days of the week
278+
for (dow = 0; dow < 7; dow++) { // days of the week
277279
day = (dow + firstDay) % 7;
278280
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ?
279281
' class="ui-datepicker-week-end"' : '') + '>' +
@@ -291,7 +293,7 @@
291293
this.maxRows = numRows;
292294
printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
293295

294-
for (dRow; dRow < numRows; dRow++) { // create date picker rows
296+
for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
295297
calender += '<tr>';
296298
tbody = !showWeek ? '' : '<td class="ui-datepicker-week-col">' +
297299
this._get(inst, 'calculateWeek')(printDate) + '</td>';

0 commit comments

Comments
 (0)