Mage_Adminhtml_Block_Sales_Order_View Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_View:

Mage_Adminhtml_Block_Widget_Form_Container Mage_Adminhtml_Block_Widget_Container Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getOrder ()
 getOrderId ()
 getHeaderText ()
 getUrl ($params='', $params2=array())
 getEditUrl ()
 getCancelUrl ()
 getInvoiceUrl ()
 getCreditmemoUrl ()
 getHoldUrl ()
 getUnholdUrl ()
 getShipUrl ()
 getCommentUrl ()
 getReorderUrl ()

Protected Member Functions

 _isAllowedAction ($action)


Detailed Description

Definition at line 34 of file View.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Mage_Adminhtml_Block_Widget_Form_Container.

Definition at line 37 of file View.php.

00038     {
00039         $this->_objectId    = 'order_id';
00040         $this->_controller  = 'sales_order';
00041         $this->_mode        = 'view';
00042 
00043         parent::__construct();
00044 
00045         $this->_removeButton('delete');
00046         $this->_removeButton('reset');
00047         $this->_removeButton('save');
00048         $this->setId('sales_order_view');
00049 
00050         if ($this->_isAllowedAction('edit') && $this->getOrder()->canEdit()) {
00051             $onclickJs = 'deleteConfirm(\''
00052                 . Mage::helper('sales')->__('Are you sure? This order will be cancelled and a new one will be created instead')
00053                 . '\', \'' . $this->getEditUrl() . '\');';
00054             $this->_addButton('order_edit', array(
00055                 'label'    => Mage::helper('sales')->__('Edit'),
00056                 'onclick'  => $onclickJs,
00057             ));
00058             // see if order has non-editable products as items
00059             $nonEditableTypes = array_keys(Mage::getResourceSingleton('sales/order')->aggregateProductsByTypes(
00060                 $this->getOrder()->getId(), array_keys(Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()), false
00061             ));
00062             if ($nonEditableTypes) {
00063                 $this->_updateButton('order_edit', 'onclick',
00064                     'if (!confirm(\'' . Mage::helper('sales')->__(
00065                         'This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be cancelled and a new order will be placed',
00066                         implode(', ', $nonEditableTypes),
00067                         implode(', ', $nonEditableTypes)
00068                     ) . '\')) return false;' . $onclickJs
00069                 );
00070             }
00071         }
00072 
00073         if ($this->_isAllowedAction('cancel') && $this->getOrder()->canCancel()) {
00074             $message = Mage::helper('sales')->__('Are you sure you want to cancel this order?');
00075             $this->_addButton('order_cancel', array(
00076                 'label'     => Mage::helper('sales')->__('Cancel'),
00077                 'onclick'   => 'deleteConfirm(\''.$message.'\', \'' . $this->getCancelUrl() . '\')',
00078             ));
00079         }
00080 
00081         if ($this->_isAllowedAction('creditmemo') && $this->getOrder()->canCreditmemo()) {
00082             $this->_addButton('order_creditmemo', array(
00083                 'label'     => Mage::helper('sales')->__('Credit Memo'),
00084                 'onclick'   => 'setLocation(\'' . $this->getCreditmemoUrl() . '\')',
00085             ));
00086         }
00087 
00088         if ($this->_isAllowedAction('hold') && $this->getOrder()->canHold()) {
00089             $this->_addButton('order_hold', array(
00090                 'label'     => Mage::helper('sales')->__('Hold'),
00091                 'onclick'   => 'setLocation(\'' . $this->getHoldUrl() . '\')',
00092             ));
00093         }
00094 
00095         if ($this->_isAllowedAction('unhold') && $this->getOrder()->canUnhold()) {
00096             $this->_addButton('order_unhold', array(
00097                 'label'     => Mage::helper('sales')->__('Unhold'),
00098                 'onclick'   => 'setLocation(\'' . $this->getUnholdUrl() . '\')',
00099             ));
00100         }
00101 
00102         if ($this->_isAllowedAction('invoice') && $this->getOrder()->canInvoice()) {
00103             $_label = $this->getOrder()->getForcedDoShipmentWithInvoice()?'Invoice and Ship':'Invoice';
00104             $this->_addButton('order_invoice', array(
00105                 'label'     => Mage::helper('sales')->__('%s', $_label),
00106                 'onclick'   => 'setLocation(\'' . $this->getInvoiceUrl() . '\')',
00107             ));
00108         }
00109 
00110         if ($this->_isAllowedAction('ship') && $this->getOrder()->canShip()
00111             && !$this->getOrder()->getForcedDoShipmentWithInvoice()) {
00112             $this->_addButton('order_ship', array(
00113                 'label'     => Mage::helper('sales')->__('Ship'),
00114                 'onclick'   => 'setLocation(\'' . $this->getShipUrl() . '\')',
00115             ));
00116         }
00117 
00118         if ($this->_isAllowedAction('reorder') && $this->getOrder()->canReorder()) {
00119             $this->_addButton('order_reorder', array(
00120                 'label'     => Mage::helper('sales')->__('Reorder'),
00121                 'onclick'   => 'setLocation(\'' . $this->getReorderUrl() . '\')',
00122             ));
00123         }
00124     }


