67 $this->_sFunctionSuffix = str_replace(
"oxERPType_",
"", get_class($this));
77 $this->_sFunctionSuffix = $sNew;
87 $this->_aFieldList = $aFieldList;
100 if ($iShopID === null) {
104 return getViewName($this->_sTableName, -1, $iShopID);
118 foreach ($aData as $key => $oADODBField) {
119 $iLang = substr($oADODBField->name, strlen($oADODBField->name) - 1, 1);
120 if (is_numeric($iLang) && substr($oADODBField->name, strlen($oADODBField->name) - 2, 1) ==
'_') {
122 $sMainFld = str_replace(
'_' . $iLang,
"", $oADODBField->name);
123 $aRet[$iLang][$sMainFld] = $oADODBField->name .
' as ' . $sMainFld;
144 if (isset($aMultiLang[$iLanguage][$sField])) {
145 $sField = $aMultiLang[$iLanguage][$sField];
152 return "1 as $sField";
154 return "0 as $sField";
169 public function getSQL($sWhere, $iLanguage = 0, $iShopId = 1)
171 if (!$this->_aFieldList) {
178 foreach ($this->_aFieldList as $sField) {
188 $sSQL .=
' from ' . $this->
getTableName($iShopId, $iLanguage) .
' ' . $sWhere;
203 $sRes =
" order by ";
205 $sRes .= $sFieldName;
209 if ($sType && ($sType ==
"ASC" || $sType ==
"DESC")) {
210 $sRes .=
" " . $sType;
230 if ($oObj->isDerived()) {
231 throw new Exception(oxERPBase::$ERROR_USER_NO_RIGHTS);
265 $oObj =
oxNew($sName,
"core");
267 $oObj =
oxNew(
'oxbase',
'core');
271 if (!$oObj->exists($sId)) {
276 if (!$oObj->Load($sId)) {
278 throw new Exception(
"No right to delete object {$sId} !");
282 throw new Exception(
"No right to delete object {$sId} !");
297 $oUsr =
oxNew(
'oxUser');
298 $oUsr->loadAdminUser();
300 if ($oUsr->oxuser__oxrights->value ==
"malladmin") {
302 } elseif ($oUsr->oxuser__oxrights->value == (
int) $iShopId) {
321 $sSql =
"select oxshopid from " . $this->_sTableName .
" where oxid = " . $oDb->quote($sId);
323 $iShopId = $oDb->getOne($sSql);
329 throw new Exception(
"No right to delete object {$sId} !");
349 $oUsr =
oxNew(
'oxUser');
350 $oUsr->loadAdminUser();
351 if ($oUsr->oxuser__oxrights->value ==
"malladmin") {
357 if ($e->getMessage() ==
'EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND') {
372 public function delete($sID)
376 $sSql =
"delete from " . $this->_sTableName .
" where oxid = " . $oDb->quote($sID);
378 return $oDb->Execute($sSql);
391 return $oObj->delete($sID);
428 if (!$this->_aFieldList) {
432 foreach ($this->_aFieldList as $sField) {
433 $aRParams[] = strtolower($this->_sTableName .
'__' . $sField);
449 $oShopObject =
oxNew($sObjectName);
451 $oShopObject =
oxNew(
'oxbase');
455 if ($oShopObject instanceof
oxI18n) {
456 $oShopObject->setLanguage(0);
457 $oShopObject->setEnableMultilang(
false);
460 $sViewName = $oShopObject->getViewName();
461 $sFields = str_ireplace(
'`' . $sViewName .
"`.",
"", strtoupper($oShopObject->getSelectFields()));
462 $sFields = str_ireplace(array(
" ",
"`"), array(
"",
""), $sFields);
463 $this->_aFieldList = explode(
",", $sFields);
498 if (array_key_exists($sKey, $aData)) {
499 $aWhere[] = $sKey .
'=' . $oDb->qstr($aData[$sKey]);
506 $sSelect =
'SELECT OXID FROM ' . $this->
getTableName() .
' WHERE ' . implode(
' AND ', $aWhere);
508 return $oDb->getOne($sSelect);
521 if (isset($this->_aKeyFieldList) && is_array($this->_aKeyFieldList)) {
546 if (isset($aData[
'OXSHOPID'])) {
550 if (!isset($aData[
'OXID'])) {
555 foreach ($aData as $key => $val) {
556 if (!strlen((
string) $val)) {
591 $oShopObject =
oxNew($sObjectName,
'core');
592 if ($oShopObject instanceof
oxI18n) {
593 $oShopObject->setLanguage(0);
594 $oShopObject->setEnableMultilang(
false);
597 $oShopObject =
oxNew(
'oxbase',
'core');
601 foreach ($aData as $key => $value) {
603 $sUPKey = strtoupper($key);
604 if (!isset($aData[$sUPKey])) {
606 $aData[$sUPKey] = $value;
612 if ($aData[
'OXID']) {
613 $blLoaded = $oShopObject->load($aData[
'OXID']);
616 $aData = $this->
_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
624 $oShopObject->assign($aData);
626 if ($blAllowCustomShopId) {
627 $oShopObject->setIsDerived(
false);
632 if ($oShopObject->save()) {
651 return $oShopObject->getId();