1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Sales
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Sales Adminhtml report filter form
29: *
30: * @category Mage
31: * @package Mage_Sales
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Sales_Block_Adminhtml_Report_Filter_Form extends Mage_Adminhtml_Block_Report_Filter_Form
35: {
36: /**
37: * Add fields to base fieldset which are general to sales reports
38: *
39: * @return Mage_Sales_Block_Adminhtml_Report_Filter_Form
40: */
41: protected function _prepareForm()
42: {
43: parent::_prepareForm();
44: $form = $this->getForm();
45: $htmlIdPrefix = $form->getHtmlIdPrefix();
46: /** @var Varien_Data_Form_Element_Fieldset $fieldset */
47: $fieldset = $this->getForm()->getElement('base_fieldset');
48:
49: if (is_object($fieldset) && $fieldset instanceof Varien_Data_Form_Element_Fieldset) {
50:
51: $statuses = Mage::getModel('sales/order_config')->getStatuses();
52: $values = array();
53: foreach ($statuses as $code => $label) {
54: if (false === strpos($code, 'pending')) {
55: $values[] = array(
56: 'label' => Mage::helper('reports')->__($label),
57: 'value' => $code
58: );
59: }
60: }
61:
62: $fieldset->addField('show_order_statuses', 'select', array(
63: 'name' => 'show_order_statuses',
64: 'label' => Mage::helper('reports')->__('Order Status'),
65: 'options' => array(
66: '0' => Mage::helper('reports')->__('Any'),
67: '1' => Mage::helper('reports')->__('Specified'),
68: ),
69: 'note' => Mage::helper('reports')->__('Applies to Any of the Specified Order Statuses'),
70: ), 'to');
71:
72: $fieldset->addField('order_statuses', 'multiselect', array(
73: 'name' => 'order_statuses',
74: 'values' => $values,
75: 'display' => 'none'
76: ), 'show_order_statuses');
77:
78: // define field dependencies
79: if ($this->getFieldVisibility('show_order_statuses') && $this->getFieldVisibility('order_statuses')) {
80: $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
81: ->addFieldMap("{$htmlIdPrefix}show_order_statuses", 'show_order_statuses')
82: ->addFieldMap("{$htmlIdPrefix}order_statuses", 'order_statuses')
83: ->addFieldDependence('order_statuses', 'show_order_statuses', '1')
84: );
85: }
86: }
87:
88: return $this;
89: }
90: }
91: