Add Extrafields on PDF Models: Difference between revisions

Jump to navigation Jump to search
m
https://www.dolibarr.fr/forum/12-howto--aide/62681-wiki-dolibarr-org?start=270#116247
No edit summary
Tag: 2017 source edit
m (https://www.dolibarr.fr/forum/12-howto--aide/62681-wiki-dolibarr-org?start=270#116247)
Tag: 2017 source edit
Line 55: Line 55:


*Open the '''core\modules\facture\doc\''' directory
*Open the '''core\modules\facture\doc\''' directory
*Copy the '''pdf_crabe.modules.php'''
*Copy the '''pdf_crabe.modules.php''' in the same directory
*Rename the copy as '''pdf_my_template.modules.php'''
*Rename the copy as '''pdf_my_template.modules.php'''
*Edit and make the following changes in the code:
*Edit and make the following changes in the code:
Line 83: Line 83:
$object->fetch_optionals($rowid,$extralabels);
$object->fetch_optionals($rowid,$extralabels);
</source>
</source>
*Add the code to print the extrafiled <source lang="php">
*Add the code to print the extrafield <source lang="php">
$pdf->writeHTMLCell (190,3, $this->posxdesc-1, $tab_top-5, $outputlangs->convToOutputCharset($object->array_options['options_my_extra']),0,1);
$pdf->writeHTMLCell (190,3, $this->posxdesc-1, $tab_top-5, $outputlangs->convToOutputCharset($object->array_options['options_my_extra']),0,1);
</source>[[File:Invoices module template Modification.png]]
</source>[[File:Invoices module template Modification.png]]
Line 102: Line 102:
</source>[[File:Add extrafields line in pdf 2.png]]
</source>[[File:Add extrafields line in pdf 2.png]]
*Find <source lang="php">$posYAfterDescription=$pdf->GetY();</source>
*Find <source lang="php">$posYAfterDescription=$pdf->GetY();</source>
*Add, just before, the code to display the line extrafiled <source lang="php">
*Add, just before, the code to display the line extrafield <source lang="php">
$pdf->MultiCell(0, 3, $outputlangs->convToOutputCharset($object->lines[$i]->array_options['options_my_line_extra']), 0, 'L', 0);
$pdf->MultiCell(0, 3, $outputlangs->convToOutputCharset($object->lines[$i]->array_options['options_my_line_extra']), 0, 'L', 0);
</source>[[File:Add extrafields line in pdf 3.png]]
</source>[[File:Add extrafields line in pdf 3.png]]
676

edits

Navigation menu