|
dolibarr
x.y.z
|
Class to manage standard extra fields. More...

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, $moreparams=array()) | |
| 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, $moreparams=array()) | |
| Modify type of a personalized attribute. More... | |
| fetch_name_optionals_label ($elementtype, $forceload=false) | |
| Load array this->attributes. 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 the CSS to use for this extrafield into list. More... | |
| showSeparator ($key, $object, $colspan=2, $display_type='card', $mode='') | |
| Return HTML string to print separator extrafield. More... | |
| setOptionalsFromPost ($extralabels, &$object, $onlykey='', $todefaultifmissing=0) | |
| 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='', $moreparams=array()) | |
| 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, $moreparams=array()) | |
| 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, $moreparams=array()) | |
| Modify description of personalized attribute. More... | |
Class to manage standard extra fields.
Definition at line 39 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, |
|||
$moreparams = array() |
|||
| ) |
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', 'pricecy', '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 |
| array | $moreparams | More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...) |
Definition at line 139 of file extrafields.class.php.
|
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','pricecy','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 |
| array | $moreparams | More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) |
Definition at line 201 of file extrafields.class.php.
|
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 |
| array | $moreparams | More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) |
| Exception |
Definition at line 305 of file extrafields.class.php.
| 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 436 of file extrafields.class.php.
|
private |
Delete description of an optional attribute.
| string | $attrname | Code of attribute to delete |
| string | $elementtype | Element type ('member', 'product', 'thirdparty', ...) |
Definition at line 494 of file extrafields.class.php.
| ExtraFields::fetch_name_optionals_label | ( | $elementtype, | |
$forceload = false |
|||
| ) |
Load array this->attributes.
| 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 829 of file extrafields.class.php.
| ExtraFields::getAlignFlag | ( | $key, | |
$extrafieldsobjectkey = '' |
|||
| ) |
Return the CSS to use for this extrafield into list.
| string | $key | Key of attribute |
| string | $extrafieldsobjectkey | If defined, use the new method to get extrafields data |
Definition at line 1917 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 2185 of file extrafields.class.php.
| ExtraFields::setOptionalsFromPost | ( | $extralabels, | |
| & | $object, | ||
$onlykey = '', |
|||
$todefaultifmissing = 0 |
|||
| ) |
Fill array_options property of object by extrafields value (using for data sent by forms)
| array | null | $extralabels | Deprecated (old $array of extrafields, now set this to null) |
| object | $object | Object |
| string | $onlykey | Only some keys are filled: '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. '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset. |
| int | $todefaultifmissing | 1=Set value to the default value in database if value is mandatory and missing |
Definition at line 2048 of file extrafields.class.php.
| 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 | array | $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); for dates in filter mode, a range array('start'=><timestamp>, 'end'=><timestamp>) should be provided |
| string | $moreparam | To add more parameters 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 | The key to use to store retreived data (for example $object->table_element) |
| string | $mode | 1=Used for search filters |
Definition at line 933 of file extrafields.class.php.
| 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 | Required (for example $object->table_element). |
Definition at line 1577 of file extrafields.class.php.
| ExtraFields::showSeparator | ( | $key, | |
| $object, | |||
$colspan = 2, |
|||
$display_type = 'card', |
|||
$mode = '' |
|||
| ) |
Return HTML string to print separator extrafield.
| string | $key | Key of attribute |
| object | $object | Object |
| int | $colspan | Value of colspan to use (it must includes the first column with title) |
| string | $display_type | "card" for form display, "line" for document line display (extrafields on propal line, order line, etc...) |
| string | $mode | Show output ('view') or input ('create' or 'edit') for extrafield |
Definition at line 1957 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, |
|||
$moreparams = array() |
|||
| ) |
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 |
| array | $moreparams | More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) |
| Exception |
Definition at line 552 of file extrafields.class.php.
|
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 |
| array | $moreparams | More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) |
| Exception |
Definition at line 677 of file extrafields.class.php.