Go to the documentation of this file.00001 <?php
00002
00008 class Order_Main extends oxAdminDetails
00009 {
00010
00018 public function render()
00019 {
00020 parent::render();
00021
00022 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ($soxId != "-1" && isset($soxId)) {
00024
00025 $oOrder = oxNew("oxorder");
00026 $oOrder->load($soxId);
00027
00028
00029
00030 $sOxPaidField = 'oxorder__oxpaid';
00031 $sDelTypeField = 'oxorder__oxdeltype';
00032
00033 if ($oOrder->$sOxPaidField->value != "0000-00-00 00:00:00") {
00034 $oOrder->blIsPaid = true;
00036 $oUtilsDate = oxRegistry::get("oxUtilsDate");
00037 $oOrder->$sOxPaidField = new oxField($oUtilsDate->formatDBDate($oOrder->$sOxPaidField->value));
00038 }
00039
00040
00041 $this->_aViewData["edit"] = $oOrder;
00042 $this->_aViewData["paymentType"] = $oOrder->getPaymentType();
00043 $this->_aViewData["oShipSet"] = $oOrder->getShippingSetList();
00044
00045
00046 if ($oOrder->$sDelTypeField->value) {
00047
00048
00049 $oUser = oxNew('oxuser');
00050 $oUser->load($oOrder->oxorder__oxuserid->value);
00051
00052
00053 $dPrice = $oOrder->oxorder__oxtotalbrutsum->value / $oOrder->oxorder__oxcurrate->value;
00054
00056 $oPaymentList = oxRegistry::get("oxPaymentList");
00057 $this->_aViewData["oPayments"] =
00058 $oPaymentList->getPaymentList($oOrder->$sDelTypeField->value, $dPrice, $oUser);
00059 }
00060
00061
00062 $this->_aViewData["aVouchers"] = $oOrder->getVoucherNrList();
00063 }
00064
00065 $this->_aViewData["sNowValue"] = date("Y-m-d H:i:s", oxRegistry::get("oxUtilsDate")->getTime());
00066
00067 return "order_main.tpl";
00068 }
00069
00073 public function save()
00074 {
00075 parent::save();
00076
00077 $soxId = $this->getEditObjectId();
00078 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00079
00080
00081 $sShopID = oxRegistry::getSession()->getVariable("actshop");
00082 $aParams['oxorder__oxshopid'] = $sShopID;
00083
00084 $oOrder = oxNew("oxorder");
00085 if ($soxId != "-1") {
00086 $oOrder->load($soxId);
00087 } else {
00088 $aParams['oxorder__oxid'] = null;
00089 }
00090
00091
00092 $sPayId = oxRegistry::getConfig()->getRequestParameter("setPayment");
00093 if ($sPayId != $oOrder->oxorder__oxpaymenttype->value) {
00094 $aParams['oxorder__oxpaymenttype'] = $sPayId;
00095 }
00096
00097 $oOrder->assign($aParams);
00098
00099 $aDynvalues = oxRegistry::getConfig()->getRequestParameter("dynvalue");
00100 if (isset($aDynvalues)) {
00101 $oPayment = oxNew("oxuserpayment");
00102 $oPayment->load($oOrder->oxorder__oxpaymentid->value);
00103 $oPayment->oxuserpayments__oxvalue->setValue(oxRegistry::getUtils()->assignValuesToText($aDynvalues));
00104 $oPayment->save();
00105 }
00106
00107 $sDelSetId = oxRegistry::getConfig()->getRequestParameter("setDelSet");
00108 if ($sDelSetId != $oOrder->oxorder__oxdeltype->value) {
00109 $oOrder->oxorder__oxpaymenttype->setValue("oxempty");
00110 $oOrder->setDelivery($sDelSetId);
00111 } else {
00112
00113 $oOrder->reloadDelivery(false);
00114 }
00115
00116
00117 $oOrder->reloadDiscount(false);
00118
00119 $oOrder->recalculateOrder();
00120
00121
00122
00123 $this->setEditObjectId($oOrder->getId());
00124 }
00125
00129 public function sendorder()
00130 {
00131 $soxId = $this->getEditObjectId();
00132 $oOrder = oxNew("oxorder");
00133 if ($oOrder->load($soxId)) {
00134
00135
00136 $oOrder->oxorder__oxsenddate = new oxField(date("Y-m-d H:i:s", oxRegistry::get("oxUtilsDate")->getTime()));
00137 $oOrder->save();
00138
00139
00140 $oOrderArticles = $oOrder->getOrderArticles(true);
00141 if (oxRegistry::getConfig()->getRequestParameter("sendmail")) {
00142
00143 $oEmail = oxNew("oxemail");
00144 $oEmail->sendSendedNowMail($oOrder);
00145 }
00146
00147 }
00148 }
00149
00153 public function senddownloadlinks()
00154 {
00155 $soxId = $this->getEditObjectId();
00156 $oOrder = oxNew("oxorder");
00157 if ($oOrder->load($soxId)) {
00158 $oEmail = oxNew("oxemail");
00159 $oEmail->sendDownloadLinksMail($oOrder);
00160 }
00161 }
00162
00166 public function resetorder()
00167 {
00168 $oOrder = oxNew("oxorder");
00169 if ($oOrder->load($this->getEditObjectId())) {
00170
00171 $oOrder->oxorder__oxsenddate = new oxField("0000-00-00 00:00:00");
00172 $oOrder->save();
00173
00174 }
00175 }
00176 }