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: class Mage_Adminhtml_Block_Customer_Group_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
35: {
36: 37: 38:
39: protected function _prepareLayout()
40: {
41: parent::_prepareLayout();
42: $form = new Varien_Data_Form();
43: $customerGroup = Mage::registry('current_group');
44:
45: $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('customer')->__('Group Information')));
46:
47: $validateClass = sprintf('required-entry validate-length maximum-length-%d',
48: Mage_Customer_Model_Group::GROUP_CODE_MAX_LENGTH);
49: $name = $fieldset->addField('customer_group_code', 'text',
50: array(
51: 'name' => 'code',
52: 'label' => Mage::helper('customer')->__('Group Name'),
53: 'title' => Mage::helper('customer')->__('Group Name'),
54: 'note' => Mage::helper('customer')->__('Maximum length must be less then %s symbols', Mage_Customer_Model_Group::GROUP_CODE_MAX_LENGTH),
55: 'class' => $validateClass,
56: 'required' => true,
57: )
58: );
59:
60: if ($customerGroup->getId()==0 && $customerGroup->getCustomerGroupCode() ) {
61: $name->setDisabled(true);
62: }
63:
64: $fieldset->addField('tax_class_id', 'select',
65: array(
66: 'name' => 'tax_class',
67: 'label' => Mage::helper('customer')->__('Tax Class'),
68: 'title' => Mage::helper('customer')->__('Tax Class'),
69: 'class' => 'required-entry',
70: 'required' => true,
71: 'values' => Mage::getSingleton('tax/class_source_customer')->toOptionArray()
72: )
73: );
74:
75: if (!is_null($customerGroup->getId())) {
76:
77: $form->addField('id', 'hidden',
78: array(
79: 'name' => 'id',
80: 'value' => $customerGroup->getId(),
81: )
82: );
83: }
84:
85: if( Mage::getSingleton('adminhtml/session')->getCustomerGroupData() ) {
86: $form->addValues(Mage::getSingleton('adminhtml/session')->getCustomerGroupData());
87: Mage::getSingleton('adminhtml/session')->setCustomerGroupData(null);
88: } else {
89: $form->addValues($customerGroup->getData());
90: }
91:
92: $form->setUseContainer(true);
93: $form->setId('edit_form');
94: $form->setAction($this->getUrl('*/*/save'));
95: $this->setForm($form);
96: }
97: }
98: