forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented MAGETWO-11122: Configurable Grids (magento#471)
- converted Magento\Sales\Block\Adminhtml\Order\View\Tab\Creditmemos to new layout xml config format
- Loading branch information
Showing
6 changed files
with
225 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@magentocommerce.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Magento to newer | ||
* versions in the future. If you wish to customize Magento for your | ||
* needs please refer to http://www.magentocommerce.com for more information. | ||
* | ||
* @category Magento | ||
* @package Magento_Sales | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace Magento\Sales\Model\Order; | ||
|
||
/** | ||
* Credit memo collection updater on credit memos tab of view order page | ||
*/ | ||
class CreditmemosUpdater implements \Magento\Core\Model\Layout\Argument\UpdaterInterface | ||
{ | ||
/** | ||
* @var \Magento\Core\Model\Registry | ||
*/ | ||
protected $_registryManager; | ||
|
||
/** | ||
* @param \Magento\Core\Model\Registry $registryManager | ||
*/ | ||
public function __construct(\Magento\Core\Model\Registry $registryManager) | ||
{ | ||
$this->_registryManager = $registryManager; | ||
} | ||
|
||
/** | ||
* Add order filter | ||
* | ||
* @param \Magento\Sales\Model\Resource\Order\Creditmemo\Grid\Collection $argument | ||
* @return mixed | ||
* @throws \DomainException | ||
*/ | ||
public function update($argument) | ||
{ | ||
$order = $this->_registryManager->registry('current_order'); | ||
|
||
if (!$order) { | ||
throw new \DomainException('Undefined order object'); | ||
} | ||
|
||
$argument->setOrderFilter($order->getId()); | ||
return $argument; | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
app/code/Magento/Sales/view/adminhtml/layout/sales_order_creditmemo_grid_block.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Magento | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License (AFL 3.0) | ||
* that is bundled with this package in the file LICENSE_AFL.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/afl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@magentocommerce.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Magento to newer | ||
* versions in the future. If you wish to customize Magento for your | ||
* needs please refer to http://www.magentocommerce.com for more information. | ||
* | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<referenceBlock name="sales_order_creditmemo.grid.container"> | ||
<block class="Magento\Sales\Block\Adminhtml\Creditmemo\Grid" name="sales.order_creditmemo.grid" as="grid"> | ||
<arguments> | ||
<argument name="id" xsi:type="string">sales_order_creditmemo_grid</argument> | ||
<argument name="dataSource" xsi:type="object"> | ||
<value>Magento\Sales\Model\Resource\Order\Creditmemo\Grid\Collection</value> | ||
<updater>Magento\Sales\Model\Order\CreditmemosUpdater</updater> | ||
</argument> | ||
<argument name="use_ajax" xsi:type="string">true</argument> | ||
<argument name="default_sort" xsi:type="string">created_at</argument> | ||
<argument name="default_dir" xsi:type="string">DESC</argument> | ||
<argument name="save_parameters_in_session" xsi:type="string">1</argument> | ||
<argument name="grid_url" xsi:type="url" path="sales/order/creditmemos"> | ||
<param name="_current">1</param> | ||
</argument> | ||
</arguments> | ||
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="sales.order_creditmemo.grid.columnSet"> | ||
<arguments> | ||
<argument name="id" xsi:type="string">sales_order_creditmemo_grid</argument> | ||
<argument name="rowUrl" xsi:type="array"> | ||
<item name="generatorClass" xsi:type="string">Magento\Sales\Model\Grid\Row\UrlGenerator</item> | ||
<item name="path" xsi:type="string">sales/order_creditmemo/view</item> | ||
<item name="extraParamsTemplate" xsi:type="array"> | ||
<item name="creditmemo_id" xsi:type="string">getId</item> | ||
</item> | ||
</argument> | ||
</arguments> | ||
<block class="Magento\Backend\Block\Widget\Grid\Column" as="real_creditmemo_id"> | ||
<arguments> | ||
<argument name="header" xsi:type="string" translate="true">Credit Memo</argument> | ||
<argument name="type" xsi:type="string">text</argument> | ||
<argument name="index" xsi:type="string">increment_id</argument> | ||
<argument name="id" xsi:type="string">real_creditmemo_id</argument> | ||
<argument name="header_css_class" xsi:type="string">col-memo-number</argument> | ||
<argument name="column_css_class" xsi:type="string">col-memo-number</argument> | ||
</arguments> | ||
</block> | ||
<block class="Magento\Backend\Block\Widget\Grid\Column" as="billing_name"> | ||
<arguments> | ||
<argument name="id" xsi:type="string">billing_name</argument> | ||
<argument name="header" xsi:type="string" translate="true">Bill-to Name</argument> | ||
<argument name="index" xsi:type="string">billing_name</argument> | ||
<argument name="header_css_class" xsi:type="string">col-bill-to-name</argument> | ||
<argument name="column_css_class" xsi:type="string">col-bill-to-name</argument> | ||
</arguments> | ||
</block> | ||
<block class="Magento\Backend\Block\Widget\Grid\Column" as="created_at"> | ||
<arguments> | ||
<argument name="header" xsi:type="string" translate="true">Created</argument> | ||
<argument name="type" xsi:type="string">datetime</argument> | ||
<argument name="index" xsi:type="string">created_at</argument> | ||
<argument name="id" xsi:type="string">created_at</argument> | ||
<argument name="header_css_class" xsi:type="string">col-period</argument> | ||
<argument name="column_css_class" xsi:type="string">col-period</argument> | ||
</arguments> | ||
</block> | ||
<block class="Magento\Backend\Block\Widget\Grid\Column" as="state"> | ||
<arguments> | ||
<argument name="id" xsi:type="string">state</argument> | ||
<argument name="header" xsi:type="string" translate="true">Status</argument> | ||
<argument name="type" xsi:type="string">options</argument> | ||
<argument name="index" xsi:type="string">state</argument> | ||
<argument name="options" xsi:type="options" model="Magento\Sales\Model\Resource\Order\Creditmemo\Grid\StatusesArray"/> | ||
<argument name="header_css_class" xsi:type="string">col-status</argument> | ||
<argument name="column_css_class" xsi:type="string">col-status</argument> | ||
</arguments> | ||
</block> | ||
<block class="Magento\Backend\Block\Widget\Grid\Column" as="base_grand_total"> | ||
<arguments> | ||
<argument name="id" xsi:type="string">grand_total</argument> | ||
<argument name="header" xsi:type="string" translate="true">Refunded</argument> | ||
<argument name="type" xsi:type="string">currency</argument> | ||
<argument name="currency" xsi:type="string">order_currency_code</argument> | ||
<argument name="rate" xsi:type="string">1</argument> | ||
<argument name="index" xsi:type="string">grand_total</argument> | ||
<argument name="header_css_class" xsi:type="string">col-refunded</argument> | ||
<argument name="column_css_class" xsi:type="string">col-refunded</argument> | ||
</arguments> | ||
</block> | ||
</block> | ||
</block> | ||
</referenceBlock> | ||
</layout> |
Oops, something went wrong.