oxerptype_orderstatus.php

Go to the documentation of this file.
00001 <?php
00002 
00003 require_once 'oxerptype.php';
00004 
00008 class oxERPType_OrderStatus extends oxERPType
00009 {
00015     public function __construct()
00016     {
00017         parent::__construct();
00018 
00019         $this->_sTableName = 'oxorderarticles';
00020 
00021         $this->_aFieldList = array(
00022             'OXID'          => 'OXID',
00023             'OXERPSTATUS_STATUS'   => 'OXERPSTATUS_STATUS',
00024             'OXERPSTATUS_TIME'     => 'OXERPSTATUS_TIME',
00025             'OXERPSTATUS_TRACKID'  => 'OXERPSTATUS_TRACKID'
00026         );
00027     }
00028 
00038     public function getSQL( $sWhere, $iLanguage = 0, $iShopID = 1)
00039     {
00040         $oStr = getStr();
00041         if ( $oStr->strstr( $sWhere, 'where' ) ) {
00042             $sWhere .= ' and ';
00043         } else {
00044             $sWhere .= ' where ';
00045         }
00046 
00047         $sWhere .= 'oxordershopid = \''.$iShopID.'\'';
00048         return parent::getSQL( $sWhere, $iLanguage, $iShopID );
00049     }
00050 
00058     public function checkWriteAccess($sOxid)
00059     {
00060         $myConfig = oxConfig::getInstance();
00061 
00062         $oDB = oxDb::getDb();
00063 
00064         $sSql = "select oxordershopid from ". $this->getTableName($myConfig->getShopId()) ." where oxid = '". $sOxid ."'";
00065         $sRes = $oDB->getOne($sSql);
00066 
00067         if ( $sRes && $sRes != $myConfig->getShopId() ) {
00068             throw new Exception( oxERPBase::$ERROR_USER_NO_RIGHTS);
00069         }
00070     }
00071 
00081     protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
00082     {
00083         $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
00084         if ( isset($aData['OXERPSTATUS_STATUS'] )
00085             && isset($aData['OXERPSTATUS_TIME'] )
00086             && isset($aData['OXERPSTATUS_TRACKID'] ) ) {
00087             $oStatus = new stdClass();
00088             $oStatus->STATUS        = $aData['OXERPSTATUS_STATUS'];
00089             $oStatus->date          = $aData['OXERPSTATUS_TIME'];
00090             $oStatus->trackingid    = $aData['OXERPSTATUS_TRACKID'];
00091             $aData['OXERPSTATUS']   = serialize( $oStatus );
00092         }
00093         return $aData;
00094     }
00095 
00103     public function addExportData( $aFields)
00104     {
00105         if ($aFields['OXERPSTATUS']) {
00106             $oStatus = @unserialize($aFields['OXERPSTATUS']);
00107             unset($aFields['OXERPSTATUS']);
00108             if (is_object($oStatus)) {
00109                 $aFields['OXERPSTATUS_STATUS']  = $oStatus->STATUS;
00110                 $aFields['OXERPSTATUS_TIME']    = $oStatus->date;
00111                 $aFields['OXERPSTATUS_TRACKID'] = $oStatus->trackingid;
00112             }
00113         }
00114         return $aFields;
00115     }
00116 
00117 
00127     protected function getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
00128     {
00129         switch ($sField) {
00130             case 'OXERPSTATUS_STATUS':
00131                 return "(OXERPSTATUS) as OXERPSTATUS";
00132             case 'OXERPSTATUS_TIME':
00133             case 'OXERPSTATUS_TRACKID':
00134                 return "'' as $sField";
00135         }
00136 
00137         return parent::getSqlFieldName($sField, $iLanguage, $iShopID);
00138     }
00139 
00140 
00141 }

Generated on Wed May 13 13:25:51 2009 for OXID eShop CE by  doxygen 1.5.5