19 'C' =>
'crossselling',
21 'T' =>
'article2category',
22 'I' =>
'article2action',
26 'R' =>
'orderarticle',
69 public function __call($sMethod, $aArgs)
71 if (defined(
'OXID_PHP_UNIT')) {
72 if (substr($sMethod, 0, 4) ==
"UNIT") {
73 $sMethod = str_replace(
"UNIT",
"_", $sMethod);
75 if (method_exists($this, $sMethod)) {
76 return call_user_func_array(array(& $this, $sMethod), $aArgs);
80 throw new oxSystemComponentException(
"Function '$sMethod' does not exist or is not accessible! (" . get_class($this) .
")" . PHP_EOL);
112 $aVersions = array_keys(oxErpBase::$_aDbLayer2ShopDbVersions);
113 $sVersion = array_pop($aVersions);
144 foreach ($this->_aCsvFileFieldsOrder as $sValue) {
145 if (!empty($sValue)) {
146 if (strtolower($aData[$iIndex]) ==
"null") {
147 $aRet[$sValue] = null;
149 $aRet[$sValue] = $aData[$iIndex];
169 $sType = $this->_sImportTypePrefix;
171 if (strlen($sType) != 1 || !array_key_exists($sType, $this->_aObjects)) {
172 throw new Exception(
"Error unknown command: " . $sType);
174 return $this->_aObjects[$sType];
199 $this->_sImportTypePrefix = $sType;
215 $this->_sImportTypePrefix = $sType;
225 foreach ($this->_aObjects as $sKey => $sImportType) {
227 $aList[$sKey] = $oType->getBaseTableName();
244 public function init($sUserName, $sPassword, $iShopID = 1, $iLanguage = 0)
248 $oUser =
oxNew(
'oxUser');
249 $oUser->loadAdminUser();
251 if (($oUser->oxuser__oxrights->value ==
"malladmin" || $oUser->oxuser__oxrights->value ==
$myConfig->getShopID())) {
252 $this->_sSID = $mySession->getId();
253 $this->_blInit =
true;
255 $this->_sUserID = $oUser->getId();
260 throw new Exception(self::ERROR_USER_NO_RIGHTS);
275 $this->_aCsvFileFieldsOrder = $aCsvFields;
285 $this->_blCsvContainsHeader = $blCsvContainsHeader;
310 public function doImport($sPath = null, $sUserName = null, $sUserPassword = null, $sShopId = null, $sShopLanguage = null)
315 $this->_sReturn =
"";
316 $iMaxLineLength = 8192;
318 $this->_sPath = $sPath;
322 $this->
init(null, null);
324 return $this->_sReturn =
'ERPGENIMPORT_ERROR_USER_NO_RIGHTS';
327 $file = @fopen($this->_sPath,
"r");
329 if (isset($file) && $file) {
335 $this->_aData[] = $aRow;
338 if ($this->_blCsvContainsHeader) {
340 array_shift($this->_aData);
346 echo $ex->getMessage();
347 $this->_sReturn =
'ERPGENIMPORT_ERROR_DURING_IMPORT';
351 $this->_sReturn =
'ERPGENIMPORT_ERROR_WRONG_FILE';
368 $sChar =
$myConfig->getConfigParam(
'sGiCsvFieldTerminator');
371 $sChar =
$myConfig->getConfigParam(
'sCSVSign');
389 if ($sChar =
$myConfig->getConfigParam(
'sGiCsvFieldEncloser')) {