Member Function Documentation

_isAllowedAction ( action  )  [protected]

Definition at line 212 of file View.php.

00213     {
00214         return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action);
00215     }

getCancelUrl (  ) 

Definition at line 172 of file View.php.

00173     {
00174         return $this->getUrl('*/*/cancel');
00175     }

getCommentUrl (  ) 

Definition at line 202 of file View.php.

00203     {
00204         return $this->getUrl('*/*/comment');
00205     }

getCreditmemoUrl (  ) 

Definition at line 182 of file View.php.

00183     {
00184         return $this->getUrl('*/sales_order_creditmemo/start');
00185     }

getEditUrl (  ) 

Definition at line 167 of file View.php.

00168     {
00169         return $this->getUrl('*/sales_order_edit/start');
00170     }

getHeaderText (  ) 

Get header text

Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Container.

Definition at line 146 of file View.php.

00147     {
00148         if ($_extOrderId = $this->getOrder()->getExtOrderId()) {
00149             $_extOrderId = '[' . $_extOrderId . '] ';
00150         } else {
00151             $_extOrderId = '';
00152         }
00153         $text = Mage::helper('sales')->__('Order # %s %s| Order Date %s',
00154             $this->getOrder()->getRealOrderId(),
00155             $_extOrderId,
00156             $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true)
00157         );
00158         return $text;
00159     }

getHoldUrl (  ) 

Definition at line 187 of file View.php.

00188     {
00189         return $this->getUrl('*/*/hold');
00190     }

getInvoiceUrl (  ) 

Definition at line 177 of file View.php.

00178     {
00179         return $this->getUrl('*/sales_order_invoice/start');
00180     }

getOrder (  ) 

Retrieve order model object

Returns:
Mage_Sales_Model_Order

Definition at line 131 of file View.php.

00132     {
00133         return Mage::registry('sales_order');
00134     }

getOrderId (  ) 

Retrieve Order Identifier

Returns:
int

Definition at line 141 of file View.php.

00142     {
00143         return $this->getOrder()->getId();
00144     }

getReorderUrl (  ) 

Definition at line 207 of file View.php.

00208     {
00209         return $this->getUrl('*/sales_order_create/reorder');
00210     }

getShipUrl (  ) 

Definition at line 197 of file View.php.

00198     {
00199         return $this->getUrl('*/sales_order_shipment/start');
00200     }

getUnholdUrl (  ) 

Definition at line 192 of file View.php.

00193     {
00194         return $this->getUrl('*/*/unhold');
00195     }

getUrl ( route = '',
params = array() 
)

Generate url by route and parameters

Parameters:
string $route
array $params
Returns:
string

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 161 of file View.php.

00162     {
00163         $params2['order_id'] = $this->getOrderId();
00164         return parent::getUrl($params, $params2);
00165     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:01 2009 for Magento by  doxygen 1.5.8