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         if ( strstr( $sWhere, 'where' ) ) {
00041             $sWhere .= ' and ';
00042         } else {
00043             $sWhere .= ' where ';
00044         }
00045 
00046         $sWhere .= 'oxordershopid = \''.$iShopID.'\'';
00047         return parent::getSQL( $sWhere, $iLanguage, $iShopID );
00048     }
00049 
00057     public function checkWriteAccess($sOxid)
00058     {
00059         $myConfig = oxConfig::getInstance();
00060 
00061         $oDB = oxDb::getDb();
00062 
00063         $sSql = "select oxordershopid from ". $this->getTableName($myConfig->getShopId()) ." where oxid = '". $sOxid ."'";
00064         $sRes = $oDB->getOne($sSql);
00065 
00066         if ( $sRes && $sRes != $myConfig->getShopId() ) {
00067             throw new Exception( oxERPBase::$ERROR_USER_NO_RIGHTS);
00068         }
00069     }
00070 
00080     protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
00081     {
00082         $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
00083         if ( isset($aData['OXERPSTATUS_STATUS'] )
00084             && isset($aData['OXERPSTATUS_TIME'] )
00085             && isset($aData['OXERPSTATUS_TRACKID'] ) ) {
00086             $oStatus = new stdClass();
00087             $oStatus->STATUS        = $aData['OXERPSTATUS_STATUS'];
00088             $oStatus->date          = $aData['OXERPSTATUS_TIME'];
00089             $oStatus->trackingid    = $aData['OXERPSTATUS_TRACKID'];
00090             $aData['OXERPSTATUS']   = serialize( $oStatus );
00091         }
00092         return $aData;
00093     }
00094 
00102     public function addExportData( $aFields)
00103     {
00104         if ($aFields['OXERPSTATUS']) {
00105             $oStatus = @unserialize($aFields['OXERPSTATUS']);
00106             unset($aFields['OXERPSTATUS']);
00107             if (is_object($oStatus)) {
00108                 $aFields['OXERPSTATUS_STATUS']  = $oStatus->STATUS;
00109                 $aFields['OXERPSTATUS_TIME']    = $oStatus->date;
00110                 $aFields['OXERPSTATUS_TRACKID'] = $oStatus->trackingid;
00111             }
00112         }
00113         return $aFields;
00114     }
00115 
00116 
00126     protected function getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
00127     {
00128         switch ($sField) {
00129             case 'OXERPSTATUS_STATUS':
00130                 return "(OXERPSTATUS) as OXERPSTATUS";
00131             case 'OXERPSTATUS_TIME':
00132             case 'OXERPSTATUS_TRACKID':
00133                 return "'' as $sField";
00134         }
00135 
00136         return parent::getSqlFieldName($sField, $iLanguage, $iShopID);
00137     }
00138 
00139 
00140 }

Generated on Wed Apr 22 12:26:30 2009 for OXID eShop CE by  doxygen 1.5.5