source/Core/GenericImport/GenericImport.php
public function importFile($importFilePath = null)
    {
        $this->returnMessage = '';
        $this->importFilePath = $importFilePath;

        //init with given data
        try {
            $this->init();
        } catch (Exception $ex) {
            return $this->returnMessage = 'ERPGENIMPORT_ERROR_USER_NO_RIGHTS';
        }

        $file = @fopen($this->importFilePath, 'r');

        if (isset($file) && $file) {
            $data = [];
            while (($row = fgetcsv($file, $this->maxLineLength, $this->getCsvFieldsTerminator(), $this->getCsvFieldsEncolser())) !== false) {
                $data[] = $this->csvTextConvert($row, false);
            }

            if ($this->csvContainsHeader) {
                array_shift($data);
            }

            try {
                $this->importData($data);
            } catch (Exception $ex) {
                echo $ex->getMessage();
                $this->returnMessage = 'ERPGENIMPORT_ERROR_DURING_IMPORT';
            }
        } else {
            $this->returnMessage = 'ERPGENIMPORT_ERROR_WRONG_FILE';
        }

        @fclose($file);

        return $this->returnMessage;
    }
public function importFile($importFilePath = null)
    {
        $this->returnMessage = '';
        $this->importFilePath = $importFilePath;

        //init with given data
        try {
            $this->init();
        } catch (Exception $ex) {
            return $this->returnMessage = 'ERPGENIMPORT_ERROR_USER_NO_RIGHTS';
        }

        $file = @fopen($this->importFilePath, 'r');

        if (isset($file) && $file) {
            $data = [];
            while (($row = fgetcsv($file, $this->maxLineLength, $this->getCsvFieldsTerminator(), $this->getCsvFieldsEncolser())) !== false) {
                $data[] = $this->csvTextConvert($row, false);
            }

            if ($this->csvContainsHeader) {
                array_shift($data);
            }

            try {
                $this->importData($data);
            } catch (Exception $ex) {
                echo $ex->getMessage();
                $this->returnMessage = 'ERPGENIMPORT_ERROR_DURING_IMPORT';
            }
        } else {
            $this->returnMessage = 'ERPGENIMPORT_ERROR_WRONG_FILE';
        }

        @fclose($file);

        return $this->returnMessage;
    }
public function importFile ( $ importFilePath = null ) { $ this -> returnMessage = '' ; $ this -> importFilePath = $ importFilePath ; //init with given data try { $ this -> init ( ) ; } catch ( Exception $ ex ) { return $ this -> returnMessage = 'ERPGENIMPORT_ERROR_USER_NO_RIGHTS' ; } $ file = @ fopen ( $ this -> importFilePath , 'r' ) ; if ( isset ( $ file ) && $ file ) { $ data = [ ] ; while ( ( $ row = fgetcsv ( $ file , $ this -> maxLineLength , $ this -> getCsvFieldsTerminator ( ) , $ this -> getCsvFieldsEncolser ( ) ) ) !== false ) { $ data [ ] = $ this -> csvTextConvert ( $ row , false ) ; } if ( $ this -> csvContainsHeader ) { array_shift ( $ data ) ; } try { $ this -> importData ( $ data ) ; } catch ( Exception $ ex ) { echo $ ex -> getMessage ( ) ; $ this -> returnMessage = 'ERPGENIMPORT_ERROR_DURING_IMPORT' ; } } else { $ this -> returnMessage = 'ERPGENIMPORT_ERROR_WRONG_FILE' ; } @ fclose ( $ file ) ; return $ this -> returnMessage ; }
Main import method, whole import of all types via a given csv file is done here.

@param string $importFilePath Full path of the CSV file.

@return string
Main import method whole import of all types via a given csv file is done here .