|
dolibarr
13.0.2
|
Class to manage standard extra fields. More...
Collaboration diagram for ExtraFields:Public Member Functions | |
| __construct ($db) | |
| Constructor. More... | |
| addExtraField ($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value= '', $param= '', $alwayseditable=0, $perms= '', $list= '-1', $help= '', $computed= '', $entity= '', $langfile= '', $enabled= '1', $totalizable=0, $printable=0) | |
| Add a new extra field parameter. More... | |
| delete ($attrname, $elementtype= 'member') | |
| Delete an optional attribute. More... | |
| update ($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param= '', $alwayseditable=0, $perms= '', $list= '', $help= '', $default= '', $computed= '', $entity= '', $langfile= '', $enabled= '1', $totalizable=0, $printable=0) | |
| Modify type of a personalized attribute. More... | |
| fetch_name_optionals_label ($elementtype, $forceload=false) | |
| Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ... More... | |
| showInputField ($key, $value, $moreparam= '', $keysuffix= '', $keyprefix= '', $morecss= '', $objectid=0, $extrafieldsobjectkey= '', $mode=0) | |
| Return HTML string to put an input field into a page Code very similar with showInputField of common object. More... | |
| showOutputField ($key, $value, $moreparam= '', $extrafieldsobjectkey= '') | |
| Return HTML string to put an output field into a page. More... | |
| getAlignFlag ($key, $extrafieldsobjectkey= '') | |
| Return tag to describe alignement to use for this extrafield. More... | |
| showSeparator ($key, $object, $colspan=2) | |
| Return HTML string to print separator extrafield. More... | |
| setOptionalsFromPost ($extralabels, &$object, $onlykey= '') | |
| Fill array_options property of object by extrafields value (using for data sent by forms) More... | |
| getOptionalsFromPost ($extrafieldsobjectkey, $keyprefix= '', $keysuffix= '') | |
| return array_options array of data of extrafields value of object sent by a search form More... | |
Private Member Functions | |
| create ($attrname, $type= 'varchar', $length=255, $elementtype= 'member', $unique=0, $required=0, $default_value= '', $param= '', $perms= '', $list= '0', $computed= '', $help= '') | |
| Add a new optional attribute. More... | |
| create_label ($attrname, $label= '', $type= '', $pos=0, $size=0, $elementtype= 'member', $unique=0, $required=0, $param= '', $alwayseditable=0, $perms= '', $list= '-1', $help= '', $default= '', $computed= '', $entity= '', $langfile= '', $enabled= '1', $totalizable=0, $printable=0) | |
| Add description of a new optional attribute. More... | |
| delete_label ($attrname, $elementtype= 'member') | |
| Delete description of an optional attribute. More... | |
| update_label ($attrname, $label, $type, $size, $elementtype, $unique=0, $required=0, $pos=0, $param= '', $alwayseditable=0, $perms= '', $list= '0', $help= '', $default= '', $computed= '', $entity= '', $langfile= '', $enabled= '1', $totalizable=0, $printable=0) | |
| Modify description of personalized attribute. More... | |
Class to manage standard extra fields.
Definition at line 38 of file extrafields.class.php.
| ExtraFields::__construct | ( | $db | ) |
| ExtraFields::addExtraField | ( | $attrname, | |
| $label, | |||
| $type, | |||
| $pos, | |||
| $size, | |||
| $elementtype, | |||
$unique = 0, |
|||
$required = 0, |
|||
$default_value = '', |
|||
$param = '', |
|||
$alwayseditable = 0, |
|||
$perms = '', |
|||
$list = '-1', |
|||
$help = '', |
|||
$computed = '', |
|||
$entity = '', |
|||
$langfile = '', |
|||
$enabled = '1', |
|||
$totalizable = 0, |
|||
$printable = 0 |
|||
| ) |
Add a new extra field parameter.
| string | $attrname | Code of attribute |
| string | $label | label of attribute |
| string | $type | Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...) |
| int | $pos | Position of attribute |
| string | $size | Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. |
| string | $elementtype | Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) |
| int | $unique | Is field unique or not |
| int | $required | Is field required or not |
| string | $default_value | Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue') |
| array | string | $param | Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) |
| int | $alwayseditable | Is attribute always editable regardless of the document status |
| string | $perms | Permission to check |
| string | $list | Visibilty ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string') |
| string | $help | Text with help tooltip |
| string | $computed | Computed value |
| string | $entity | Entity of extrafields (for multicompany modules) |
| string | $langfile | Language file |
| string | $enabled | Condition to have the field enabled or not |
| int | $totalizable | Is a measure. Must show a total on lists |
| int | $printable | Is extrafield displayed on PDF |
Definition at line 244 of file extrafields.class.php.
References create(), and create_label().
|
private |
Add a new optional attribute.
This is a private method. For public method, use addExtraField.
| string | $attrname | code of attribute |
| int | $type | Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) |
| string | $length | Size/length of attribute ('5', '24,8', ...) |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', 'contact', ...) |
| int | $unique | Is field unique or not |
| int | $required | Is field required or not |
| string | $default_value | Default value for field (in database) |
| array | $param | Params for field (ex for select list : array('options'=>array('value'=>'label of option')) |
| string | $perms | Permission |
| string | $list | Into list view by default |
| string | $computed | Computed value |
| string | $help | Help on tooltip |
Definition at line 293 of file extrafields.class.php.
Referenced by addExtraField().
|
private |
Add description of a new optional attribute.
| string | $attrname | code of attribute |
| string | $label | label of attribute |
| int | $type | Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float') |
| int | $pos | Position of attribute |
| string | $size | Size/length of attribute ('5', '24,8', ...) |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', ...) |
| int | $unique | Is field unique or not |
| int | $required | Is field required or not |
| array | string | $param | Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) |
| int | $alwayseditable | Is attribute always editable regardless of the document status |
| string | $perms | Permission to check |
| string | $list | Visibily |
| string | $help | Help on tooltip |
| string | $default | Default value (in database. use the default_value feature for default value on screen). |
| string | $computed | Computed value |
| string | $entity | Entity of extrafields |
| string | $langfile | Language file |
| string | $enabled | Condition to have the field enabled or not |
| int | $totalizable | Is a measure. Must show a total on lists |
| int | $printable | Is extrafield displayed on PDF |
| Exception |
Definition at line 388 of file extrafields.class.php.
References db, dol_now(), and dol_syslog().
Referenced by addExtraField().
| ExtraFields::delete | ( | $attrname, | |
$elementtype = 'member' |
|||
| ) |
Delete an optional attribute.
| string | $attrname | Code of attribute to delete |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', 'contact', ...) |
Definition at line 486 of file extrafields.class.php.
References $resql, db, and delete_label().
|
private |
Delete description of an optional attribute.
| string | $attrname | Code of attribute to delete |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', ...) |
Definition at line 544 of file extrafields.class.php.
References $resql, db, dol_print_error(), and dol_syslog().
Referenced by delete().
| ExtraFields::fetch_name_optionals_label | ( | $elementtype, | |
$forceload = false |
|||
| ) |
Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
| string | $elementtype | Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). |
| boolean | $forceload | Force load of extra fields whatever is status of cache. |
Definition at line 827 of file extrafields.class.php.
References $resql, db, and dol_syslog().
| ExtraFields::getAlignFlag | ( | $key, | |
$extrafieldsobjectkey = '' |
|||
| ) |
Return tag to describe alignement to use for this extrafield.
| string | $key | Key of attribute |
| string | $extrafieldsobjectkey | If defined, use the new method to get extrafields data |
Definition at line 1867 of file extrafields.class.php.
| ExtraFields::getOptionalsFromPost | ( | $extrafieldsobjectkey, | |
$keyprefix = '', |
|||
$keysuffix = '' |
|||
| ) |
return array_options array of data of extrafields value of object sent by a search form
| array | string | $extrafieldsobjectkey | array of extrafields (old usage) or value of object->table_element (new usage) |
| string | $keyprefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keysuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
Definition at line 2072 of file extrafields.class.php.
References dol_mktime(), GETPOST(), GETPOSTISSET(), and price2num().
| ExtraFields::setOptionalsFromPost | ( | $extralabels, | |
| & | $object, | ||
$onlykey = '' |
|||
| ) |
Fill array_options property of object by extrafields value (using for data sent by forms)
| array | $extralabels | Deprecated (old $array of extrafields, now set this to null) |
| object | $object | Object |
| string | $onlykey | Only some keys are filled:$this 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset. '' => When we make update of extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. |
Definition at line 1975 of file extrafields.class.php.
References dol_eval(), dol_mktime(), GETPOST(), GETPOSTISSET(), price2num(), and setEventMessages().
| ExtraFields::showInputField | ( | $key, | |
| $value, | |||
$moreparam = '', |
|||
$keysuffix = '', |
|||
$keyprefix = '', |
|||
$morecss = '', |
|||
$objectid = 0, |
|||
$extrafieldsobjectkey = '', |
|||
$mode = 0 |
|||
| ) |
Return HTML string to put an input field into a page Code very similar with showInputField of common object.
| string | $key | Key of attribute |
| string | $value | Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) |
| string | $moreparam | To add more parametes on html input tag |
| string | $keysuffix | Prefix string to add after name and id of field (can be used to avoid duplicate names) |
| string | $keyprefix | Suffix string to add before name and id of field (can be used to avoid duplicate names) |
| string | $morecss | More css (to defined size of field. Old behaviour: may also be a numeric) |
| int | $objectid | Current object id |
| string | $extrafieldsobjectkey | If defined (for example $object->table_element), use the new method to get extrafields data |
| string | $mode | 1=Used for search filters |
Definition at line 938 of file extrafields.class.php.
References $resql, ajax_combobox(), db, dol_escape_htmltag(), dol_eval(), dol_syslog(), price(), and print.
| ExtraFields::showOutputField | ( | $key, | |
| $value, | |||
$moreparam = '', |
|||
$extrafieldsobjectkey = '' |
|||
| ) |
Return HTML string to put an output field into a page.
| string | $key | Key of attribute |
| string | $value | Value to show |
| string | $moreparam | To add more parameters on html input tag (only checkbox use html input for output rendering) |
| string | $extrafieldsobjectkey | If defined (for example $object->table_element), function uses the new method to get extrafields data |
Definition at line 1529 of file extrafields.class.php.
References $resql, db, dol_eval(), dol_print_date(), dol_print_email(), dol_print_phone(), dol_print_url(), dol_syslog(), dol_trunc(), and price().
| ExtraFields::showSeparator | ( | $key, | |
| $object, | |||
$colspan = 2 |
|||
| ) |
Return HTML string to print separator extrafield.
| string | $key | Key of attribute |
| string | $object | Object |
| int | $colspan | Value of colspan to use (it must includes the first column with title) |
Definition at line 1916 of file extrafields.class.php.
| ExtraFields::update | ( | $attrname, | |
| $label, | |||
| $type, | |||
| $length, | |||
| $elementtype, | |||
$unique = 0, |
|||
$required = 0, |
|||
$pos = 0, |
|||
$param = '', |
|||
$alwayseditable = 0, |
|||
$perms = '', |
|||
$list = '', |
|||
$help = '', |
|||
$default = '', |
|||
$computed = '', |
|||
$entity = '', |
|||
$langfile = '', |
|||
$enabled = '1', |
|||
$totalizable = 0, |
|||
$printable = 0 |
|||
| ) |
Modify type of a personalized attribute.
| string | $attrname | Name of attribute |
| string | $label | Label of attribute |
| string | $type | Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) |
| int | $length | Length of attribute |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', 'contact', ...) |
| int | $unique | Is field unique or not |
| int | $required | Is field required or not |
| int | $pos | Position of attribute |
| array | $param | Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) |
| int | $alwayseditable | Is attribute always editable regardless of the document status |
| string | $perms | Permission to check |
| string | $list | Visibility |
| string | $help | Help on tooltip |
| string | $default | Default value (in database. use the default_value feature for default value on screen). |
| string | $computed | Computed value |
| string | $entity | Entity of extrafields |
| string | $langfile | Language file |
| string | $enabled | Condition to have the field enabled or not |
| int | $totalizable | Is extrafield totalizable on list |
| int | $printable | Is extrafield displayed on PDF |
| Exception |
Definition at line 599 of file extrafields.class.php.
References $resql, db, dol_syslog(), and update_label().
|
private |
Modify description of personalized attribute.
| string | $attrname | Name of attribute |
| string | $label | Label of attribute |
| string | $type | Type of attribute |
| int | $size | Length of attribute |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', ...) |
| int | $unique | Is field unique or not |
| int | $required | Is field required or not |
| int | $pos | Position of attribute |
| array | $param | Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) |
| int | $alwayseditable | Is attribute always editable regardless of the document status |
| string | $perms | Permission to check |
| string | $list | Visiblity |
| string | $help | Help on tooltip. |
| string | $default | Default value (in database. use the default_value feature for default value on screen). |
| string | $computed | Computed value |
| string | $entity | Entity of extrafields |
| string | $langfile | Language file |
| string | $enabled | Condition to have the field enabled or not |
| int | $totalizable | Is extrafield totalizable on list |
| int | $printable | Is extrafield displayed on PDF |
| Exception |
Definition at line 703 of file extrafields.class.php.
References db, dol_now(), dol_print_error(), and dol_syslog().
Referenced by update().