76 $this->_sCsvFilePath = null;
78 $sNavStep = $oConfig->getRequestParameter(
'sNavStep');
96 if ($sTerminator = $oConfig->getRequestParameter(
'sGiCsvFieldTerminator')) {
97 $this->_sStringTerminator = $sTerminator;
98 $oConfig->saveShopConfVar(
'str',
'sGiCsvFieldTerminator', $sTerminator);
101 if ($sEncloser = $oConfig->getRequestParameter(
'sGiCsvFieldEncloser')) {
102 $this->_sStringEncloser = $sEncloser;
103 $oConfig->saveShopConfVar(
'str',
'sGiCsvFieldEncloser', $sEncloser);
106 $sType = $oConfig->getRequestParameter(
'sType');
107 $oType = $oErpImport->getImportObject($sType);
108 $this->_aViewData[
'sType'] = $sType;
109 $this->_aViewData[
'sImportTable'] = $oType->getBaseTableName();
111 $this->_aViewData[
'aDbFieldsList'] = $oType->getFieldList();
114 if ($sNavStep == 3) {
115 $aCsvFields = $oConfig->getRequestParameter(
'aCsvFields');
116 $sType = $oConfig->getRequestParameter(
'sType');
119 $oErpImport->setImportTypePrefix($sType);
120 $oErpImport->setCsvFileFieldsOrder($aCsvFields);
124 $this->_aViewData[
'iTotalRows'] = $oErpImport->getTotalImportedRowsNumber();
133 if ($oConfig->getRequestParameter(
'iRepeatImport')) {
134 $this->_aViewData[
'iRepeatImport'] = 1;
139 if ($sNavStep == 1) {
140 $this->_aViewData[
'aImportTables'] = $oErpImport->getImportObjectsList();
141 asort($this->_aViewData[
'aImportTables']);
145 $this->_aViewData[
'sNavStep'] = $sNavStep;
156 if (is_file($sPath)) {
169 $blCsvContainsHeader = $this->
getConfig()->getRequestParameter(
'blContainsHeader');
175 if (!$blCsvContainsHeader) {
177 foreach ($aFirstRow as $sValue) {
178 $aCsvFields[$iIndex] =
'Column ' . $iIndex++;
181 foreach ($aFirstRow as $sKey => $sValue) {
185 $aCsvFields = $aFirstRow;
199 $iMaxLineLength = 8192;
202 if (($rFile = @fopen($sPath,
"r")) !==
false) {
215 $this->_sCsvFilePath = null;
230 if ($iNavStep == 2) {
232 $oEx =
oxNew(
"oxExceptionToDisplay");
233 $oEx->setMessage(
'GENIMPORT_ERRORUPLOADINGFILE');
234 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'genimport');
239 if ($iNavStep == 3) {
241 $aCsvFields = $this->
getConfig()->getRequestParameter(
'aCsvFields');
242 foreach ($aCsvFields as $sValue) {
250 $oEx =
oxNew(
"oxExceptionToDisplay");
251 $oEx->setMessage(
'GENIMPORT_ERRORASSIGNINGFIELDS');
252 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'genimport');
269 if ($this->_sCsvFilePath !== null) {
276 $aFile = $oConfig->getUploadedFile(
'csvfile');
277 if (isset($aFile[
'name']) && $aFile[
'name']) {
278 $this->_sCsvFilePath = $oConfig->getConfigParam(
'sCompileDir') . basename($aFile[
'tmp_name']);
279 move_uploaded_file($aFile[
'tmp_name'], $this->_sCsvFilePath);
293 foreach ($oErpImport->getStatistics() as $aValue) {
294 if (!$aValue [
'r']) {
295 $oEx =
oxNew(
"oxExceptionToDisplay");
296 $oEx->setMessage($aValue [
'm']);
297 oxRegistry::get(
"oxUtilsView")->addErrorToDisplay($oEx,
false,
true,
'genimport');
310 if ($this->_sStringTerminator === null) {
312 if ($sChar = $this->
getConfig()->getConfigParam(
'sGiCsvFieldTerminator')) {
313 $this->_sStringTerminator = $sChar;
327 if ($this->_sStringEncloser === null) {
329 if ($sChar = $this->
getConfig()->getConfigParam(
'sGiCsvFieldEncloser')) {
330 $this->_sStringEncloser = $sChar;