OXID eShop CE  4.10.2
 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 
9 {
10 
16  public function __construct()
17  {
19 
20  $this->_sTableName = 'oxorderarticles';
21  $this->_sShopObjectName = 'oxorderarticle';
22  }
23 
35  public function getSQL($sWhere, $iLanguage = 0, $iShopID = 1)
36  {
37  if (strstr($sWhere, 'where')) {
38  $sWhere .= ' and ';
39  } else {
40  $sWhere .= ' where ';
41  }
42 
43  $sWhere .= 'oxordershopid = \'' . $iShopID . '\'';
44 
45  return parent::getSQL($sWhere, $iLanguage, $iShopID);
46  }
47 
58  public function checkWriteAccess($oObj, $aData = null)
59  {
60  return;
61 
62  if ($oObj->oxorderarticles__oxordershopid->value != oxRegistry::getConfig()->getShopId()) {
63  throw new Exception(oxERPBase::$ERROR_USER_NO_RIGHTS);
64  }
65 
66  parent::checkWriteAccess($oObj, $aData);
67  }
68 
78  protected function _getSqlFieldName($sField, $iLanguage = 0, $iShopID = 1)
79  {
80  switch ($sField) {
81  case 'OXORDERSHOPID':
82  return "'1' as $sField";
83  }
84 
85  return parent::_getSqlFieldName($sField, $iLanguage, $iShopID);
86  }
87 
97  protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
98  {
99  $aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
100 
101  // check if data is not serialized
102  $aPersVals = @unserialize($aData['OXPERSPARAM']);
103  if (!is_array($aPersVals)) {
104  // data is a string with | separation, prepare for oxid
105  $aPersVals = explode("|", $aData['OXPERSPARAM']);
106  $aData['OXPERSPARAM'] = serialize($aPersVals);
107  }
108 
109  if (isset($aData['OXORDERSHOPID'])) {
110  $aData['OXORDERSHOPID'] = 'oxbaseshop';
111  }
112 
113  return $aData;
114  }
115 }