69 $this->_sFunctionSuffix = str_replace(
"oxERPType_",
"", get_class($this));
79 $this->_sFunctionSuffix = $sNew;
89 $this->_aFieldList = $aFieldList;
102 if ($iShopID === null) {
106 return getViewName($this->_sTableName, -1, $iShopID);
120 foreach ($aData as $key => $oADODBField) {
121 $iLang = substr($oADODBField->name, strlen($oADODBField->name) - 1, 1);
122 if (is_numeric($iLang) && substr($oADODBField->name, strlen($oADODBField->name) - 2, 1) ==
'_') {
124 $sMainFld = str_replace(
'_' . $iLang,
"", $oADODBField->name);
125 $aRet[$iLang][$sMainFld] = $oADODBField->name .
' as ' . $sMainFld;
146 if (isset($aMultiLang[$iLanguage][$sField])) {
147 $sField = $aMultiLang[$iLanguage][$sField];
154 return "1 as $sField";
156 return "0 as $sField";
171 public function getSQL($sWhere, $iLanguage = 0, $iShopId = 1)
173 if (!$this->_aFieldList) {
180 foreach ($this->_aFieldList as $sField) {
190 $sSQL .=
' from ' . $this->
getTableName($iShopId, $iLanguage) .
' ' . $sWhere;
205 $sRes =
" order by ";
207 $sRes .= $sFieldName;
211 if ($sType && ($sType ==
"ASC" || $sType ==
"DESC")) {
212 $sRes .=
" " . $sType;
232 if ($oObj->isDerived()) {
233 throw new Exception(oxERPBase::$ERROR_USER_NO_RIGHTS);
267 $oObj =
oxNew($sName,
"core");
269 $oObj =
oxNew(
'oxbase',
'core');
273 if (!$oObj->exists($sId)) {
278 if (!$oObj->Load($sId)) {
280 throw new Exception(
"No right to delete object {$sId} !");
284 throw new Exception(
"No right to delete object {$sId} !");
299 $oUsr =
oxNew(
'oxUser');
300 $oUsr->loadAdminUser();
302 if ($oUsr->oxuser__oxrights->value ==
"malladmin") {
304 } elseif ($oUsr->oxuser__oxrights->value == (
int) $iShopId) {
323 $sSql =
"select oxshopid from " . $this->_sTableName .
" where oxid = " . $oDb->quote($sId);
325 $iShopId = $oDb->getOne($sSql);
331 throw new Exception(
"No right to delete object {$sId} !");
351 $oUsr =
oxNew(
'oxUser');
352 $oUsr->loadAdminUser();
353 if ($oUsr->oxuser__oxrights->value ==
"malladmin") {
359 if ($e->getMessage() ==
'EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND') {
374 public function delete($sID)
378 $sSql =
"delete from " . $this->_sTableName .
" where oxid = " . $oDb->quote($sID);
380 return $oDb->Execute($sSql);
393 return $oObj->delete($sID);
430 if (!$this->_aFieldList) {
434 foreach ($this->_aFieldList as $sField) {
435 $aRParams[] = strtolower($this->_sTableName .
'__' . $sField);
451 $oShopObject =
oxNew($sObjectName);
453 $oShopObject =
oxNew(
'oxbase');
457 if ($oShopObject instanceof
oxI18n) {
458 $oShopObject->setLanguage(0);
459 $oShopObject->setEnableMultilang(
false);
462 $sViewName = $oShopObject->getViewName();
463 $sFields = str_ireplace(
'`' . $sViewName .
"`.",
"", strtoupper($oShopObject->getSelectFields()));
464 $sFields = str_ireplace(array(
" ",
"`"), array(
"",
""), $sFields);
465 $this->_aFieldList = explode(
",", $sFields);
500 if (array_key_exists($sKey, $aData)) {
501 $aWhere[] = $sKey .
'=' . $oDb->qstr($aData[$sKey]);
508 $sSelect =
'SELECT OXID FROM ' . $this->
getTableName() .
' WHERE ' . implode(
' AND ', $aWhere);
510 return $oDb->getOne($sSelect);
523 if (isset($this->_aKeyFieldList) && is_array($this->_aKeyFieldList)) {
548 if (isset($aData[
'OXSHOPID'])) {
552 if (!isset($aData[
'OXID'])) {
557 foreach ($aData as $key => $val) {
558 if (!strlen((
string) $val)) {
593 $oShopObject =
oxNew($sObjectName,
'core');
594 if ($oShopObject instanceof
oxI18n) {
595 $oShopObject->setLanguage(0);
596 $oShopObject->setEnableMultilang(
false);
599 $oShopObject =
oxNew(
'oxbase',
'core');
603 foreach ($aData as $key => $value) {
605 $sUPKey = strtoupper($key);
606 if (!isset($aData[$sUPKey])) {
608 $aData[$sUPKey] = $value;
614 if ($aData[
'OXID']) {
615 $blLoaded = $oShopObject->load($aData[
'OXID']);
618 $aData = $this->
_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
626 $oShopObject->assign($aData);
628 if ($blAllowCustomShopId) {
629 $oShopObject->setIsDerived(
false);
634 if ($oShopObject->save()) {
653 return $oShopObject->getId();