OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
oxerptype_orderarticle.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'oxerptype.php';
4 
9 {
15  public function __construct()
16  {
18 
19  $this->_sTableName = 'oxorderarticles';
20  $this->_sShopObjectName = 'oxorderarticle';
21  }
22 
34  public function getSQL( $sWhere, $iLanguage = 0, $iShopID = 1)
35  {
36  if ( strstr( $sWhere, 'where')) {
37  $sWhere .= ' and ';
38  } else {
39  $sWhere .= ' where ';
40  }
41 
42  $sWhere .= 'oxordershopid = \''.$iShopID.'\'';
43 
44  return parent::getSQL($sWhere, $iLanguage, $iShopID);
45  }
46 
57  public function checkWriteAccess($oObj, $aData = null)
58  {
59  return;
60 
61  if ($oObj->oxorderarticles__oxordershopid->value != oxRegistry::getConfig()->getShopId()) {
62  throw new Exception( oxERPBase::$ERROR_USER_NO_RIGHTS);
63  }
64 
65  parent::checkWriteAccess($oObj, $aData);
66  }
67 
77  protected function _getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
78  {
79  switch ($sField) {
80  case 'OXORDERSHOPID':
81  return "'1' as $sField";
82  }
83 
84  return parent::_getSqlFieldName($sField, $iLanguage, $iShopID);
85  }
86 
96  protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
97  {
98  $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
99 
100  // check if data is not serialized
101  $aPersVals = @unserialize($aData['OXPERSPARAM']);
102  if (!is_array($aPersVals)) {
103  // data is a string with | separation, prepare for oxid
104  $aPersVals = explode("|", $aData['OXPERSPARAM']);
105  $aData['OXPERSPARAM'] = serialize($aPersVals);
106  }
107 
108  if (isset($aData['OXORDERSHOPID'])) {
109  $aData['OXORDERSHOPID'] = 'oxbaseshop';
110  }
111 
112  return $aData;
113  }
114 }