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_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Widget_Form_Container
35: {
36:
37: public function __construct()
38: {
39: $this->_objectId = 'shipment_id';
40: $this->_controller = 'sales_order_shipment';
41: $this->_mode = 'view';
42:
43: parent::__construct();
44:
45: $this->_removeButton('reset');
46: $this->_removeButton('delete');
47: if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/emails')) {
48: $this->_updateButton('save', 'label', Mage::helper('sales')->__('Send Tracking Information'));
49: $this->_updateButton('save',
50: 'onclick', "deleteConfirm('"
51: . Mage::helper('sales')->__('Are you sure you want to send Shipment email to customer?')
52: . "', '" . $this->getEmailUrl() . "')"
53: );
54: }
55:
56: if ($this->getShipment()->getId()) {
57: $this->_addButton('print', array(
58: 'label' => Mage::helper('sales')->__('Print'),
59: 'class' => 'save',
60: 'onclick' => 'setLocation(\''.$this->getPrintUrl().'\')'
61: )
62: );
63: }
64: }
65:
66: 67: 68: 69: 70:
71: public function getShipment()
72: {
73: return Mage::registry('current_shipment');
74: }
75:
76: public function ()
77: {
78: if ($this->getShipment()->getEmailSent()) {
79: $emailSent = Mage::helper('sales')->__('the shipment email was sent');
80: }
81: else {
82: $emailSent = Mage::helper('sales')->__('the shipment email is not sent');
83: }
84: return Mage::helper('sales')->__('Shipment #%1$s | %3$s (%2$s)', $this->getShipment()->getIncrementId(), $emailSent, $this->formatDate($this->getShipment()->getCreatedAtDate(), 'medium', true));
85: }
86:
87: public function getBackUrl()
88: {
89: return $this->getUrl(
90: '*/sales_order/view',
91: array(
92: 'order_id' => $this->getShipment()->getOrderId(),
93: 'active_tab'=> 'order_shipments'
94: ));
95: }
96:
97: public function getEmailUrl()
98: {
99: return $this->getUrl('*/sales_order_shipment/email', array('shipment_id' => $this->getShipment()->getId()));
100: }
101:
102: public function getPrintUrl()
103: {
104: return $this->getUrl('*/*/print', array(
105: 'invoice_id' => $this->getShipment()->getId()
106: ));
107: }
108:
109: public function updateBackButtonUrl($flag)
110: {
111: if ($flag) {
112: if ($this->getShipment()->getBackUrl()) {
113: return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getShipment()->getBackUrl() . '\')');
114: }
115: return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('*/sales_shipment/') . '\')');
116: }
117: return $this;
118: }
119: }
120: