oxerptype_orderarticle.php

Go to the documentation of this file.
00001 <?php
00002 
00003 require_once 'oxerptype.php';
00004 
00008 class oxERPType_OrderArticle extends oxERPType
00009 {
00015     public function __construct()
00016     {
00017         parent::__construct();
00018 
00019         $this->_sTableName = 'oxorderarticles';
00020         $this->_sShopObjectName = 'oxorderarticle';
00021     }
00022 
00034     public function getSQL( $sWhere, $iLanguage = 0, $iShopID = 1)
00035     {
00036         if ( strstr( $sWhere, 'where')) {
00037             $sWhere .= ' and ';
00038         } else {
00039             $sWhere .= ' where ';
00040         }
00041 
00042         $sWhere .= 'oxordershopid = \''.$iShopID.'\'';
00043 
00044         return parent::getSQL($sWhere, $iLanguage, $iShopID);
00045     }
00046 
00057     public function checkWriteAccess($oObj, $aData = null)
00058     {
00059             return;
00060 
00061         if ($oObj->oxorderarticles__oxordershopid->value != oxConfig::getInstance()->getShopId()) {
00062             throw new Exception( oxERPBase::$ERROR_USER_NO_RIGHTS);
00063         }
00064 
00065         parent::checkWriteAccess($oObj, $aData);
00066     }
00067 
00077     protected function _getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
00078     {
00079             switch ($sField) {
00080                 case 'OXORDERSHOPID':
00081                     return "'1' as $sField";
00082             }
00083 
00084         return parent::_getSqlFieldName($sField, $iLanguage, $iShopID);
00085     }
00086 
00096     protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
00097     {
00098         $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
00099 
00100         // check if data is not serialized
00101         $aPersVals = @unserialize($aData['OXPERSPARAM']);
00102         if (!is_array($aPersVals)) {
00103             // data is a string with | separation, prepare for oxid
00104             $aPersVals = explode("|", $aData['OXPERSPARAM']);
00105             $aData['OXPERSPARAM'] = serialize($aPersVals);
00106         }
00107 
00108             if (isset($aData['OXORDERSHOPID'])) {
00109                 $aData['OXORDERSHOPID'] = 'oxbaseshop';
00110             }
00111 
00112         return $aData;
00113     }
00114 }