dolibarr 19.0.3
ExportCsv Class Reference

Class to build export files with format CSV. More...

Inheritance diagram for ExportCsv:
Collaboration diagram for ExportCsv:

Public Member Functions

 getDriverId ()
 getDriverId
 
 getDriverLabel ()
 getDriverLabel
 
 getDriverDesc ()
 getDriverDesc
 
 getDriverExtension ()
 getDriverExtension
 
 getDriverVersion ()
 getDriverVersion
 
 getLibLabel ()
 getLabelLabel
 
 getLibVersion ()
 getLibVersion
 
 open_file ($file, $outputlangs)
 Open output file.
 
 write_header ($outputlangs)
 Output header into file.
 
 write_title ($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
 Output title line into file.
 
 write_record ($array_selected_sorted, $objp, $outputlangs, $array_types)
 Output record line into file.
 
 write_footer ($outputlangs)
 Output footer into file.
 
 close_file ()
 Close file handle.
 
 csvClean ($newvalue, $charset)
 Clean a cell to respect rules of CSV file cells Note: It uses $this->separator Note: We keep this function public to be able to test.
 
- Public Member Functions inherited from ModeleExports
 listOfAvailableExportFormat ($db, $maxfilenamelength=0)
 Load into memory list of available export format.
 
 getPictoForKey ($key)
 Return picto of export driver.
 
 getDriverLabelForKey ($key)
 Return label of driver export.
 
 getDriverDescForKey ($key)
 Renvoi le descriptif d'un driver export.
 
 getDriverVersionForKey ($key)
 Renvoi version d'un driver export.
 
 getLibLabelForKey ($key)
 Renvoi label of driver lib.
 
 getLibVersionForKey ($key)
 Return version of driver lib.
 
- Public Member Functions inherited from CommonDocGenerator
 __construct ($db)
 Constructor.
 
 get_substitutionarray_user ($user, $outputlangs)
 Define array with couple substitution key => substitution value.
 
 getSubstitutionarrayMember ($member, $outputlangs)
 Define array with couple substitution key => substitution value.
 
 get_substitutionarray_mysoc ($mysoc, $outputlangs)
 Define array with couple substitution key => substitution value.
 
 get_substitutionarray_thirdparty ($object, $outputlangs, $array_key='company')
 Define array with couple substitution key => substitution value For example {company_name}, {company_name_alias}.
 
 get_substitutionarray_contact ($object, $outputlangs, $array_key='object')
 Define array with couple substitution key => substitution value.
 
 get_substitutionarray_other ($outputlangs)
 Define array with couple substitution key => substitution value.
 
 get_substitutionarray_object ($object, $outputlangs, $array_key='object')
 Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
 
 get_substitutionarray_lines ($line, $outputlangs, $linenumber=0)
 Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
 
 get_substitutionarray_shipment ($object, $outputlangs, $array_key='object')
 Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
 
 get_substitutionarray_each_var_object (&$object, $outputlangs, $recursive=1)
 Define array with couple substitution key => substitution value.
 
 fill_substitutionarray_with_extrafields ($object, $array_to_fill, $extrafields, $array_key, $outputlangs)
 Fill array with couple extrafield key => extrafield value Note that vars into substitutions array are formatted.
 
 printRect ($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
 Rect pdf.
 
 columnSort ($a, $b)
 uasort callback function to Sort columns fields
 
 prepareArrayColumnField ($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 Prepare Array Column Field.
 
 getColumnContentWidth ($colKey)
 get column content width from column key
 
 getColumnContentXStart ($colKey)
 get column content X (abscissa) left position from column key
 
 getColumnRank ($colKey)
 get column position rank from column key
 
 insertNewColumnDef ($newColKey, $defArray, $targetCol='', $insertAfterTarget=false)
 get column position rank from column key
 
 printStdColumnContent ($pdf, &$curY, $colKey, $columnText='')
 print standard column content
 
 printColDescContent ($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
 print description column content
 
 getExtrafieldContent ($object, $extrafieldKey, $outputlangs=null)
 get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note block
 
 getColumnStatus ($colKey)
 get column status from column key
 
 pdfTabTitles (&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
 Print standard column content.
 
 defineColumnExtrafield ($object, $outputlangs, $hidedetails=0)
 Define Array Column Field for extrafields.
 
 defineColumnField ($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 Define Array Column Field into $this->cols This method must be implemented by the module that generate the document with its own columns.
 

Detailed Description

Class to build export files with format CSV.

Definition at line 32 of file exportcsv.class.php.

Member Function Documentation

◆ close_file()

ExportCsv::close_file ( )

Close file handle.

Returns
int Return integer <0 if KO, >0 if OK

Definition at line 294 of file exportcsv.class.php.

◆ csvClean()

ExportCsv::csvClean ( $newvalue,
$charset )

Clean a cell to respect rules of CSV file cells Note: It uses $this->separator Note: We keep this function public to be able to test.

Parameters
string$newvalueString to clean
string$charsetInput AND Output character set
Returns
string Value cleaned

Definition at line 311 of file exportcsv.class.php.

References dol_htmlcleanlastbr(), getDolGlobalInt(), and getDolGlobalString().

Referenced by write_record(), and write_title().

◆ getDriverDesc()

ExportCsv::getDriverDesc ( )

getDriverDesc

Returns
string

Definition at line 85 of file exportcsv.class.php.

◆ getDriverExtension()

ExportCsv::getDriverExtension ( )

getDriverExtension

Returns
string

Definition at line 95 of file exportcsv.class.php.

◆ getDriverId()

ExportCsv::getDriverId ( )

getDriverId

Returns
string

Definition at line 65 of file exportcsv.class.php.

◆ getDriverLabel()

ExportCsv::getDriverLabel ( )

getDriverLabel

Returns
string Return driver label

Definition at line 75 of file exportcsv.class.php.

◆ getDriverVersion()

ExportCsv::getDriverVersion ( )

getDriverVersion

Returns
string

Definition at line 105 of file exportcsv.class.php.

◆ getLibLabel()

ExportCsv::getLibLabel ( )

getLabelLabel

Returns
string

Definition at line 115 of file exportcsv.class.php.

◆ getLibVersion()

ExportCsv::getLibVersion ( )

getLibVersion

Returns
string

Definition at line 125 of file exportcsv.class.php.

◆ open_file()

ExportCsv::open_file ( $file,
$outputlangs )

Open output file.

Parameters
string$filePath of filename to generate
Translate$outputlangsOutput language object
Returns
int Return integer <0 if KO, >=0 if OK

Definition at line 139 of file exportcsv.class.php.

References dol_syslog().

◆ write_footer()

ExportCsv::write_footer ( $outputlangs)

Output footer into file.

Parameters
Translate$outputlangsOutput language object
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 282 of file exportcsv.class.php.

◆ write_header()

ExportCsv::write_header ( $outputlangs)

Output header into file.

Parameters
Translate$outputlangsOutput language object
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 166 of file exportcsv.class.php.

◆ write_record()

ExportCsv::write_record ( $array_selected_sorted,
$objp,
$outputlangs,
$array_types )

Output record line into file.

Parameters
array$array_selected_sortedArray with list of field to export
Resource$objpA record from a fetch with all fields from select
Translate$outputlangsObject lang to translate values
array$array_typesArray with types of fields
Returns
int Return integer <0 if KO, >0 if OK

Reimplemented in ExportCsvIso, and ExportCsvUtf8.

Definition at line 221 of file exportcsv.class.php.

References csvClean(), dol_print_error(), and jsonOrUnserialize().

◆ write_title()

ExportCsv::write_title ( $array_export_fields_label,
$array_selected_sorted,
$outputlangs,
$array_types )

Output title line into file.

Parameters
array$array_export_fields_labelArray with list of label of fields
array$array_selected_sortedArray with list of field to export
Translate$outputlangsObject lang to translate values
array$array_typesArray with types of fields
Returns
int Return integer <0 if KO, >0 if OK

Reimplemented in ExportCsvIso, and ExportCsvUtf8.

Definition at line 183 of file exportcsv.class.php.

References csvClean().


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