163     abstract protected function _modifyData($aData, $oType);
 
  173     public function __call($sMethod, $aArguments)
 
  175         throw new Exception(
"ERROR: Handler for Object '$sMethod' not implemented!");
 
  197     public function init($sUserName, $sPassword, $iShopID = 1, $iLanguage = 0)
 
  199         ini_set(
'session.use_cookies', 0);
 
  200         $_COOKIE = array(
'admin_sid' => 
false);
 
  202         $myConfig->setConfigParam(
'blForceSessionStart', 1);
 
  203         $myConfig->setConfigParam(
'blSessionUseCookies', 0);
 
  208         @$mySession->start();
 
  214         $oUser = 
oxNew(
'oxuser');
 
  216             if (!$oUser->login($sUserName, $sPassword)) {
 
  225         if (!$oUser || (isset($oUser->iError) && $oUser->iError == -1000)) {
 
  227             throw new Exception(self::ERROR_USER_WRONG);
 
  228         } elseif (($oUser->oxuser__oxrights->value == 
"malladmin" || $oUser->oxuser__oxrights->value == 
$myConfig->getShopID())) {
 
  229             $this->_sSID = $mySession->getId();
 
  230             $this->_blInit = 
true;
 
  231             $this->_iLanguage = $iLanguage;
 
  232             $this->_sUserID = $oUser->getId();
 
  237             throw new Exception(self::ERROR_USER_NO_RIGHTS);
 
  254             throw new Exception(
"ERROR: Session ID not valid!");
 
  256         $_COOKIE = array(
'admin_sid' => $sSessionID);
 
  264         if ($sSessionID != session_id()) {
 
  266                 session_write_close();
 
  268             session_id($sSessionID);
 
  272         $sAuth = $mySession->getVariable(
'auth');
 
  274         if (!isset($sAuth) || !$sAuth) {
 
  275             throw new Exception(
"ERROR: Session ID not valid!");
 
  278         $this->_iLanguage = $mySession->getVariable(
'lang');
 
  279         $this->_sUserID = $sAuth;
 
  282         $this->_blInit = 
true;
 
  295     public function exportType($sType, $sWhere = null, $iStart = null, $iCount = null, $sSortFieldName = null, $sSortType = null)
 
  298         $this->
_export($sType, $sWhere, $iStart, $iCount, $sSortFieldName, $sSortType);
 
  305     public function import()
 
  322         $sClassName = 
'oxerptype_' . $sType;
 
  323         $sFullPath = dirname(__FILE__) . 
'/objects/' . $sClassName . 
'.php';
 
  325         if (!file_exists($sFullPath)) {
 
  326             throw new Exception(
"Type $sType not supported in ERP interface!");
 
  329         include_once $sFullPath;
 
  332         return oxNew($sClassName);
 
  346     protected function _export($sType, $sWhere, $iStart = null, $iCount = null, $sSortFieldName = null, $sSortType = null)
 
  348         global $ADODB_FETCH_MODE;
 
  354         $sSQL = $oType->getSQL($sWhere, $this->_iLanguage, 
$myConfig->getShopId());
 
  355         $sSQL .= $oType->getSortString($sSortFieldName, $sSortType);
 
  356         $sFnc = 
'_Export' . $oType->getFunctionSuffix();
 
  358         $save = $ADODB_FETCH_MODE;
 
  361         if (isset($iCount) || isset($iStart)) {
 
  362             $rs = $oDb->selectLimit($sSQL, $iCount, $iStart);
 
  364             $rs = $oDb->select($sSQL);
 
  367         if ($rs != 
false && $rs->recordCount() > 0) {
 
  372                 $rs->fields = $oType->addExportData($rs->fields);
 
  379                     $blExport = $this->$sFnc($rs->fields);
 
  381                     $sMessage = $e->getMessage();
 
  385                 $this->_aStatistics[
$this->_iIdx] = array(
'r' => $blExport, 
'm' => $sMessage);
 
  392         $ADODB_FETCH_MODE = $save;
 
  402         $aData = GetTableDescription($sTable);
 
  405         foreach ($aData as $key => $oADODBField) {
 
  406             if (!(is_numeric(substr($oADODBField->name, strlen($oADODBField->name) - 1, 1)) && substr($oADODBField->name, strlen($oADODBField->name) - 2, 1) == 
'_')) {
 
  407                 echo(
"'" . $oADODBField->name . 
"'\t\t => '" . $oADODBField->name . 
"',\n");
 
  423         $sOXID = $oType->getOxidFromKeyFields($aData);
 
  439         if (count($this->_aStatistics) && isset($this->_aStatistics[$this->_iIdx])) {
 
  440             while (isset($this->_aStatistics[$this->_iIdx]) && $this->_aStatistics[$this->_iIdx][
'r']) {
 
  453         if (count($this->_aStatistics) && isset($this->_aStatistics[$this->_iIdx])) {
 
  454             while (isset($this->_aStatistics[$this->_iIdx]) && $this->_aStatistics[$this->_iIdx][
'r']) {
 
  470         static $aAccessCache;
 
  472         if (!$this->_blInit) {
 
  473             throw new Exception(self::ERROR_NO_INIT);
 
  506             $sFnc = 
'_' . $sMode . $oType->getFunctionSuffix();
 
  509                 $aData = $oType->addImportData($aData);
 
  513                 $iId = $this->$sFnc($oType, $aData);
 
  522                 $sMessage = $e->getMessage();
 
  525             $this->_aStatistics[
$this->_iIdx] = array(
'r' => $blImport, 
'm' => $sMessage);
 
  544     protected function _save(
oxERPType &$oType, $aData, $blAllowCustomShopId = 
false)
 
  550         if (isset($aData[
'OXID'])) {
 
  551             $sOxid = $aData[
'OXID'];
 
  555         return $oType->
saveObject($aData, $blAllowCustomShopId);
 
  568         if (method_exists(
$myConfig, 
'getSerial')) {
 
  569             if (
$myConfig->getSerial() instanceof oxSerial) {
 
  573         throw new Exception(self::ERROR_SHOP_VERSION_NOT_SUPPORTED_BY_ERP);
 
  597         if (!self::$_sRequestedVersion) {
 
  623         $sDbLayerVersion = 
'2.9.0';
 
  624         self::$_sRequestedVersion = $sDbLayerVersion;
 
  637         $sClassName = preg_replace(
'/[^a-z0-9_]/i', 
'', $sId);
 
  638         if (preg_match(
'/(.*)Plugin$/i', $sClassName, $m)) {
 
  640             $sClassName = $m[1] . 
'Plugin';
 
  642             throw new Exception(
"Plugin handler class has to end with 'Plugin' word (GOT '$sClassName').");
 
  645         $sFileName = dirname(__FILE__) . 
'/plugins/' . strtolower($sClassName) . 
'.php';
 
  646         if (!is_readable($sFileName)) {
 
  647             $sFileName = basename($sFileName);
 
  648             throw new Exception(
"Can not find the requested plugin file ('$sFileName').");
 
  650         include_once dirname(__FILE__) . 
'/plugins/oxerppluginbase.php';
 
  651         include_once $sFileName;
 
  652         if (!class_exists($sClassName)) {
 
  653             throw new Exception(
"Can not find the requested plugin class.");
 
  655         $o = 
new $sClassName();
 
  656         if ($o instanceof oxErpPluginBase) {
 
  659         throw new Exception(
"Plugin does not extend oxErpPluginBase class.");