Extrafields

= Extrafields =

Extrafields allow to add others datas to Dolibarr standard database schema. Introduced in version 3.2, extrafields are now implemented in businesses object :
 * Thirdparties & contacts
 * Users
 * Events
 * Customer Invoices
 * Proposal
 * Products & services
 * Member & member type
 * Orders
 * Projects & project tasks (since 3.4)

Technical implementation
Each object has its table in database to store values of extrafields.

Datatables extrafield tables models
llx_BaseTableNAme_extrafields rowid                    integer AUTO_INCREMENT PRIMARY KEY, tms                      timestamp, fk_object                integer NOT NULL, import_key               varchar(14)

An example of mysql definition file for extrafields implementation on an object :

create table llx_place_room_extrafields (   rowid                     integer AUTO_INCREMENT PRIMARY KEY,    tms                       timestamp,    fk_object                 integer NOT NULL,    import_key                varchar(14)                          		-- import key  ) ENGINE=innodb;

Load class for extrafields
To use extrafields all pages need include

Load extrafield array in object
$extralabels will be an array with code and label of extrafields.

Load extrafield into object
Extrafields are loaded in $object->array_options array.

Display extrafield value into PDF or HTML
After load extrafields

HTML Exemple Where XXX is the code of the extrafields

PDF example Where XXX is the code of the extrafields

Before call $object->create or $object->update
Values of extrafields sent by form need to be retrieve. For doing that, use this method :

Repair Database
Search and find definition of $listofmodulesextra add the new extrafield declaration