oxErpCsv Class Reference

Inheritance diagram for oxErpCsv:

Inheritance graph
[legend]
Collaboration diagram for oxErpCsv:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class handeling csv import and export

Definition at line 12 of file oxerpcsv.php.


Public Member Functions

 setFileId ($sId)
 loadSessionData ($sSessionID)
 ERPWriteOrderFile ($oOrder)
 DoImport ($sPath=null, $sUserName=null, $sUserPassword=null, $sShopId=null, $sShopLanguage=null)
 Import ()
 getImportData ()
 getBuffer ()

Public Attributes

 $_aImportedActions2Article = array()
 $_aImportedObject2Category = array()
 $_aImportedAccessoire2Article = array()

Static Public Attributes

static $EXCEPTION_FILE_EXIST = "File does allready exist!"
static $EXCEPTION_FAIL_CREATE_FILE = "Unable to create file!"
static $EXCEPTION_FAIL_WRITE_FILE = "Failed writing data to file!"
static $ERROR_DURING_IMPORT = "ERROR during import"
static $ERROR_WRONG_VERSION = "ERROR: File Version mismatch or no Version information!"
static $ERROR_WRONG_FILE = "ERROR: no file"
static $IMPORT_DONE = "IMPORT DONE"

Protected Member Functions

 _checkAndSetVersion ($sVersion)
 _csvTextConvert ($sText, $blMode)
 checkVersion ()
 _beforeExport ($sType)
 _afterExport ($sType)
 _beforeImport ()
 _afterImport ()
 _modifyData ($aData, $oType)
 _getImportType (&$aData)
 _getImportMode ($aData)
 _exportFullOrder ($oOrder)
 _createFile ($sType, $sId, $sPath=null)
 _addVersionTag ()
 _writeDsToBuffer ($sTag, $aDs, $sSep=";")
 _appendDsToBuffer ($aDs, $sSep=";")
 _flushBuffer ($file)
 _checkIDField ($sID)
 _getInstanceOfType ($sType)
 _mapFields ($aData, $oType)
 _ExportArticle ($aRow)
 _ExportAccessoire ($aRow)
 _ExportArticle2Action ($aRow)
 _ExportArticle2Category ($aRow)
 _ExportCategory ($aRow)
 _ExportCrossselling ($aRow)
 _ExportScaleprice ($aRow)
 _ExportOldOrder ($aRow)
 _ExportOrder ($aRow)
 _ExportOldOrderArticle ($aRow)
 _ExportOrderArticle ($aRow)
 _ExportUser ($aRow)
 _ExportVendor ($aRow)
 _ExportArticleStock ($aRow)
 _ExportCountry ($aRow)
 _ExportArtextends ($aRow)
 _ImportArticle (oxERPType &$oType, $aRow)
 _ImportAccessoire (oxERPType &$oType, $aRow)
 _DeleteAccessoire (oxERPType &$oType, $sId)
 _ImportArticle2Action (oxERPType &$oType, $aRow)
 _DeleteArticle2Action (oxERPType &$oType, $sId)
 _ImportArticle2Category (oxERPType &$oType, $aRow)
 _ImportMainArticle2Category (oxERPType &$oType, $aRow)
 _DeleteArticle2Category (oxERPType &$oType, $sId)
 _ImportCategory (oxERPType &$oType, $aRow)
 _DeleteCategory (oxERPType &$oType, $sId)
 _ImportCrossselling (oxERPType &$oType, $aRow)
 _DeleteCrossselling (oxERPType &$oType, $sId)
 _ImportScaleprice (oxERPType &$oType, $aRow)
 _DeleteScalePrice (oxERPType &$oType, $sId)
 _ImportOrder (oxERPType &$oType, $aRow)
 _ImportOrderArticle (oxERPType &$oType, $aRow)
 _DeleteOrderArticle (oxERPType &$oType, $sId)
 _DeleteOrder (oxERPType &$oType, $sId)
 _ImportOrderStatus (oxERPType &$oType, $aRow)
 _DeleteArticle (oxERPType &$oType, $sId)
 _ImportUser (oxERPType &$oType, $aRow)
 _DeleteUser (oxERPType &$oType, $sId)
 _ImportVendor (oxERPType &$oType, $aRow)
 _ImportArtextends (oxERPType &$oType, $aRow)
 _DeleteVendor (oxERPType &$oType, $sId)
 _ImportCountry (oxERPType &$oType, $aRow)
 _DeleteCountry (oxERPType &$oType, $sId)
 _ImportArticleStock (oxERPType &$oType, $aRow)

Protected Attributes

 $_aSupportedVersions = array("0.1", "1.0", "1.1", "2.0")
 $_aCsv2BaseVersionsMap = array("0.1" => "1", "1.0" => "1", "1.1"=>"1.1", "2.0" => "2")
 $_sErpVersion = "1.0"
 $_sCurrVersion = ""
 $_currFileId = ""
 $_sCurrImportType
 $_blVersionSkip = false
 $_aObjects
 $_aNewCommands
 $_aData = array()
 $_iRetryRows = 0
 $_sReturn
 $_sPath
 $_sBuffer
 $_iBufferRecCounter = 0

Private Member Functions

 getOldOrderArticleFieldList ()
 getOldOrderFielsList ()

Member Function Documentation

oxErpCsv.setFileId ( sId  ) 

Definition at line 79 of file oxerpcsv.php.

oxErpCsv.loadSessionData ( sSessionID  ) 

oxERPBase.loadSessionData() load session for CSV interface, special handeling for V 0.1

Parameters:
string $sSessionID

Reimplemented from oxERPBase.

Definition at line 89 of file oxerpcsv.php.

oxErpCsv.ERPWriteOrderFile ( oOrder  ) 

Exports the given order into a single txt file named "ordernumber.txt" V0.1

Parameters:
oxOrder $oOrder ???
Returns:
bool

Definition at line 136 of file oxerpcsv.php.

oxErpCsv.DoImport ( sPath = null,
sUserName = null,
sUserPassword = null,
sShopId = null,
sShopLanguage = null 
)

Main import method, whole import of all types via a given csv file is done here

Parameters:
string $sPath full path of the CSV file.
Returns:
string

Definition at line 158 of file oxerpcsv.php.

oxErpCsv._checkAndSetVersion ( sVersion  )  [protected]

Retruns true if the given version is compatible with the current version ($_sErpVersion)

Parameters:
string $sVersion
Returns:
bool

Definition at line 231 of file oxerpcsv.php.

oxErpCsv._csvTextConvert ( sText,
blMode 
) [protected]

parses and replaces special chars

Parameters:
string $sText input text
bool $blMode true = Text2CSV, false = CSV2Text
Returns:
string

Definition at line 255 of file oxerpcsv.php.

oxErpCsv.checkVersion (  )  [protected]

Definition at line 268 of file oxerpcsv.php.

oxErpCsv._beforeExport ( sType  )  [protected]

Reimplemented from oxERPBase.

Definition at line 277 of file oxerpcsv.php.

oxErpCsv._afterExport ( sType  )  [protected]

Reimplemented from oxERPBase.

Definition at line 288 of file oxerpcsv.php.

oxErpCsv.Import (  ) 

imports all data set up before

Reimplemented from oxERPBase.

Definition at line 292 of file oxerpcsv.php.

oxErpCsv._beforeImport (  )  [protected]

Reimplemented from oxERPBase.

Definition at line 303 of file oxerpcsv.php.

oxErpCsv._afterImport (  )  [protected]

Reimplemented from oxERPBase.

Definition at line 313 of file oxerpcsv.php.

oxErpCsv.getImportData (  ) 

Reimplemented from oxERPBase.

Definition at line 336 of file oxerpcsv.php.

oxErpCsv._modifyData ( aData,
oType 
) [protected]

Reimplemented from oxERPBase.

Reimplemented in oxErpGenImport.

Definition at line 341 of file oxerpcsv.php.

oxErpCsv._getImportType ( &$  aData  )  [protected]

Reimplemented from oxERPBase.

Reimplemented in oxErpGenImport.

Definition at line 367 of file oxerpcsv.php.

oxErpCsv._getImportMode ( aData  )  [protected]

Reimplemented from oxERPBase.

Reimplemented in oxErpGenImport.

Definition at line 387 of file oxerpcsv.php.

oxErpCsv._exportFullOrder ( oOrder  )  [protected]

makes a export of a order and all its articles into a single file method exists to be compatible to version 0.1

Returns:
bool

Definition at line 404 of file oxerpcsv.php.

oxErpCsv.getOldOrderArticleFieldList (  )  [private]

due to compatibility reasons, the field list of V0.1

Returns:
array

Definition at line 481 of file oxerpcsv.php.

oxErpCsv.getOldOrderFielsList (  )  [private]

due to compatibility reasons, the field list of V0.1

Returns:
array

Definition at line 512 of file oxerpcsv.php.

oxErpCsv._createFile ( sType,
sId,
sPath = null 
) [protected]

creates a file of the given type and a given id, retruns a file handler if files exists returns null

Parameters:
string $sType
string $sId
string path optional default: $myConfig->aERPInfo['sExpPath'] . ShopId
Exceptions:
Exception 
Returns:
file handler

Definition at line 584 of file oxerpcsv.php.

oxErpCsv._addVersionTag (  )  [protected]

Definition at line 607 of file oxerpcsv.php.

oxErpCsv._writeDsToBuffer ( sTag,
aDs,
sSep = ";" 
) [protected]

writes a given dataset to the internal buffer in CSV format "value1";"value2"; ... CR LF

Parameters:
array $aDs
string $sSp the seperator, default ";"

Definition at line 621 of file oxerpcsv.php.

oxErpCsv._appendDsToBuffer ( aDs,
sSep = ";" 
) [protected]

Appends the given data to the last Ds in buffer, therefore the last linebreak is removed, data added and then a new line break added again

Parameters:
unknown_type $aDs
unknown_type $sSep

Definition at line 641 of file oxerpcsv.php.

oxErpCsv._flushBuffer ( file  )  [protected]

writes the content of $this->_sBuffer to the given file

Parameters:
file $file
Exceptions:
Exception 
Returns:
null

Definition at line 662 of file oxerpcsv.php.

oxErpCsv.getBuffer (  ) 

Definition at line 672 of file oxerpcsv.php.

oxErpCsv._checkIDField ( sID  )  [protected]

Definition at line 678 of file oxerpcsv.php.

oxErpCsv._getInstanceOfType ( sType  )  [protected]

method overridden to allow olf Order and OrderArticle types

Parameters:
string $sType
Returns:
object

Reimplemented from oxERPBase.

Definition at line 693 of file oxerpcsv.php.

oxErpCsv._mapFields ( aData,
oType 
) [protected]

Maps numeric array to assoc. Array

Parameters:
array $aData numeric indices
Returns:
array assoc. indices

Reimplemented in oxErpGenImport.

Definition at line 726 of file oxerpcsv.php.

oxErpCsv._ExportArticle ( aRow  )  [protected]

Definition at line 749 of file oxerpcsv.php.

oxErpCsv._ExportAccessoire ( aRow  )  [protected]

Definition at line 755 of file oxerpcsv.php.

oxErpCsv._ExportArticle2Action ( aRow  )  [protected]

Definition at line 761 of file oxerpcsv.php.

oxErpCsv._ExportArticle2Category ( aRow  )  [protected]

Definition at line 766 of file oxerpcsv.php.

oxErpCsv._ExportCategory ( aRow  )  [protected]

Definition at line 771 of file oxerpcsv.php.

oxErpCsv._ExportCrossselling ( aRow  )  [protected]

Definition at line 777 of file oxerpcsv.php.

oxErpCsv._ExportScaleprice ( aRow  )  [protected]

Definition at line 783 of file oxerpcsv.php.

oxErpCsv._ExportOldOrder ( aRow  )  [protected]

Definition at line 790 of file oxerpcsv.php.

oxErpCsv._ExportOrder ( aRow  )  [protected]

Definition at line 796 of file oxerpcsv.php.

oxErpCsv._ExportOldOrderArticle ( aRow  )  [protected]

Definition at line 802 of file oxerpcsv.php.

oxErpCsv._ExportOrderArticle ( aRow  )  [protected]

Definition at line 808 of file oxerpcsv.php.

oxErpCsv._ExportUser ( aRow  )  [protected]

Definition at line 814 of file oxerpcsv.php.

oxErpCsv._ExportVendor ( aRow  )  [protected]

Definition at line 820 of file oxerpcsv.php.

oxErpCsv._ExportArticleStock ( aRow  )  [protected]

Definition at line 826 of file oxerpcsv.php.

oxErpCsv._ExportCountry ( aRow  )  [protected]

Definition at line 831 of file oxerpcsv.php.

oxErpCsv._ExportArtextends ( aRow  )  [protected]

Definition at line 837 of file oxerpcsv.php.

oxErpCsv._ImportArticle ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 855 of file oxerpcsv.php.

oxErpCsv._ImportAccessoire ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 877 of file oxerpcsv.php.

oxErpCsv._DeleteAccessoire ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 891 of file oxerpcsv.php.

oxErpCsv._ImportArticle2Action ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 898 of file oxerpcsv.php.

oxErpCsv._DeleteArticle2Action ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 914 of file oxerpcsv.php.

oxErpCsv._ImportArticle2Category ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 920 of file oxerpcsv.php.

oxErpCsv._ImportMainArticle2Category ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 935 of file oxerpcsv.php.

oxErpCsv._DeleteArticle2Category ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 955 of file oxerpcsv.php.

oxErpCsv._ImportCategory ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 962 of file oxerpcsv.php.

oxErpCsv._DeleteCategory ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 969 of file oxerpcsv.php.

oxErpCsv._ImportCrossselling ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 982 of file oxerpcsv.php.

oxErpCsv._DeleteCrossselling ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 998 of file oxerpcsv.php.

oxErpCsv._ImportScaleprice ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1006 of file oxerpcsv.php.

oxErpCsv._DeleteScalePrice ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1013 of file oxerpcsv.php.

oxErpCsv._ImportOrder ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1021 of file oxerpcsv.php.

oxErpCsv._ImportOrderArticle ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1029 of file oxerpcsv.php.

oxErpCsv._DeleteOrderArticle ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1036 of file oxerpcsv.php.

oxErpCsv._DeleteOrder ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1045 of file oxerpcsv.php.

oxErpCsv._ImportOrderStatus ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1054 of file oxerpcsv.php.

oxErpCsv._DeleteArticle ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1084 of file oxerpcsv.php.

oxErpCsv._ImportUser ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1092 of file oxerpcsv.php.

oxErpCsv._DeleteUser ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1116 of file oxerpcsv.php.

oxErpCsv._ImportVendor ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1124 of file oxerpcsv.php.

oxErpCsv._ImportArtextends ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1131 of file oxerpcsv.php.

oxErpCsv._DeleteVendor ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1139 of file oxerpcsv.php.

oxErpCsv._ImportCountry ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1146 of file oxerpcsv.php.

oxErpCsv._DeleteCountry ( oxERPType &$  oType,
sId 
) [protected]

Definition at line 1152 of file oxerpcsv.php.

oxErpCsv._ImportArticleStock ( oxERPType &$  oType,
aRow 
) [protected]

Definition at line 1159 of file oxerpcsv.php.


Member Data Documentation

oxErpCsv.$EXCEPTION_FILE_EXIST = "File does allready exist!" [static]

Definition at line 14 of file oxerpcsv.php.

