class FormOther (View source)

Class permettant la generation de composants html autre Only common components are here.

Properties

string $error

Methods

__construct(DoliDB $db)

Constructor

string
getHTMLScannerForm(string $jstoexecuteonadd = 'barcodescannerjs', string $mode = 'all', int $warehouseselect = 0)

Return the HTML code for scanner tool.

select_export_model($selected = '', string $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)

Return HTML select list of export models

select_import_model($selected = '', string $htmlname = 'importmodelid', $type = '', $useempty = 0, $fk_user = null)

Return list of export models

select_ecotaxes($selected = '', string $htmlname = 'ecotaxe_id')

Return list of ecotaxes with label

select_revenue_stamp($selected = '', string $htmlname = 'revenuestamp', $country_code = '')

Return list of revenue stamp for country

select_percent($selected = 0, string $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)

Return a HTML select list to select a percent

string
select_categories(string $type, int $selected = 0, string $htmlname = 'search_categ', int $nocateg = 0, int|string $showempty = 1, string $morecss = '')

Return select list for categories (to use in form search selectors)

select_salesrepresentatives($selected, string $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '', $norepresentative = 0)

Return select list for categories (to use in form search selectors)

selectProjectTasks(int $selectedtask = 0, $projectid = 0, $htmlname = 'task_parent', $modeproject = 0, $modetask = 0, $mode = 0, $useempty = 0, $disablechildoftaskid = 0, $filteronprojstatus = '', $morecss = '')

Return list of project and tasks

static 
showColor($color, string $textifnotdefined = '')

Output a HTML thumb of color or a text if not defined.

select_color($set_color = '', string $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = [])

Output a HTML code to select a color

static 
selectColor($set_color = '', string $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = [], $morecss = '', $setpropertyonselect = '', $default = '')

Output a HTML code to select a color. Field will return an hexa color like '334455'.

void
CreateColorIcon(string $color, string $module, string $name, int $x = 12, int $y = 12)

Create an image for color

select_dayofweek($selected = '', string $htmlname = 'weekid', $useempty = 0)

Return HTML combo list of week

select_month($selected = '', string $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'minwidth50 maxwidth75imp valignmiddle', $addjscombo = false)

Return HTML combo list of month

select_year($selected = '', string $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp', $addjscombo = false)

Return HTML combo list of years

selectyear($selected = '', string $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle width75', $addjscombo = false)

Return HTML combo list of years

static ModeleBoxes[], boxlista: string, boxlistb: string}
getBoxesArea(User $user, $areacode)

Get array with HTML tabs with widgets/boxes of a particular area including personalized choices of user.

select_dictionary($htmlname, string $dictionarytable, $keyfield = 'code', $labelfield = 'label', $selected = '', $useempty = 0, $moreattrib = '')

Return a HTML select list of a dictionary

string
selectAutoManual(string $htmlname, string $value = '', int $option = 0, bool $disabled = false, $useempty = 0)

Return an html string with a select combo box to choose yes or no

string
selectGroupByField(mixed $object, string[] $search_groupby, array<string, array{label: string}> $arrayofgroupby, string $morecss = 'minwidth200 maxwidth250', string $showempty = '1')

Return HTML select list to select a group by field

string
selectXAxisField(mixed $object, string[] $search_xaxis, array<string, array{label: string}> $arrayofxaxis, string $showempty = '1', string $morecss = 'minwidth250 maxwidth500')

Return HTML select list to select a group by field

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

string getHTMLScannerForm(string $jstoexecuteonadd = 'barcodescannerjs', string $mode = 'all', int $warehouseselect = 0)

Return the HTML code for scanner tool.

This must be called into an existing

Parameters

string $jstoexecuteonadd

Name of javascript function to call once the barcode scanning session is complete and user has click on "Add".

string $mode

'all' (both product and lot barcode) or 'product' (product barcode only) or 'lot' (lot number only)

int $warehouseselect

0 (disable warehouse select) or 1 (enable warehouse select)

Return Value

string

HTML component

select_export_model($selected = '', string $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)

Return HTML select list of export models

@param string $selected Id modele pre-selectionne

Parameters

$selected
string $htmlname

Nom de la zone select @param string $type Type des modeles recherches @param int $useempty Show an empty value in list @param int $fk_user User we want templates @return void

$type
$useempty
$fk_user

select_import_model($selected = '', string $htmlname = 'importmodelid', $type = '', $useempty = 0, $fk_user = null)

Return list of export models

@param string $selected Id modele pre-selectionne

Parameters

$selected
string $htmlname

Nom de la zone select @param string $type Type des modeles recherches @param int $useempty Affiche valeur vide dans liste @param int $fk_user User that has created the template @return void

$type
$useempty
$fk_user

select_ecotaxes($selected = '', string $htmlname = 'ecotaxe_id')

Return list of ecotaxes with label

@param string $selected Preselected ecotaxes

Parameters

$selected
string $htmlname

Name of combo list @return integer

select_revenue_stamp($selected = '', string $htmlname = 'revenuestamp', $country_code = '')

Return list of revenue stamp for country

@param string $selected Value of preselected revenue stamp

Parameters

$selected
string $htmlname

Name of combo list @param string $country_code Country Code @return string HTML select list

$country_code

select_percent($selected = 0, string $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)

Return a HTML select list to select a percent

@param integer $selected pourcentage pre-selectionne

Parameters

$selected
string $htmlname

nom de la liste deroulante @param int $disabled Disabled or not @param int $increment increment value @param int $start start value @param int $end end value @param int $showempty Add also an empty line @return string HTML select string

$disabled
$increment
$start
$end
$showempty

string select_categories(string $type, int $selected = 0, string $htmlname = 'search_categ', int $nocateg = 0, int|string $showempty = 1, string $morecss = '')

Return select list for categories (to use in form search selectors)

Parameters

string $type

Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.

int $selected

Preselected value

string $htmlname

Name of combo list

int $nocateg

Show also an entry "Not categorized"

int|string $showempty

Add also an empty line

string $morecss

More CSS

Return Value

string

Html combo list code

See also

select_all_categories()

select_salesrepresentatives($selected, string $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '', $norepresentative = 0)

Return select list for categories (to use in form search selectors)

@param int|string $selected Preselected value

Parameters

$selected
string $htmlname

Name of combo list (example: 'search_sale') @param User $user Object user @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status @param int|string $showempty 1=show also an empty value or text to show for empty @param string $morecss More CSS @param int $norepresentative Show also an entry "Not categorized" @return string Html combo list code

$user
$showstatus
$showempty
$morecss
$norepresentative

selectProjectTasks(int $selectedtask = 0, $projectid = 0, $htmlname = 'task_parent', $modeproject = 0, $modetask = 0, $mode = 0, $useempty = 0, $disablechildoftaskid = 0, $filteronprojstatus = '', $morecss = '')

Return list of project and tasks

Parameters

int $selectedtask

Pre-selected task @param int $projectid Project id @param string $htmlname Name of html select @param int $modeproject 1 to restrict on projects owned by user @param int $modetask 1 to restrict on tasks associated to user @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists @param int $useempty 0=Allow empty values @param int $disablechildoftaskid 1=Disable task that are child of the provided task id @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated status) @param string $morecss More css @return void

$projectid
$htmlname
$modeproject
$modetask
$mode
$useempty
$disablechildoftaskid
$filteronprojstatus
$morecss

static showColor($color, string $textifnotdefined = '')

Output a HTML thumb of color or a text if not defined.

@param string $color String with hex (FFFFFF) or comma RGB ('255,255,255')

Parameters

$color
string $textifnotdefined

Text to show if color not defined @return string Show color string selectColor()

select_color($set_color = '', string $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = [])

Output a HTML code to select a color

@param string $set_color Pre-selected color

Parameters

$set_color
string $prefix

Name of HTML field @param string $form_name Deprecated. Not used. @param int $showcolorbox 1=Show color code and color box, 0=Show only color code @param string[] $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') @return void @deprecated Use selectColor() selectColor()

$form_name
$showcolorbox
$arrayofcolors

static selectColor($set_color = '', string $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = [], $morecss = '', $setpropertyonselect = '', $default = '')

Output a HTML code to select a color. Field will return an hexa color like '334455'.

@param string $set_color Pre-selected color with format '#......'

Parameters

$set_color
string $prefix

Name of HTML field @param null|'' $form_name Deprecated. Not used. @param int $showcolorbox 1=Show color code and color box, 0=Show only color code @param string[] $arrayofcolors Array of possible colors to choose in the selector. All colors are possible if empty. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') @param string $morecss Add css style into input field @param string $setpropertyonselect Set this CSS property after selecting a color @param string $default Default color @return string showColor()

$form_name
$showcolorbox
$arrayofcolors
$morecss
$setpropertyonselect
$default

void CreateColorIcon(string $color, string $module, string $name, int $x = 12, int $y = 12)

Create an image for color

Parameters

string $color

Color of image

string $module

Name of module

