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 65: Line 65:
*Open the new template '''pdf_my_template.modules.php'''
*Open the new template '''pdf_my_template.modules.php'''
*Look for the last '''require_one''' lines ate the beginning of the template
*Look for the last '''require_one''' lines ate the beginning of the template
*Add the line '''require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';'''[[File:Add_extrafields_in_pdf_1.png|none|thumb]]
*Add the line <source lang="php">require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'</source>[[File:Add_extrafields_in_pdf_1.png|none|thumb]]
 
== Module complementary attribute ==
*Find the <source lang="php">function write_file'''</source>
*Just before the <source lang="php">// Affiche notes'''</source>
*Add the code to load extrafield array in object <source lang="php">
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
</source>
*Add the code to load extrafield into object <source lang="php">
$object->fetch($rowid);
$object->fetch_optionals($rowid,$extralabels);
</source>
*Add the code to display the extrafiled
<source lang="php">
$pdf->MultiCell (190,3, $outputlangs->convToOutputCharset($object->array_options ['options_my_extra']),0,'L'); );
</source>
676

edits

Navigation menu