dolibarr 19.0.4
CommonDocGenerator Class Reference

Parent class for documents (PDF, ODT, ...) generators. More...

Inheritance diagram for CommonDocGenerator:

Public Member Functions

 __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

Parent class for documents (PDF, ODT, ...) generators.

Definition at line 37 of file commondocgenerator.class.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ columnSort()

CommonDocGenerator::columnSort ( $a,
$b )

uasort callback function to Sort columns fields

Parameters
array$aPDF lines array fields configs
array$bPDF lines array fields configs
Returns
int Return compare result

Definition at line 1070 of file commondocgenerator.class.php.

◆ defineColumnExtrafield()

CommonDocGenerator::defineColumnExtrafield ( $object,
$outputlangs,
$hidedetails = 0 )

◆ defineColumnField()

CommonDocGenerator::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.

Parameters
Object$objectCommon object
Translate$outputlangsLangs
int$hidedetailsDo not show line details
int$hidedescDo not show desc
int$hiderefDo not show ref
Returns
void

Reimplemented in pdf_cornas, pdf_cyan, pdf_eagle_proforma, pdf_eratosthene, pdf_espadon, pdf_sponge, pdf_standard_asset, pdf_standard_myobject, pdf_standard_recruitmentjobposition, pdf_storm, pdf_vinci, and pdf_zenith.

Definition at line 1777 of file commondocgenerator.class.php.

Referenced by prepareArrayColumnField().

◆ fill_substitutionarray_with_extrafields()

CommonDocGenerator::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.

Parameters
Object$objectObject with extrafields (must have $object->array_options filled)
array$array_to_fillSubstitution array
Extrafields$extrafieldsExtrafields object
string$array_keyPrefix for name of the keys into returned array
Translate$outputlangsLang object to use for output
Returns
array Substitution array

Definition at line 956 of file commondocgenerator.class.php.

References dol_include_once(), dol_print_date(), price(), and price2num().

Referenced by get_substitutionarray_contact(), get_substitutionarray_lines(), get_substitutionarray_object(), doc_generic_project_odt\get_substitutionarray_object(), doc_generic_task_odt\get_substitutionarray_object(), get_substitutionarray_shipment(), doc_generic_project_odt\get_substitutionarray_tasks(), doc_generic_task_odt\get_substitutionarray_tasks(), get_substitutionarray_thirdparty(), get_substitutionarray_user(), and getSubstitutionarrayMember().

◆ get_substitutionarray_contact()

◆ get_substitutionarray_each_var_object()

◆ get_substitutionarray_lines()

CommonDocGenerator::get_substitutionarray_lines ( $line,
$outputlangs,
$linenumber = 0 )

◆ get_substitutionarray_mysoc()

◆ get_substitutionarray_object()

CommonDocGenerator::get_substitutionarray_object ( $object,
$outputlangs,
$array_key = 'object' )

◆ get_substitutionarray_other()

◆ get_substitutionarray_shipment()

CommonDocGenerator::get_substitutionarray_shipment ( $object,
$outputlangs,
$array_key = 'object' )

Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.

Parameters
Expedition$objectMain object to use as data source
Translate$outputlangsLang object to use for output
string$array_keyName of the key for return array
Returns
array Array of substitution

Definition at line 841 of file commondocgenerator.class.php.

References dol_include_once(), dol_print_date(), fill_substitutionarray_with_extrafields(), measuringUnitString(), and price().

Referenced by doc_generic_shipment_odt\write_file().

◆ get_substitutionarray_thirdparty()

◆ get_substitutionarray_user()

◆ getColumnContentWidth()

CommonDocGenerator::getColumnContentWidth ( $colKey)

get column content width from column key

Parameters
string$colKeythe column key
Returns
float width in mm

Definition at line 1164 of file commondocgenerator.class.php.

Referenced by pdf_storm\write_file().

◆ getColumnContentXStart()

CommonDocGenerator::getColumnContentXStart ( $colKey)

◆ getColumnRank()

CommonDocGenerator::getColumnRank ( $colKey)

get column position rank from column key

Parameters
string$colKeythe column key
Returns
int rank on success and -1 on error

Definition at line 1189 of file commondocgenerator.class.php.

Referenced by insertNewColumnDef().

◆ getColumnStatus()

◆ getExtrafieldContent()

CommonDocGenerator::getExtrafieldContent ( $object,
$extrafieldKey,
$outputlangs = null )

get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note block

Parameters
object$objectCommon object
string$extrafieldKeyThe extrafield key
Translate$outputlangsThe output langs (if value is __(XXX)__ we use it to translate it).
Returns
string

Definition at line 1336 of file commondocgenerator.class.php.

References dol_string_nohtmltag(), and setEventMessages().

