Add Extrafields on PDF Models: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: 2017 source edit
No edit summary
Tag: 2017 source edit
Line 86: Line 86:
$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]]
* Result : [[File:Invoices module template Modification Result.png|none|thumb]]
*Result : [[File:Invoices module template Modification Result.png|none|thumb]]


==Line complementary attribute==
==Line complementary attribute==
Line 103: Line 103:
*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 extrafiled <source lang="php">
$pdf->MultiCell(0, 3, $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]]
* Result : [[File:Invoices module template Modification Result 2.png|none|thumb]]
*Result : [[File:Invoices module template Modification Result 2.png|none|thumb]]
 
= Special Case for Extrafields type Select list =
 
==Configuration==
You can create a line or a module extrafield with the type '''Select list'''
[[File:List Extrafield.png|none|thumb]]
 
==Verification on the Invoices Module==
You should have a Module or Line extrafield (on this print screen this a Module)
[[File:List Extrafield Invoice.png|none|thumb]]
 
==Invoice Template==
On the php invoice template, if you use the classical php code to print the extrafield, you will print the code (1 or 2 in our exemple) instead of printing the label (Hello Word or Hello Alone in our exemple).
 
To display the label instead of the code, you shoudl replace the :
<source lang="php">$outputlangs->convToOutputCharset($object->array_options['options_my_extra'])</source>
by :
<source lang="php">$extrafields->showOutputField('my_extra', $object->array_options['options_my_extra'])</source>
676

edits

Navigation menu