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