Referenced by pdf_cornas\write_file(), pdf_cyan\write_file(), pdf_eagle_proforma\write_file(), pdf_eratosthene\write_file(), pdf_espadon\write_file(), pdf_sponge\write_file(), pdf_standard_asset\write_file(), pdf_standard_myobject\write_file(), pdf_storm\write_file(), and pdf_zenith\write_file().

◆ getSubstitutionarrayMember()

CommonDocGenerator::getSubstitutionarrayMember ( $member,
$outputlangs )

Define array with couple substitution key => substitution value.

Parameters
Adherent$memberMember
Translate$outputlangsLanguage object for output
Returns
array Array of substitution key->code

Definition at line 238 of file commondocgenerator.class.php.

References dol_print_date(), fill_substitutionarray_with_extrafields(), and get_exdir().

Referenced by doc_generic_member_odt\write_file().

◆ insertNewColumnDef()

CommonDocGenerator::insertNewColumnDef ( $newColKey,
$defArray,
$targetCol = '',
$insertAfterTarget = false )

get column position rank from column key

Parameters
string$newColKeythe new column key
array$defArraya single column definition array
string$targetColtarget column used to place the new column beside
bool$insertAfterTargetinsert before or after target column ?
Returns
int new rank on success and -1 on error

Definition at line 1206 of file commondocgenerator.class.php.

References getColumnRank().

Referenced by defineColumnExtrafield().

◆ pdfTabTitles()

CommonDocGenerator::pdfTabTitles ( & $pdf,
$tab_top,
$tab_height,
$outputlangs,
$hidetop = 0 )

◆ prepareArrayColumnField()

CommonDocGenerator::prepareArrayColumnField ( $object,
$outputlangs,
$hidedetails = 0,
$hidedesc = 0,
$hideref = 0 )

Prepare Array Column Field.

Parameters
object$objectcommon object
Translate$outputlangslangs
int$hidedetailsDo not show line details
int$hidedescDo not show desc
int$hiderefDo not show ref
Returns
void

Definition at line 1094 of file commondocgenerator.class.php.

References defineColumnField(), and getColumnStatus().

Referenced by pdf_cornas\write_file(), pdf_cyan\write_file(), pdf_eagle_proforma\write_file(), pdf_eratosthene\write_file(), pdf_espadon\write_file(), pdf_sponge\write_file(), pdf_standard_asset\write_file(), pdf_standard_myobject\write_file(), pdf_standard_recruitmentjobposition\write_file(), pdf_storm\write_file(), pdf_vinci\write_file(), and pdf_zenith\write_file().

◆ printColDescContent()

CommonDocGenerator::printColDescContent ( $pdf,
& $curY,
$colKey,
$object,
$i,
$outputlangs,
$hideref = 0,
$hidedesc = 0,
$issupplierline = 0 )

print description column content

Parameters
TCPDF$pdfpdf object
float$curYcurent Y position
string$colKeythe column key
object$objectCommonObject
int$ithe $object->lines array key
Translate$outputlangsOutput language
int$hiderefhide ref
int$hidedeschide desc
int$issupplierlineif object need supplier product
Returns
void

Definition at line 1299 of file commondocgenerator.class.php.

References pdf_writelinedesc(), and printStdColumnContent().

Referenced by pdf_cornas\write_file(), pdf_cyan\write_file(), pdf_eagle_proforma\write_file(), pdf_eratosthene\write_file(), pdf_espadon\write_file(), pdf_sponge\write_file(), pdf_standard_asset\write_file(), pdf_standard_myobject\write_file(), pdf_standard_recruitmentjobposition\write_file(), and pdf_zenith\write_file().

◆ printRect()

CommonDocGenerator::printRect ( $pdf,
$x,
$y,
$l,
$h,
$hidetop = 0,
$hidebottom = 0 )

◆ printStdColumnContent()

CommonDocGenerator::printStdColumnContent ( $pdf,
& $curY,
$colKey,
$columnText = '' )

print standard column content

Parameters
TCPDF$pdfpdf object
float$curYcurent Y position
string$colKeythe column key
string$columnTextcolumn text
Returns
int Return integer <0 if KO, >= if OK

Definition at line 1251 of file commondocgenerator.class.php.

References getColumnContentXStart(), and setEventMessages().

Referenced by pdf_espadon\_tableau_tot(), printColDescContent(), pdf_cornas\write_file(), pdf_cyan\write_file(), pdf_eagle_proforma\write_file(), pdf_eratosthene\write_file(), pdf_espadon\write_file(), pdf_sponge\write_file(), pdf_standard_asset\write_file(), pdf_standard_myobject\write_file(), pdf_storm\write_file(), pdf_vinci\write_file(), and pdf_zenith\write_file().


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