00001 <?php 00002 /** 00003 * Magento 00004 * 00005 * NOTICE OF LICENSE 00006 * 00007 * This source file is subject to the Open Software License (OSL 3.0) 00008 * that is bundled with this package in the file LICENSE.txt. 00009 * It is also available through the world-wide-web at this URL: 00010 * http://opensource.org/licenses/osl-3.0.php 00011 * If you did not receive a copy of the license and are unable to 00012 * obtain it through the world-wide-web, please send an email 00013 * to license@magentocommerce.com so we can send you a copy immediately. 00014 * 00015 * DISCLAIMER 00016 * 00017 * Do not edit or add to this file if you wish to upgrade Magento to newer 00018 * versions in the future. If you wish to customize Magento for your 00019 * needs please refer to http://www.magentocommerce.com for more information. 00020 * 00021 * @category Mage 00022 * @package Mage_Adminhtml 00023 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) 00024 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 00025 */ 00026 00027 /** 00028 * Adminhtml shipment items grid 00029 * 00030 * @category Mage 00031 * @package Mage_Adminhtml 00032 * @author Magento Core Team <core@magentocommerce.com> 00033 */ 00034 00035 class Mage_Adminhtml_Block_Sales_Order_Shipment_Create_Items extends Mage_Adminhtml_Block_Sales_Items_Abstract 00036 { 00037 /** 00038 * Retrieve invoice order 00039 * 00040 * @return Mage_Sales_Model_Order 00041 */ 00042 public function getOrder() 00043 { 00044 return $this->getShipment()->getOrder(); 00045 } 00046 00047 /** 00048 * Retrieve source 00049 * 00050 * @return Mage_Sales_Model_Order_Invoice 00051 */ 00052 public function getSource() 00053 { 00054 return $this->getShipment(); 00055 } 00056 00057 /** 00058 * Retrieve shipment model instance 00059 * 00060 * @return Mage_Sales_Model_Order_Shipment 00061 */ 00062 public function getShipment() 00063 { 00064 return Mage::registry('current_shipment'); 00065 } 00066 00067 /** 00068 * Prepare child blocks 00069 */ 00070 protected function _beforeToHtml() 00071 { 00072 $this->setChild( 00073 'submit_button', 00074 $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array( 00075 'label' => Mage::helper('sales')->__('Submit Shipment'), 00076 'class' => 'save submit-button', 00077 'onclick' => '$(\'edit_form\').submit()', 00078 )) 00079 ); 00080 00081 return parent::_beforeToHtml(); 00082 } 00083 00084 public function formatPrice($price) 00085 { 00086 return $this->getShipment()->getOrder()->formatPrice($price); 00087 } 00088 00089 public function getUpdateButtonHtml() 00090 { 00091 return $this->getChildHtml('update_button'); 00092 } 00093 00094 public function getUpdateUrl() 00095 { 00096 return $this->getUrl('*/*/updateQty', array('order_id'=>$this->getShipment()->getOrderId())); 00097 } 00098 00099 public function canShipPartially() 00100 { 00101 $value = Mage::registry('current_shipment')->getOrder()->getCanShipPartially(); 00102 if (!is_null($value) && !$value) { 00103 return false; 00104 } 00105 return true; 00106 } 00107 00108 public function canShipPartiallyItem() 00109 { 00110 $value = Mage::registry('current_shipment')->getOrder()->getCanShipPartiallyItem(); 00111 if (!is_null($value) && !$value) { 00112 return false; 00113 } 00114 return true; 00115 } 00116 00117 public function isShipmentRegular() 00118 { 00119 if (!$this->canShipPartiallyItem() || !$this->canShipPartially()) { 00120 return false; 00121 } 00122 return true; 00123 } 00124 00125 public function canSendShipmentEmail() 00126 { 00127 return Mage::helper('sales')->canSendNewShipmentEmail($this->getOrder()->getStore()->getId()); 00128 } 00129 }