From bbd9e2a43ed8a95cf7e8a929f0940e6312de4d73 Mon Sep 17 00:00:00 2001 From: "R.S" Date: Fri, 20 Nov 2015 12:28:35 -0500 Subject: [PATCH 1/2] Fix Inconsistency Fix Inconsistency between $this->buttonList->add(...) and $this->addButton(...). See /app/code/Magento/Backend/Block/Widget/Container.php public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar') { $this->buttonList->add($buttonId, $data, $level, $sortOrder, $region); return $this; } --- app/code/Magento/Sales/Block/Adminhtml/Order/View.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index c83fb0f75a98e..6895ccf5979e5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -121,7 +121,7 @@ protected function _construct() if ($this->_isAllowedAction('Magento_Sales::emails') && !$order->isCanceled()) { $message = __('Are you sure you want to send an order email to customer?'); - $this->addButton( + $this->buttonList->add( 'send_notification', [ 'label' => __('Send Email'), @@ -149,7 +149,7 @@ protected function _construct() // invoice action intentionally if ($this->_isAllowedAction('Magento_Sales::invoice') && $order->canVoidPayment()) { $message = __('Are you sure you want to void the payment?'); - $this->addButton( + $this->buttonList->add( 'void_payment', [ 'label' => __('Void'), From cdda40a0107672da3df678f4183fa681ae1317bd Mon Sep 17 00:00:00 2001 From: "R.S" Date: Wed, 25 Nov 2015 12:19:41 -0500 Subject: [PATCH 2/2] Fix Inconsistency Use parent method instead of protected properties --- .../Sales/Block/Adminhtml/Order/View.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index 6895ccf5979e5..72db6998c85ac 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -77,9 +77,9 @@ protected function _construct() parent::_construct(); - $this->buttonList->remove('delete'); - $this->buttonList->remove('reset'); - $this->buttonList->remove('save'); + $this->removeButton('delete'); + $this->removeButton('reset'); + $this->removeButton('save'); $this->setId('sales_order_view'); $order = $this->getOrder(); @@ -92,7 +92,7 @@ protected function _construct() . $this->getEditMessage($order) . '\', url: \'' . $this->getEditUrl() . '\'}).orderEditDialog(\'showDialog\');'; - $this->buttonList->add( + $this->addButton( 'order_edit', [ 'label' => __('Edit'), @@ -106,7 +106,7 @@ protected function _construct() } if ($this->_isAllowedAction('Magento_Sales::cancel') && $order->canCancel()) { - $this->buttonList->add( + $this->addButton( 'order_cancel', [ 'label' => __('Cancel'), @@ -121,7 +121,7 @@ protected function _construct() if ($this->_isAllowedAction('Magento_Sales::emails') && !$order->isCanceled()) { $message = __('Are you sure you want to send an order email to customer?'); - $this->buttonList->add( + $this->addButton( 'send_notification', [ 'label' => __('Send Email'), @@ -140,7 +140,7 @@ protected function _construct() if ($order->getPayment()->getMethodInstance()->isGateway()) { $onClick = "confirmSetLocation('{$message}', '{$this->getCreditmemoUrl()}')"; } - $this->buttonList->add( + $this->addButton( 'order_creditmemo', ['label' => __('Credit Memo'), 'onclick' => $onClick, 'class' => 'credit-memo'] ); @@ -149,7 +149,7 @@ protected function _construct() // invoice action intentionally if ($this->_isAllowedAction('Magento_Sales::invoice') && $order->canVoidPayment()) { $message = __('Are you sure you want to void the payment?'); - $this->buttonList->add( + $this->addButton( 'void_payment', [ 'label' => __('Void'), @@ -159,7 +159,7 @@ protected function _construct() } if ($this->_isAllowedAction('Magento_Sales::hold') && $order->canHold()) { - $this->buttonList->add( + $this->addButton( 'order_hold', [ 'label' => __('Hold'), @@ -173,7 +173,7 @@ protected function _construct() } if ($this->_isAllowedAction('Magento_Sales::unhold') && $order->canUnhold()) { - $this->buttonList->add( + $this->addButton( 'order_unhold', [ 'label' => __('Unhold'), @@ -189,7 +189,7 @@ protected function _construct() if ($this->_isAllowedAction('Magento_Sales::review_payment')) { if ($order->canReviewPayment()) { $message = __('Are you sure you want to accept this payment?'); - $this->buttonList->add( + $this->addButton( 'accept_payment', [ 'label' => __('Accept Payment'), @@ -197,7 +197,7 @@ protected function _construct() ] ); $message = __('Are you sure you want to deny this payment?'); - $this->buttonList->add( + $this->addButton( 'deny_payment', [ 'label' => __('Deny Payment'), @@ -206,7 +206,7 @@ protected function _construct() ); } if ($order->canFetchPaymentReviewUpdate()) { - $this->buttonList->add( + $this->addButton( 'get_review_payment_update', [ 'label' => __('Get Payment Update'), @@ -218,7 +218,7 @@ protected function _construct() if ($this->_isAllowedAction('Magento_Sales::invoice') && $order->canInvoice()) { $_label = $order->getForcedShipmentWithInvoice() ? __('Invoice and Ship') : __('Invoice'); - $this->buttonList->add( + $this->addButton( 'order_invoice', [ 'label' => $_label, @@ -232,7 +232,7 @@ protected function _construct() 'Magento_Sales::ship' ) && $order->canShip() && !$order->getForcedShipmentWithInvoice() ) { - $this->buttonList->add( + $this->addButton( 'order_ship', [ 'label' => __('Ship'), @@ -248,7 +248,7 @@ protected function _construct() $order->getStore() ) && $order->canReorderIgnoreSalable() ) { - $this->buttonList->add( + $this->addButton( 'order_reorder', [ 'label' => __('Reorder'),