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