31,034
edits
m (→Introduction) Tag: 2017 source edit |
|||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{TemplateDocUser}} | {{TemplateDocUser}} | ||
=Introduction= | =Introduction= | ||
Most of the Dolibarr modules have the possibilities to enhance the standard fields by new | Most of the Dolibarr modules have the possibilities to enhance the standard fields by new custom fields. | ||
These fields are called "Complementary attributes" can be defined for objects or object lines. | |||
=How to use= | =How to use= | ||
| Line 66: | Line 67: | ||
==Visibility== | ==Visibility== | ||
Define when a complementary attributes will be visible. | |||
==Display on PDF== | ==Display on PDF== | ||
Do we have to show the value into the generated PDF ? | |||
==Totalizable== | ==Totalizable== | ||
Define is this new attribute can be summed and if the application must show the value of the sum on the line "Total" at the bottom of lists. | |||
==Help text to show on tooltip== | ==Help text to show on tooltip== | ||
| Line 103: | Line 108: | ||
<code>(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found'</code> | <code>(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found'</code> | ||
===Example to have the third party balance=== | |||
<code>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($obj->rowid)) && ( $ret=$reloadedobj->getOutStandingBills()) | |||
) ? $ret['opened']: 666</code> | |||
===Example to have the third party open invoices=== | |||
<code>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($obj->rowid)) && ( $ret=$reloadedobj->getOutStandingBills()) | |||
) ? sizeof($ret['refsopened']): 666</code> | |||
==Visibility== | ==Visibility== | ||
<code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array(' | To display one attribute only if the object belongs to a certain category, you can use the following code : | ||
<code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array('mycategory_id',$cats ))) ? 1 : 0</code> | |||
To display one attribute only if the object is a product : | |||
<code>((preg_match('/type=product',$_SERVER['QUERY_STRING']) || preg_match('/type=0',$_SERVER['QUERY_STRING']))? 1 : 0</code> | |||