00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Customer_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
00035 {
00036 public function __construct()
00037 {
00038 $this->_objectId = 'id';
00039 $this->_controller = 'customer';
00040
00041 if ($this->getCustomerId() &&
00042 Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/create')) {
00043 $this->_addButton('order', array(
00044 'label' => Mage::helper('customer')->__('Create Order'),
00045 'onclick' => 'setLocation(\'' . $this->getCreateOrderUrl() . '\')',
00046 'class' => 'add',
00047 ), 0);
00048 }
00049
00050 parent::__construct();
00051
00052 $this->_updateButton('save', 'label', Mage::helper('customer')->__('Save Customer'));
00053 $this->_updateButton('delete', 'label', Mage::helper('customer')->__('Delete Customer'));
00054
00055 if (Mage::registry('current_customer')->isReadonly()) {
00056 $this->_removeButton('save');
00057 $this->_removeButton('reset');
00058 }
00059
00060 if (!Mage::registry('current_customer')->isDeleteable()) {
00061 $this->_removeButton('delete');
00062 }
00063 }
00064
00065 public function getCreateOrderUrl()
00066 {
00067 return $this->getUrl('*/sales_order_create/start', array('customer_id' => $this->getCustomerId()));
00068 }
00069
00070 public function getCustomerId()
00071 {
00072 return Mage::registry('current_customer')->getId();
00073 }
00074
00075 public function getHeaderText()
00076 {
00077 if (Mage::registry('current_customer')->getId()) {
00078 return $this->htmlEscape(Mage::registry('current_customer')->getName());
00079 }
00080 else {
00081 return Mage::helper('customer')->__('New Customer');
00082 }
00083 }
00084
00085 public function getValidationUrl()
00086 {
00087 return $this->getUrl('*
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 */save', array(
00106 '_current' => true,
00107 'back' => 'edit',
00108 'tab' => '{{tab_id}}'
00109 ));
00110 }
00111 }