1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34:
35: class Mage_Adminhtml_Block_Tax_Class_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37: public function __construct()
38: {
39: parent::__construct();
40:
41: $this->setId('taxClassForm');
42: }
43:
44: protected function _prepareForm()
45: {
46: $model = Mage::registry('tax_class');
47: $form = new Varien_Data_Form(array(
48: 'id' => 'edit_form',
49: 'action' => $this->getData('action'),
50: 'method' => 'post'
51: ));
52:
53: $classType = $this->getClassType();
54:
55: $this->setTitle($classType == Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER
56: ? Mage::helper('cms')->__('Customer Tax Class Information')
57: : Mage::helper('cms')->__('Product Tax Class Information')
58: );
59:
60: $fieldset = $form->addFieldset('base_fieldset', array(
61: 'legend' => $classType == Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER
62: ? Mage::helper('tax')->__('Customer Tax Class Information')
63: : Mage::helper('tax')->__('Product Tax Class Information')
64: ));
65:
66: $fieldset->addField('class_name', 'text',
67: array(
68: 'name' => 'class_name',
69: 'label' => Mage::helper('tax')->__('Class Name'),
70: 'class' => 'required-entry',
71: 'value' => $model->getClassName(),
72: 'required' => true,
73: )
74: );
75:
76: $fieldset->addField('class_type', 'hidden',
77: array(
78: 'name' => 'class_type',
79: 'value' => $classType,
80: 'no_span' => true
81: )
82: );
83:
84: if ($model->getId()) {
85: $fieldset->addField('class_id', 'hidden',
86: array(
87: 'name' => 'class_id',
88: 'value' => $model->getId(),
89: 'no_span' => true
90: )
91: );
92: }
93:
94: $form->setAction($this->getUrl('*/tax_class/save'));
95: $form->setUseContainer(true);
96: $this->setForm($form);
97:
98: return parent::_prepareForm();
99: }
100: }
101: