From 09cf4a270fdbfc8f6bdbe4678fbcff75a61eb421 Mon Sep 17 00:00:00 2001 From: Nadiya Syvokonenko Date: Tue, 18 Aug 2015 15:40:44 +0300 Subject: [PATCH 1/6] MAGETWO-41116: Backend returned broken json when inline translate mode is enabled --- .../Magento/Cms/Ui/Component/Listing/Column/PageActions.php | 4 ++-- app/code/Magento/Ui/view/base/web/js/grid/provider.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php b/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php index b5b914db4cf5b..08379991a92b5 100644 --- a/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php +++ b/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php @@ -75,8 +75,8 @@ public function prepareDataSource(array & $dataSource) 'href' => $this->urlBuilder->getUrl(self::CMS_URL_PATH_DELETE, ['page_id' => $item['page_id']]), 'label' => __('Delete'), 'confirm' => [ - 'title' => __('Delete "${ $.$data.title }"'), - 'message' => __('Are you sure you wan\'t to delete a "${ $.$data.title }" record?') + 'title' => __('Delete ${ $.$data.title }'), + 'message' => __('Are you sure you wan\'t to delete a ${ $.$data.title } record?') ] ]; } diff --git a/app/code/Magento/Ui/view/base/web/js/grid/provider.js b/app/code/Magento/Ui/view/base/web/js/grid/provider.js index dfcbb887157d2..d8e77a7c11999 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/provider.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/provider.js @@ -64,7 +64,7 @@ define([ */ onError: function () { alert({ - content: $t('Something go wrong') + content: $t('Something goes wrong') }); }, From e774a6755e327cd59f93073143cd0d4e97bbfc98 Mon Sep 17 00:00:00 2001 From: Michael Logvin Date: Tue, 18 Aug 2015 18:28:42 +0300 Subject: [PATCH 2/6] MAGETWO-41473: [GITHUB] Incorrect Order date at Customer Area > My Orders #1667 --- .../Magento/Sales/view/frontend/templates/order/comments.phtml | 2 +- .../Magento/Sales/view/frontend/templates/order/history.phtml | 2 +- .../Sales/view/frontend/templates/order/order_comments.phtml | 2 +- .../Sales/view/frontend/templates/order/order_date.phtml | 2 +- .../Magento/Sales/view/frontend/templates/order/recent.phtml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Sales/view/frontend/templates/order/comments.phtml b/app/code/Magento/Sales/view/frontend/templates/order/comments.phtml index 4027cb5b2337a..671a90b078929 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/comments.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/comments.phtml @@ -18,7 +18,7 @@

getTitle() ?>

getComments() as $_commentItem): ?> -
formatDate($_commentItem->getCreatedAtStoreDate(), \IntlDateFormatter::MEDIUM, true) ?>
+
formatDate($_commentItem->getCreatedAt(), \IntlDateFormatter::MEDIUM, true) ?>
escapeHtml($_commentItem->getComment()) ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml index 5b2b271ad8cb6..ce572054fb822 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml @@ -27,7 +27,7 @@ getRealOrderId() ?> - formatDate($_order->getCreatedAtStoreDate()) ?> + formatDate($_order->getCreatedAt()) ?> getShippingAddress() ? $block->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?> formatPrice($_order->getGrandTotal()) ?> getStatusLabel() ?> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/order_comments.phtml b/app/code/Magento/Sales/view/frontend/templates/order/order_comments.phtml index c4bedbcdb5aeb..85c5aae6291b7 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/order_comments.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/order_comments.phtml @@ -16,7 +16,7 @@
-
formatDate($_historyItem->getCreatedAtStoreDate(), \IntlDateFormatter::MEDIUM, true) ?>
+
formatDate($_historyItem->getCreatedAt(), \IntlDateFormatter::MEDIUM, true) ?>
escapeHtml($_historyItem->getComment()) ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml b/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml index 4558eccaf040a..818bda658ecee 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml @@ -8,4 +8,4 @@ ?> -
Order Date: %1', '' . $block->formatDate($block->getOrder()->getCreatedAtStoreDate(), \IntlDateFormatter::LONG) . '') ?>
+
Order Date: %1', '' . $block->formatDate($block->getOrder()->getCreatedAt(), \IntlDateFormatter::LONG) . '') ?>
diff --git a/app/code/Magento/Sales/view/frontend/templates/order/recent.phtml b/app/code/Magento/Sales/view/frontend/templates/order/recent.phtml index d38342f88661e..332771ed62f4d 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/recent.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/recent.phtml @@ -37,7 +37,7 @@ getRealOrderId() ?> - formatDate($_order->getCreatedAtStoreDate()) ?> + formatDate($_order->getCreatedAt()) ?> getShippingAddress() ? $block->escapeHtml($_order->getShippingAddress()->getName()) : ' ' ?> formatPrice($_order->getGrandTotal()) ?> getStatusLabel() ?> From ed36892259660a767391eb2d0cace6ce446deb9c Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 19 Aug 2015 20:39:54 +0300 Subject: [PATCH 3/6] MAGETWO-41855: Payment doesn't have order on TransactionDetail page --- .../Sales/Block/Adminhtml/Transactions/Detail.php | 2 +- app/code/Magento/Sales/Model/Order/Payment.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php index c05b79c32ce78..75578a01930a7 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php @@ -81,7 +81,7 @@ protected function _construct() if ($this->_authorization->isAllowed( 'Magento_Sales::transactions_fetch' - ) && $this->orderPaymentRepository->get($this->_txn->getId())->getMethodInstance()->canFetchTransactionInfo() + ) && $this->orderPaymentRepository->get($this->_txn->getPaymentId())->getMethodInstance()->canFetchTransactionInfo() ) { $fetchUrl = $this->getUrl('sales/*/fetch', ['_current' => true]); $this->buttonList->add( diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index 3811b28fa58fd..a99674102d75c 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -9,6 +9,7 @@ namespace Magento\Sales\Model\Order; use Magento\Framework\Pricing\PriceCurrencyInterface; +use Magento\Sales\Api\OrderRepositoryInterface; use Magento\Sales\Model\Order\Payment\Info; use Magento\Sales\Api\Data\OrderPaymentInterface; use Magento\Sales\Model\Order; @@ -97,6 +98,11 @@ class Payment extends Info implements OrderPaymentInterface */ protected $orderPaymentProcessor; + /** + * @var OrderRepositoryInterface + */ + protected $orderRepository; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -109,6 +115,8 @@ class Payment extends Info implements OrderPaymentInterface * @param \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository * @param \Magento\Sales\Model\Order\Payment\Transaction\ManagerInterface $transactionManager * @param Transaction\BuilderInterface $transactionBuilder + * @param Payment\Processor $paymentProcessor + * @param OrderRepositoryInterface $orderRepository * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data @@ -127,6 +135,7 @@ public function __construct( ManagerInterface $transactionManager, \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $transactionBuilder, \Magento\Sales\Model\Order\Payment\Processor $paymentProcessor, + OrderRepositoryInterface $orderRepository, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [] @@ -137,6 +146,7 @@ public function __construct( $this->transactionManager = $transactionManager; $this->transactionBuilder = $transactionBuilder; $this->orderPaymentProcessor = $paymentProcessor; + $this->orderRepository = $orderRepository; parent::__construct( $context, $registry, @@ -178,11 +188,16 @@ public function setOrder(Order $order) * Retrieve order model object * * @codeCoverageIgnore + * @deprecated * * @return Order */ public function getOrder() { + if (!$this->_order && $this->getParentId()) { + $this->_order = $this->orderRepository->get($this->getParentId()); + } + return $this->_order; } From 8c7fae5a12c1ba80a309f8440de098c435873711 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna Date: Wed, 19 Aug 2015 20:56:36 +0300 Subject: [PATCH 4/6] MAGETWO-41855: Payment doesn't have order on TransactionDetail page --- .../Test/Unit/Model/Order/PaymentTest.php | 54 +++++++++++++------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php index bae07f65c98ee..2a0b28329abf4 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/PaymentTest.php @@ -17,6 +17,7 @@ */ class PaymentTest extends \PHPUnit_Framework_TestCase { + private $mockContext; /** * @var Payment */ @@ -91,9 +92,13 @@ class PaymentTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Sales\Model\Order\Payment\Processor|\PHPUnit_Framework_MockObject_MockObject */ - protected $paymentProcessor; + /** + * @var \Magento\Sales\Model\OrderRepository|\PHPUnit_Framework_MockObject_MockObject + */ + protected $orderRepository; + /** * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -105,11 +110,11 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $context = $this->getMockBuilder('Magento\Framework\Model\Context') + $this->mockContext = $this->getMockBuilder('Magento\Framework\Model\Context') ->disableOriginalConstructor() ->getMock(); - $context->expects($this->once()) + $this->mockContext->expects($this->atLeastOnce()) ->method('getEventDispatcher') ->will($this->returnValue($this->eventManagerMock)); @@ -132,6 +137,7 @@ protected function setUp() ->setMethods(['get', 'getByTransactionType', 'getByTransactionId']) ->getMock(); $this->paymentProcessor = $this->getMock('Magento\Sales\Model\Order\Payment\Processor', [], [], '', false); + $this->orderRepository = $this->getMock('Magento\Sales\Model\OrderRepository', ['get'], [], '', false); $this->priceCurrencyMock->expects($this->any()) ->method('format') @@ -259,7 +265,10 @@ function ($value) { false ); - $this->initPayment($context); + $this->payment = $this->initPayment(); + $this->payment->setMethod('any'); + $this->payment->setOrder($this->orderMock); + $this->transactionId = 100; } protected function tearDown() @@ -1212,6 +1221,26 @@ public function testPay() $this->assertEquals($expects['base_shipping_captured'], $this->payment->getData('base_shipping_captured')); } + public function testGetOrder() + { + $payment = $this->initPayment(); + $this->orderRepository->expects($this->once())->method('get')->willReturn($this->orderMock); + $payment->setParentId(1211); + $this->assertSame($this->orderMock, $payment->getOrder()); + } + + public function testGetOrderDefault() + { + $this->orderRepository->expects($this->never())->method('get'); + $this->assertSame($this->orderMock, $this->payment->getOrder()); + } + + public function testGetOrderNull() + { + $payment = $this->initPayment(); + $this->orderRepository->expects($this->never())->method('get'); + $this->assertNull($payment->getOrder()); + } public function testCancelInvoice() { @@ -1408,29 +1437,22 @@ public function boolProvider() ]; } - /** - * @param $context - */ - protected function initPayment($context) + protected function initPayment() { - $this->payment = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( + return (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( 'Magento\Sales\Model\Order\Payment', [ - 'context' => $context, + 'context' => $this->mockContext, 'creditmemoFactory' => $this->creditmemoFactoryMock, 'paymentData' => $this->helperMock, 'priceCurrency' => $this->priceCurrencyMock, 'transactionRepository' => $this->transactionRepositoryMock, 'transactionManager' => $this->transactionManagerMock, 'transactionBuilder' => $this->transactionBuilderMock, - 'paymentProcessor' => $this->paymentProcessor + 'paymentProcessor' => $this->paymentProcessor, + 'orderRepository' => $this->orderRepository ] ); - - $this->payment->setMethod('any'); - $this->payment->setOrder($this->orderMock); - - $this->transactionId = 100; } protected function assertOrderUpdated( From 49ae4d0a83861ccfcadd4319552ed785b0457255 Mon Sep 17 00:00:00 2001 From: Michael Logvin Date: Fri, 21 Aug 2015 15:36:32 +0300 Subject: [PATCH 5/6] MAGETWO-41365: [GITHUB] Required param Coupons Code Helper #1612 --- app/code/Magento/SalesRule/etc/frontend/di.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/code/Magento/SalesRule/etc/frontend/di.xml b/app/code/Magento/SalesRule/etc/frontend/di.xml index 9d224f18b5918..4d1d7c56e730f 100644 --- a/app/code/Magento/SalesRule/etc/frontend/di.xml +++ b/app/code/Magento/SalesRule/etc/frontend/di.xml @@ -12,4 +12,16 @@ + + + + - + + ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + ABCDEFGHIJKLMNOPQRSTUVWXYZ + 0123456789 + + + + From 5acea4a67c7fc2a5264677e6c9f14da9e98615c2 Mon Sep 17 00:00:00 2001 From: Sergey Ivashchenko Date: Fri, 28 Aug 2015 17:22:38 +0300 Subject: [PATCH 6/6] MAGETWO-41590: PR Preparation and processing --- .../Ui/Component/Listing/Column/PageActionsTest.php | 4 ++-- .../Sales/Block/Adminhtml/Transactions/Detail.php | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php b/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php index 21c1d2ec4994e..fdc87499f58ae 100644 --- a/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php +++ b/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php @@ -50,8 +50,8 @@ public function testPrepareItemsByPageId() 'href' => 'test/url/delete', 'label' => __('Delete'), 'confirm' => [ - 'title' => __('Delete "${ $.$data.title }"'), - 'message' => __('Are you sure you wan\'t to delete a "${ $.$data.title }" record?') + 'title' => __('Delete ${ $.$data.title }'), + 'message' => __('Are you sure you wan\'t to delete a ${ $.$data.title } record?') ], ] ], diff --git a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php index 75578a01930a7..126f6e04bdd13 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Transactions/Detail.php @@ -79,10 +79,12 @@ protected function _construct() ['label' => __('Back'), 'onclick' => "setLocation('{$backUrl}')", 'class' => 'back'] ); - if ($this->_authorization->isAllowed( - 'Magento_Sales::transactions_fetch' - ) && $this->orderPaymentRepository->get($this->_txn->getPaymentId())->getMethodInstance()->canFetchTransactionInfo() - ) { + $fetchTransactionAllowed = $this->_authorization->isAllowed('Magento_Sales::transactions_fetch'); + $canFetchTransaction = $this->orderPaymentRepository->get($this->_txn->getPaymentId()) + ->getMethodInstance() + ->canFetchTransactionInfo(); + + if ($fetchTransactionAllowed && $canFetchTransaction) { $fetchUrl = $this->getUrl('sales/*/fetch', ['_current' => true]); $this->buttonList->add( 'fetch',