Extrafields: Difference between revisions

Jump to navigation Jump to search
Line 14: Line 14:
== Technical implementation ==
== Technical implementation ==


Each object have his table in database to store values of etrafields
Each object have his table in database to store values of extrafields.
 
[[Datatables extrafield tables models is  :]]
llx_''BaseTableNAme''_extrafields
(
  rowid                    integer AUTO_INCREMENT PRIMARY KEY,
  tms                      timestamp,
  fk_object                integer NOT NULL,
  import_key                varchar(14)
)
 
[[Display page have to include :]]
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
 
[[Load extrafield array in object :]]
$extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('''ObjectClassName''');
 
[[Load extrafield into object :]]
''$object''->fetch($rowid);
''$object''->fetch_optionals($rowid,$extralabels);
 
[[Before call ''$object''->create or ''$object''->delete :]]
$ret = $extrafields->setOptionalsFromPost($extralabels,''$object'');
 
[[Inside edit page to display extrafields :]]
// Other attributes
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action);    // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
      print ''$object''->showOptionals($extrafields,'edit');
}
 
[[Inside view page to display extrafields :]]
// Other attributes
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action);    // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
      print ''$object''->showOptionals($extrafields);
}
Bureaucrats, emailconfirmed, Administrators
825

edits

Navigation menu