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 {
00010 
00016     public function __construct()
00017     {
00018         parent::__construct();
00019 
00020         $this->_sTableName = 'oxorderarticles';
00021         $this->_sShopObjectName = 'oxorderarticle';
00022     }
00023 
00035     public function getSQL($sWhere, $iLanguage = 0, $iShopID = 1)
00036     {
00037         if (strstr($sWhere, 'where')) {
00038             $sWhere .= ' and ';
00039         } else {
00040             $sWhere .= ' where ';
00041         }
00042 
00043         $sWhere .= 'oxordershopid = \'' . $iShopID . '\'';
00044 
00045         return parent::getSQL($sWhere, $iLanguage, $iShopID);
00046     }
00047 
00058     public function checkWriteAccess($oObj, $aData = null)
00059     {
00060         return;
00061 
00062         if ($oObj->oxorderarticles__oxordershopid->value != oxRegistry::getConfig()->getShopId()) {
00063             throw new Exception(oxERPBase::$ERROR_USER_NO_RIGHTS);
00064         }
00065 
00066         parent::checkWriteAccess($oObj, $aData);
00067     }
00068 
00078     protected function _getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
00079     {
00080         switch ($sField) {
00081             case 'OXORDERSHOPID':
00082                 return "'1' as $sField";
00083         }
00084 
00085         return parent::_getSqlFieldName($sField, $iLanguage, $iShopID);
00086     }
00087 
00097     protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
00098     {
00099         $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
00100 
00101         // check if data is not serialized
00102         $aPersVals = @unserialize($aData['OXPERSPARAM']);
00103         if (!is_array($aPersVals)) {
00104             // data is a string with | separation, prepare for oxid
00105             $aPersVals = explode("|", $aData['OXPERSPARAM']);
00106             $aData['OXPERSPARAM'] = serialize($aPersVals);
00107         }
00108 
00109         if (isset($aData['OXORDERSHOPID'])) {
00110             $aData['OXORDERSHOPID'] = 'oxbaseshop';
00111         }
00112 
00113         return $aData;
00114     }
00115 }