string $name

Name of image

int $x

Largeur de l'image en pixels

int $y

Hauteur de l'image en pixels

Return Value

void

select_dayofweek($selected = '', string $htmlname = 'weekid', $useempty = 0)

Return HTML combo list of week

@param  string      $selected          Preselected value

Parameters

$selected
string $htmlname

Nom de la zone select @param int $useempty Affiche valeur vide dans liste @return string

$useempty

select_month($selected = '', string $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'minwidth50 maxwidth75imp valignmiddle', $addjscombo = false)

Return HTML combo list of month

@param int|string $selected Preselected value

Parameters

$selected
string $htmlname

Name of HTML select object @param int|string $useempty Show empty in list @param int $longlabel Show long label (1) or short label (0) @param string $morecss More Css @param bool $addjscombo Add js combo @return string

$useempty
$longlabel
$morecss
$addjscombo

select_year($selected = '', string $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp', $addjscombo = false)

Return HTML combo list of years

@param string $selected Preselected value (''=current year, -1=none, year otherwise)

Parameters

$selected
string $htmlname

Name of HTML select object @param int $useempty Affiche valeur vide dans liste @param int $min_year Offset of minimum year into list (by default current year -10) @param int $max_year Offset of maximum year into list (by default current year + 5) @param int $offset Offset @param int $invert Invert @param string $option Option @param string $morecss More CSS @param bool $addjscombo Add js combo @return void @deprecated

$useempty
$min_year
$max_year
$offset
$invert
$option
$morecss
$addjscombo

selectyear($selected = '', string $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle width75', $addjscombo = false)

Return HTML combo list of years

@param int|string $selected Preselected value (''=current year, -1=none, year otherwise)

Parameters

$selected
string $htmlname

Name of HTML select object @param int $useempty Affiche valeur vide dans liste @param int $min_year Offset of minimum year into list (by default current year -10) @param int $max_year Offset of maximum year into list (by default current year + 5) @param int $offset Offset @param int $invert Invert @param string $option Option @param string $morecss More css @param bool $addjscombo Add js combo @return string

$useempty
$min_year
$max_year
$offset
$invert
$option
$morecss
$addjscombo

static ModeleBoxes[], boxlista: string, boxlistb: string} getBoxesArea(User $user, $areacode)

Get array with HTML tabs with widgets/boxes of a particular area including personalized choices of user.

Class 'Form' must be known.

Parameters

User $user

Object User @param string $areacode Code of area for pages - 0 = Home page ... See getListOfPagesForBoxes()

$areacode

Return Value

ModeleBoxes[], boxlista: string, boxlistb: string}

select_dictionary($htmlname, string $dictionarytable, $keyfield = 'code', $labelfield = 'label', $selected = '', $useempty = 0, $moreattrib = '')

Return a HTML select list of a dictionary

@param string $htmlname Name of select zone

Parameters

$htmlname
string $dictionarytable

Dictionary table @param string $keyfield Field for key @param string $labelfield Label field @param string $selected Selected value @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. @param string $moreattrib More attributes on HTML select tag @return void

$keyfield
$labelfield
$selected
$useempty
$moreattrib

string selectAutoManual(string $htmlname, string $value = '', int $option = 0, bool $disabled = false, $useempty = 0)

Return an html string with a select combo box to choose yes or no

Parameters

string $htmlname

Name of html select field

string $value

Pre-selected value

int $option

0 return automatic/manual, 1 return 1/0

bool $disabled

true or false @param int $useempty 1=Add empty line

$useempty

Return Value

string

See option

string selectGroupByField(mixed $object, string[] $search_groupby, array<string, array{label: string}> $arrayofgroupby, string $morecss = 'minwidth200 maxwidth250', string $showempty = '1')

Return HTML select list to select a group by field

Parameters

mixed $object

Object analyzed

string[] $search_groupby

Array of preselected fields

array<string, array{label: string}> $arrayofgroupby

Array of groupby to fill

string $morecss

More CSS

string $showempty

'1' or 'text'

Return Value

string

HTML string component

string selectXAxisField(mixed $object, string[] $search_xaxis, array<string, array{label: string}> $arrayofxaxis, string $showempty = '1', string $morecss = 'minwidth250 maxwidth500')

Return HTML select list to select a group by field

Parameters

mixed $object

Object analyzed

string[] $search_xaxis

Array of preselected fields

array<string, array{label: string}> $arrayofxaxis

Array of groupby to fill

string $showempty

'1' or 'text'

string $morecss

More css

Return Value

string

HTML string component