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_Sales_Order_Invoice_Create_Form extends Mage_Adminhtml_Block_Sales_Order_Abstract
00035 {
00036
00037
00038
00039
00040
00041 public function getOrder()
00042 {
00043 return $this->getInvoice()->getOrder();
00044 }
00045
00046
00047
00048
00049
00050
00051 public function getSource()
00052 {
00053 return $this->getInvoice();
00054 }
00055
00056
00057
00058
00059
00060
00061 public function getInvoice()
00062 {
00063 return Mage::registry('current_invoice');
00064 }
00065
00066 protected function _prepareLayout()
00067 {
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 $trackingBlock = $this->getLayout()->createBlock('adminhtml/sales_order_invoice_create_tracking');
00078
00079 $this->setChild('tracking', $trackingBlock);
00080
00081
00082
00083
00084
00085
00086
00087 return parent::_prepareLayout();
00088 }
00089
00090 public function getSaveUrl()
00091 {
00092 return $this->getUrl('*/*/save', array('order_id' => $this->getInvoice()->getOrderId()));
00093 }
00094
00095 public function canCreateShipment()
00096 {
00097 foreach ($this->getInvoice()->getAllItems() as $item) {
00098 if ($item->getOrderItem()->getQtyToShip()) {
00099 return true;
00100 }
00101 }
00102 return false;
00103 }
00104
00105 public function hasInvoiceShipmentTypeMismatch() {
00106 foreach ($this->getInvoice()->getAllItems() as $item) {
00107 if ($item->getOrderItem()->isChildrenCalculated() && !$item->getOrderItem()->isShipSeparately()) {
00108 return true;
00109 }
00110 }
00111 return false;
00112 }
00113
00114 public function canShipPartiallyItem()
00115 {
00116 $value = $this->getOrder()->getCanShipPartiallyItem();
00117 if (!is_null($value) && !$value) {
00118 return false;
00119 }
00120 return true;
00121 }
00122
00123
00124
00125
00126
00127
00128 public function getForcedShipmentCreate()
00129 {
00130 return (int) $this->getOrder()->getForcedDoShipmentWithInvoice();
00131 }
00132 }