dolibarr 21.0.0-alpha
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_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.
 
 printRoundedRect ($pdf, $x, $y, $w, $h, $r, $hidetop=0, $hidebottom=0, $style='D')
 Print a rounded rectangle on the 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 39 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{rank?:int}$a PDF lines array fields configs
array{rank?:int}$b PDF lines array fields configs
Returns
int<-1,1> Return compare result

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

◆ defineColumnExtrafield()

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

Define Array Column Field for extrafields.

Parameters
object$objectcommon object det
Translate$outputlangslangs
int$hidedetailsDo not show line details
Returns
int Return integer <0 if KO, >=0 if OK

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

References $object, and insertNewColumnDef().

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

◆ 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_eratosthene, pdf_espadon, pdf_octopus, pdf_sponge, pdf_standard_asset, pdf_standard_myobject, pdf_standard_recruitmentjobposition, pdf_storm, pdf_vinci, and pdf_zenith.

Definition at line 1975 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
CommonObject$objectObject with extrafields (must have $object->array_options filled)
array<string,string>$array_to_fill Substitution array
Extrafields$extrafieldsExtrafields object
string$array_keyPrefix for name of the keys into returned array
Translate$outputlangsLang object to use for output
Returns
array<string,string> Substitution array

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

References $id, $object, dol_include_once(), dol_print_date(), price(), and price2num().

Referenced by get_substitutionarray_contact(), get_substitutionarray_lines(), 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()

CommonDocGenerator::get_substitutionarray_each_var_object ( & $object,
$outputlangs,
$recursive = 1 )

◆ get_substitutionarray_lines()

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

◆ get_substitutionarray_mysoc()

◆ 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<string,mixed> Array of substitution

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

References $object, dol_print_date(), fill_substitutionarray_with_extrafields(), measuringUnitString(), and price().

◆ 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 1354 of file commondocgenerator.class.php.

Referenced by pdf_storm\write_file().

◆ getColumnContentXStart()

CommonDocGenerator::getColumnContentXStart ( $colKey)

get column content X (abscissa) left position from column key

Parameters
string$colKeythe column key
Returns
float X position in mm

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

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

◆ 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 1379 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
CommonObject$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 1526 of file commondocgenerator.class.php.

References $object, 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<string,mixed> Array of substitution key->code

Definition at line 372 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{rank?:int}$defArray a 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 1396 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
CommonObject$objectcommon object
Translate$outputlangslangs
int<0,1>$hidedetails Do not show line details
int<0,1>$hidedesc Do not show desc
int<0,1>$hideref Do not show ref
Returns
void

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

References $object, 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_octopus\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
TCPDI | TCPDF$pdfPdf object
float$curYcurrent Y position
string$colKeythe column key
CommonObject$objectCommonObject
int$ithe $object->lines array key
Translate$outputlangsOutput language
int<0,1>$hideref hide ref
int<0,1>$hidedesc hide desc
int<0,1>$issupplierline if object needx supplier product
Returns
void

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

References $object, 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_octopus\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 )

Rect pdf.

Parameters
TCPDI | TCPDF$pdfPdf object
float$xAbscissa of first point
float$yOrdinate of first point
float$l??
float$h??
int<-1,1>$hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
int<0,1>$hidebottom Hide bottom
Returns
void

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

Referenced by pdf_standard_myobject\_tableau(), and pdf_standard_recruitmentjobposition\_tableau().

◆ printRoundedRect()

CommonDocGenerator::printRoundedRect ( $pdf,
$x,
$y,
$w,
$h,
$r,
$hidetop = 0,
$hidebottom = 0,
$style = 'D' )

Print a rounded rectangle on the PDF.

Parameters
TCPDF$pdfObject PDF
float$xAbscissa of first point
float$yOrdinate of first point
float$wWidth of the rectangle
float$hHeight of the rectangle
float$rCorner radius (can be an array for different radii per corner)
int$hidetop1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
int$hidebottomHide bottom
string$styleDraw style (e.g. 'D' for draw, 'F' for fill, 'DF' for both)
Returns
void

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

Referenced by pdf_aurore\_tableau(), pdf_azur\_tableau(), pdf_canelle\_tableau(), pdf_cornas\_tableau(), pdf_crabe\_tableau(), pdf_cyan\_tableau(), pdf_eagle\_tableau(), pdf_eagle_proforma\_tableau(), pdf_einstein\_tableau(), pdf_eratosthene\_tableau(), pdf_espadon\_tableau(), pdf_muscadet\_tableau(), pdf_octopus\_tableau(), pdf_rouget\_tableau(), pdf_soleil\_tableau(), pdf_sponge\_tableau(), pdf_squille\_tableau(), pdf_standard\_tableau(), pdf_standard_asset\_tableau(), pdf_standard_stock\_tableau(), pdf_storm\_tableau(), pdf_strato\_tableau(), pdf_typhon\_tableau(), pdf_vinci\_tableau(), and pdf_zenith\_tableau().

◆ printStdColumnContent()

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

print standard column content

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

Definition at line 1441 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_octopus\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: