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
00035 class Mage_Adminhtml_Block_Sales_Order_Create extends Mage_Adminhtml_Block_Widget_Form_Container
00036 {
00037 public function __construct()
00038 {
00039 $this->_objectId = 'order_id';
00040 $this->_controller = 'sales_order';
00041 $this->_mode = 'create';
00042
00043 parent::__construct();
00044
00045 $this->setId('sales_order_create');
00046
00047 $customerId = $this->_getSession()->getCustomerId();
00048 $storeId = $this->_getSession()->getStoreId();
00049
00050
00051 $this->_updateButton('save', 'label', Mage::helper('sales')->__('Submit Order'));
00052 $this->_updateButton('save', 'onclick', "order.submit()");
00053 $this->_updateButton('save', 'id', 'submit_order_top_button');
00054 if (is_null($customerId) || !$storeId) {
00055 $this->_updateButton('save', 'style', 'display:none');
00056 }
00057
00058 $this->_updateButton('back', 'id', 'back_order_top_button');
00059 $this->_updateButton('reset', 'id', 'reset_order_top_button');
00060
00061 if (is_null($customerId)) {
00062 $this->_updateButton('reset', 'style', 'display:none');
00063 } else {
00064 $this->_updateButton('back', 'style', 'display:none');
00065 }
00066
00067
00068 $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_order/') . '\');');
00069
00070 $confirm = Mage::helper('sales')->__('Are you sure you want to cancel this order?');
00071 $this->_updateButton('reset', 'label', Mage::helper('sales')->__('Cancel'));
00072 $this->_updateButton('reset', 'class', 'cancel');
00073 $this->_updateButton('reset', 'onclick', 'deleteConfirm(\''.$confirm.'\', \'' . $this->getCancelUrl() . '\')');
00074
00075 }
00076
00077 public function getHeaderHtml()
00078 {
00079 $out = '<div id="order-header">';
00080 $out.= $this->getLayout()->createBlock('adminhtml/sales_order_create_header')->toHtml();
00081 $out.= '</div>';
00082 return $out;
00083 }
00084
00085 public function getHeaderWidth()
00086 {
00087 return 'width: 70%;';
00088 }
00089
00090
00091
00092
00093
00094
00095 protected function _getSession()
00096 {
00097 return Mage::getSingleton('adminhtml/session_quote');
00098 }
00099
00100 public function getCancelUrl()
00101 {
00102 if ($this->_getSession()->getOrder()->getId()) {
00103 $url = $this->getUrl('*/sales_order/view', array(
00104 'order_id'=>Mage::getSingleton('adminhtml/session_quote')->getOrder()->getId()
00105 ));
00106 }
00107 else {
00108 $url = $this->getUrl('*
00109
00110
00111
00112
00113
00114