oxErpCsv.$EXCEPTION_FAIL_CREATE_FILE = "Unable to create file!" [static]

Definition at line 15 of file oxerpcsv.php.

oxErpCsv.$EXCEPTION_FAIL_WRITE_FILE = "Failed writing data to file!" [static]

Definition at line 16 of file oxerpcsv.php.

oxErpCsv.$ERROR_DURING_IMPORT = "ERROR during import" [static]

Definition at line 18 of file oxerpcsv.php.

oxErpCsv.$ERROR_WRONG_VERSION = "ERROR: File Version mismatch or no Version information!" [static]

Definition at line 19 of file oxerpcsv.php.

oxErpCsv.$ERROR_WRONG_FILE = "ERROR: no file" [static]

Definition at line 20 of file oxerpcsv.php.

oxErpCsv.$IMPORT_DONE = "IMPORT DONE" [static]

Definition at line 21 of file oxerpcsv.php.

oxErpCsv.$_aSupportedVersions = array("0.1", "1.0", "1.1", "2.0") [protected]

Definition at line 23 of file oxerpcsv.php.

oxErpCsv.$_aCsv2BaseVersionsMap = array("0.1" => "1", "1.0" => "1", "1.1"=>"1.1", "2.0" => "2") [protected]

Definition at line 24 of file oxerpcsv.php.

oxErpCsv.$_sErpVersion = "1.0" [protected]

Definition at line 26 of file oxerpcsv.php.

oxErpCsv.$_sCurrVersion = "" [protected]

Definition at line 29 of file oxerpcsv.php.

oxErpCsv.$_currFileId = "" [protected]

Definition at line 31 of file oxerpcsv.php.

oxErpCsv.$_sCurrImportType [protected]

Definition at line 33 of file oxerpcsv.php.

oxErpCsv.$_blVersionSkip = false [protected]

Definition at line 34 of file oxerpcsv.php.

oxErpCsv.$_aObjects [protected]

Initial value:

 array  (
                                'A' => 'article',
                                'L' => 'article', //delete article, X is set in getimporttype (compatibility to 0.1)
                                'K' => 'category',
                                'H' => 'vendor',
                                'C' => 'crossselling',
                                'Z' => 'accessoire',
                                'T' => 'article2category',
                                'I' => 'article2action',
                                'S' => 'orderstatus',
                                'P' => 'scaleprice',
                                'U' => 'user',
                                'O' => 'order',
                                'R' => 'orderarticle',
                                'E' => 'articlestock',
                                'N' => 'country',
                                'D' => 'article2vendor',
                                'M' => 'mainarticle2categroy',
                                'Y' => 'artextends',
                            )

Reimplemented in oxErpGenImport.

Definition at line 36 of file oxerpcsv.php.

oxErpCsv.$_aNewCommands [protected]

Initial value:

 array(

    )

Definition at line 58 of file oxerpcsv.php.

oxErpCsv.$_aData = array() [protected]

Definition at line 62 of file oxerpcsv.php.

oxErpCsv.$_iRetryRows = 0 [protected]

Definition at line 64 of file oxerpcsv.php.

oxErpCsv.$_sReturn [protected]

Definition at line 66 of file oxerpcsv.php.

oxErpCsv.$_sPath [protected]

Definition at line 68 of file oxerpcsv.php.

oxErpCsv.$_sBuffer [protected]

Definition at line 71 of file oxerpcsv.php.

oxErpCsv.$_iBufferRecCounter = 0 [protected]

Definition at line 73 of file oxerpcsv.php.

oxErpCsv.$_aImportedActions2Article = array()

Definition at line 75 of file oxerpcsv.php.

oxErpCsv.$_aImportedObject2Category = array()

Definition at line 76 of file oxerpcsv.php.

oxErpCsv.$_aImportedAccessoire2Article = array()

Definition at line 77 of file oxerpcsv.php.


The documentation for this class was generated from the following file:

Generated on Thu Feb 19 15:06:58 2009 for OXID eShop CE by  doxygen 1.5.5