20 'C' =>
'crossselling',
22 'T' =>
'article2category',
23 'I' =>
'article2action',
27 'R' =>
'orderarticle',
70 public function __call($sMethod, $aArgs)
72 if (defined(
'OXID_PHP_UNIT')) {
73 if (substr($sMethod, 0, 4) ==
"UNIT") {
74 $sMethod = str_replace(
"UNIT",
"_", $sMethod);
76 if (method_exists($this, $sMethod)) {
77 return call_user_func_array(array(& $this, $sMethod), $aArgs);
81 throw new oxSystemComponentException(
"Function '$sMethod' does not exist or is not accessible! (" . get_class($this) .
")" . PHP_EOL);
113 $aVersions = array_keys(oxErpBase::$_aDbLayer2ShopDbVersions);
114 $sVersion = array_pop($aVersions);
145 foreach ($this->_aCsvFileFieldsOrder as $sValue) {
146 if (!empty($sValue)) {
147 if (strtolower($aData[$iIndex]) ==
"null") {
148 $aRet[$sValue] = null;
150 $aRet[$sValue] = $aData[$iIndex];
170 $sType = $this->_sImportTypePrefix;
172 if (strlen($sType) != 1 || !array_key_exists($sType, $this->_aObjects)) {
173 throw new Exception(
"Error unknown command: " . $sType);
175 return $this->_aObjects[$sType];
200 $this->_sImportTypePrefix = $sType;
216 $this->_sImportTypePrefix = $sType;
226 foreach ($this->_aObjects as $sKey => $sImportType) {
228 $aList[$sKey] = $oType->getBaseTableName();
245 public function init($sUserName, $sPassword, $iShopID = 1, $iLanguage = 0)
249 $oUser =
oxNew(
'oxUser');
250 $oUser->loadAdminUser();
252 if (($oUser->oxuser__oxrights->value ==
"malladmin" || $oUser->oxuser__oxrights->value ==
$myConfig->getShopID())) {
253 $this->_sSID = $mySession->getId();
254 $this->_blInit =
true;
256 $this->_sUserID = $oUser->getId();
261 throw new Exception(self::ERROR_USER_NO_RIGHTS);
276 $this->_aCsvFileFieldsOrder = $aCsvFields;
286 $this->_blCsvContainsHeader = $blCsvContainsHeader;
311 public function doImport($sPath = null, $sUserName = null, $sUserPassword = null, $sShopId = null, $sShopLanguage = null)
316 $this->_sReturn =
"";
317 $iMaxLineLength = 8192;
319 $this->_sPath = $sPath;
323 $this->
init(null, null);
325 return $this->_sReturn =
'ERPGENIMPORT_ERROR_USER_NO_RIGHTS';
328 $file = @fopen($this->_sPath,
"r");
330 if (isset($file) && $file) {
336 $this->_aData[] = $aRow;
339 if ($this->_blCsvContainsHeader) {
341 array_shift($this->_aData);
347 echo $ex->getMessage();
348 $this->_sReturn =
'ERPGENIMPORT_ERROR_DURING_IMPORT';
352 $this->_sReturn =
'ERPGENIMPORT_ERROR_WRONG_FILE';
369 $sChar =
$myConfig->getConfigParam(
'sGiCsvFieldTerminator');
372 $sChar =
$myConfig->getConfigParam(
'sCSVSign');
390 if ($sChar =
$myConfig->getConfigParam(
'sGiCsvFieldEncloser')) {