Complementary attributes: Difference between revisions

m
Tag: 2017 source edit
Line 15: Line 15:


==Label or translation key==
==Label or translation key==
* '''Mandatory field'''
 
* Label of the new field. This can be a translation key (new or existing), then you also need to set the 'language file' field.
*'''Mandatory field'''
*Label of the new field. This can be a translation key (new or existing), then you also need to set the 'language file' field.


==Attribute code==
==Attribute code==
* '''Mandatory field'''
 
* Code of the new field. Can only contain alphanumerical and lower case characters without space
*'''Mandatory field'''
*Code of the new field. Can only contain alphanumerical and lower case characters without space


==Type==
==Type==
* '''String (1 line)''' : Text on one line.
 
* '''Long text (n lines)''' : Text on several lines.
*'''String (1 line)''' : Text on one line.
* '''Html text''' : Text with HTML tags.
*'''Long text (n lines)''' : Text on several lines.
* '''Integer''' :  
*'''Html text''' : Text with HTML tags.
* '''Float''' :  
*'''Integer''' :
* '''Date''' :  
*'''Float''' :
* '''Date and hour''' :  
*'''Date''' :
* '''Boolean (one checkbox)''' :  
*'''Date and hour''' :
* '''Price''' :  
*'''Boolean (one checkbox)''' :
* '''Phone''' :  
*'''Price''' :
* '''Email''' :  
*'''Phone''' :
* '''Url''' :  
*'''Email''' :
* '''Password''' :  
*'''Url''' :
* '''Select list''' :  
*'''Password''' :
* '''Select from table''' :  
*'''Select list''' :
* '''Radio buttons (one choice only)''' :  
*'''Select from table''' :
* '''Checkboxes''' :  
*'''Radio buttons (one choice only)''' :
* '''Checkboxes from table''' :  
*'''Checkboxes''' :
* '''Link to an object''' :  
*'''Checkboxes from table''' :
* '''Separator (not a field)''' :
*'''Link to an object''' :
*'''Separator (not a field)''' :


==Size==
==Size==
Line 70: Line 73:
==Help text to show on tooltip==
==Help text to show on tooltip==


= Tips=
=Tips=


==Select from table==
==Select from table==


===List of suppliers in a Category ===
===List of suppliers in a Category===
* On phpmyadmin use the following code <code>SELECT cs.fk_soc, cs.fk_categorie, soc.nom FROM llx_categorie_societe cs inner join llx_societe soc WHERE cs.fk_soc=soc.rowid</code> to create a new "view" that you can name 'llx_mylistcategorie'
* Then on the complementary attribute, use <code>mylistcategorie:nom:fk_soc::fk_categorie=10</code>


== Computed Fields==
*On phpmyadmin use the following code <code>SELECT cs.fk_soc, cs.fk_categorie, soc.nom FROM llx_categorie_societe cs inner join llx_societe soc WHERE cs.fk_soc=soc.rowid</code> to create a new "view" that you can name <code>llx_mylistcategorie</code>
*Then on the complementary attribute, use <code>mylistcategorie:nom:fk_soc::fk_categorie=10</code>
 
==Computed Fields==
You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: '''$db, $conf, $langs, $mysoc, $user, $object'''.
You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: '''$db, $conf, $langs, $mysoc, $user, $object'''.


Line 100: Line 104:
<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>


== Visibility==
==Visibility==
<code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array('mycategory',$cats ))) ? 1 : 0</code>
<code>(($c = new Categorie($db)) && ($cats = $c->containing($object->id, Categorie::TYPE_PRODUCT))&& (in_array('mycategory',$cats ))) ? 1 : 0</code>
676

edits