19 'C' =>
'crossselling',
21 'T' =>
'article2category',
22 'I' =>
'article2action',
26 'R' =>
'orderarticle',
67 public function __call( $sMethod, $aArgs )
69 if ( defined(
'OXID_PHP_UNIT' ) ) {
70 if ( substr( $sMethod, 0, 4) ==
"UNIT" ) {
71 $sMethod = str_replace(
"UNIT",
"_", $sMethod );
73 if ( method_exists( $this, $sMethod)) {
74 return call_user_func_array( array( & $this, $sMethod ), $aArgs );
78 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;
216 $this->_sImportTypePrefix = $sType;
226 foreach ( $this->_aObjects as $sKey => $sImportType ) {
228 $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);
277 $this->_aCsvFileFieldsOrder = $aCsvFields;
289 $this->_blCsvContainsHeader = $blCsvContainsHeader;
314 public function doImport($sPath = null, $sUserName = null, $sUserPassword = null, $sShopId = null, $sShopLanguage = null )
319 $this->_sReturn =
"";
320 $iMaxLineLength = 8192;
322 $this->_sPath = $sPath;
326 $this->
init(null, null);
328 return $this->_sReturn =
'ERPGENIMPORT_ERROR_USER_NO_RIGHTS';
331 $file = @fopen($this->_sPath,
"r");
333 if ( isset($file) && $file ) {
339 $this->_aData[] = $aRow;
342 if ( $this->_blCsvContainsHeader ) {
344 array_shift( $this->_aData );
350 echo $ex->getMessage();
351 $this->_sReturn =
'ERPGENIMPORT_ERROR_DURING_IMPORT';
355 $this->_sReturn =
'ERPGENIMPORT_ERROR_WRONG_FILE';
372 $sChar =
$myConfig->getConfigParam(
'sGiCsvFieldTerminator' );
375 $sChar =
$myConfig->getConfigParam(
'sCSVSign' );
392 if ( $sChar =
$myConfig->getConfigParam(
'sGiCsvFieldEncloser' ) ) {