Go to the documentation of this file.00001 <?php
00002
00008 class Order_List extends oxAdminList
00009 {
00010
00016 protected $_sListClass = 'oxorder';
00017
00023 protected $_blDesc = true;
00024
00030 protected $_sDefSortField = "oxorderdate";
00031
00038 public function render()
00039 {
00040 parent::render();
00041
00042 $aFolders = $this->getConfig()->getConfigParam('aOrderfolder');
00043 $sFolder = oxRegistry::getConfig()->getRequestParameter("folder");
00044
00045 if (!$sFolder && is_array($aFolders)) {
00046 $aNames = array_keys($aFolders);
00047 $sFolder = $aNames[0];
00048 }
00049
00050 $aSearch = array('oxorderarticles' => 'ARTID', 'oxpayments' => 'PAYMENT');
00051 $sSearch = oxRegistry::getConfig()->getRequestParameter("addsearch");
00052 $sSearchfld = oxRegistry::getConfig()->getRequestParameter("addsearchfld");
00053
00054 $this->_aViewData["folder"] = $sFolder ? $sFolder : -1;
00055 $this->_aViewData["addsearchfld"] = $sSearchfld ? $sSearchfld : -1;
00056 $this->_aViewData["asearch"] = $aSearch;
00057 $this->_aViewData["addsearch"] = $sSearch;
00058 $this->_aViewData["afolder"] = $aFolders;
00059
00060 return "order_list.tpl";
00061 }
00062
00071 protected function _prepareWhereQuery($aWhere, $sqlFull)
00072 {
00073 $oDb = oxDb::getDb();
00074 $sQ = parent::_prepareWhereQuery($aWhere, $sqlFull);
00075 $myConfig = $this->getConfig();
00076 $aFolders = $myConfig->getConfigParam('aOrderfolder');
00077 $sFolder = oxRegistry::getConfig()->getRequestParameter('folder');
00078
00079 if ($sFolder && $sFolder != '-1') {
00080 $sQ .= " and ( oxorder.oxfolder = " . $oDb->quote($sFolder) . " )";
00081 } elseif (!$sFolder && is_array($aFolders)) {
00082 $aFolderNames = array_keys($aFolders);
00083 $sQ .= " and ( oxorder.oxfolder = " . $oDb->quote($aFolderNames[0]) . " )";
00084 }
00085
00086
00087 return $sQ;
00088 }
00089
00097 protected function _buildSelectString($oListObject = null)
00098 {
00099 $sSql = parent::_buildSelectString($oListObject);
00100 $oDb = oxDb::getDb();
00101
00102 $sSearch = oxRegistry::getConfig()->getRequestParameter('addsearch');
00103 $sSearch = trim($sSearch);
00104 $sSearchField = oxRegistry::getConfig()->getRequestParameter('addsearchfld');
00105
00106 if ($sSearch) {
00107 switch ($sSearchField) {
00108 case 'oxorderarticles':
00109 $sQ = "oxorder left join oxorderarticles on oxorderarticles.oxorderid=oxorder.oxid where ( oxorderarticles.oxartnum like " . $oDb->quote("%{$sSearch}%") . " or oxorderarticles.oxtitle like " . $oDb->quote("%{$sSearch}%") . " ) and ";
00110 break;
00111 case 'oxpayments':
00112 $sQ = "oxorder left join oxpayments on oxpayments.oxid=oxorder.oxpaymenttype where oxpayments.oxdesc like " . $oDb->quote("%{$sSearch}%") . " and ";
00113 break;
00114 default:
00115 $sQ = "oxorder where oxorder.oxpaid like " . $oDb->quote("%{$sSearch}%") . " and ";
00116 break;
00117 }
00118 $sSql = str_replace('oxorder where', $sQ, $sSql);
00119 }
00120
00121 return $sSql;
00122 }
00123
00127 public function storno()
00128 {
00129 $oOrder = oxNew("oxorder");
00130 if ($oOrder->load($this->getEditObjectId())) {
00131 $oOrder->cancelOrder();
00132 }
00133
00134 $this->resetContentCache();
00135
00136
00137 $this->init();
00138 }
00139
00145 public function getListSorting()
00146 {
00147 $aSorting = parent::getListSorting();
00148 if (isset($aSorting["oxorder"]["oxbilllname"])) {
00149 $this->_blDesc = false;
00150 }
00151
00152 return $aSorting;
00153 }
00154 }