class FormFiscalYear extends Form (View source)

Class to manage generation of HTML components for accounting management

Properties

DoliDB $db
string $error
string[] $errors from  Form
array<string, int> $result from  Form
int $num from  Form
array<string, array{id: int, code: string, label: string, type: int, entity: int, active: int}> $cache_types_paiements from  Form
array<string, array{code: string, label: string, deposit_percent: string, entity: int}> $cache_conditions_paiements from  Form
array<int, array{rowid: int, code: string, label: string, active: int}> $cache_transport_mode from  Form
array<int, array{code: string, label: string, position: int}> $cache_availability from  Form
array<int, array{id: int, code: string, label: string}> $cache_demand_reason from  Form
array<string, string> $cache_types_fees from  Form
array<int, array{rowid: int, type_vat: int, code: string, txtva: string, nprtva: int, localtax1: string|float|null, localtax1_type: string, localtax2: string|float|null, localtax2_type: string, label: string, labelallrates: string, labelpositiverates: string}> $cache_vatrates from  Form
array<int, array{rowid: int, code: string, label: string}> $cache_invoice_subtype from  Form
array<string, string> $cache_rule_for_lines_dates from  Form

Methods

__construct(DoliDB $db)

Constructor

array{y: string, m: string, w: string, d: string, h: string, i: string, s: string}
getDurationTypes(Translate $langs, bool $plurial = true, bool $reverse = false)

Return an array of Duration Types

from  Form
string
editfieldkey(string $text, string $htmlname, string $preselected, ?object $object, int<0, 1>|bool $perm, string $typeofdata = 'string', string $moreparam = '', int<0, 1> $fieldrequired = 0, int<0, 3> $notabletag = 0, "id"|"socid"|"projectid" $paramid = 'id', string $help = '')

Output key field for an editable field

from  Form
string
editfieldval(string $text, string $htmlname, string|int $value, CommonObject|ActionsCardProduct|ActionsCardService $object, bool|int<0, 1> $perm, string $typeofdata = 'string', ?string $editvalue = '', CommonObject $extObject = null, string|array<string, string>|null $custommsg = null, string $moreparam = '', int<0, 1> $notabletag = 1, string $formatfunc = '', string $paramid = 'id', string $gm = 'auto', array<string, int> $moreoptions = array(), string $editaction = '')

Output value of a field for an editable field

from  Form
string
widgetForTranslation(string $fieldname, CommonObject $object, bool|int<0, 1> $perm, string $typeofdata = 'string', string $check = '', string $morecss = '')

Output edit in place form

from  Form
string
editInPlace(CommonObject $object, string $value, string $htmlname, int $condition, string $inputType = 'textarea', ?string $editvalue = null, CommonObject $extObject = null, string|array<string, string>|null $custommsg = null)

Output edit in place form

from  Form
textwithtooltip(string $text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)

Show a text and picto with tooltip on text or picto.

from  Form
string
textwithpicto(string $text, string $htmltooltip, int<-1, 1> $direction = 1, string $type = 'help', string $extracss = 'valignmiddle', int<0, 1> $noencodehtmltext = 0, int<0, 3> $notabs = 3, string $tooltiptrigger = '', int<0, 1> $forcenowrap = 0)

Show a text with a picto and a tooltip on picto

from  Form
string|void
selectMassAction(string $selected, array<string, string> $arrayofaction, int $alwaysvisible = 0, string $name = 'massaction', string $cssclass = 'checkforselect')

Generate select HTML to choose massaction

from  Form
string
select_country(int|string $selected = '', string $htmlname = 'country_id', string $htmloption = '', int $maxlength = 0, string $morecss = 'minwidth300', string $usecodeaskey = '', int<0, 1>|string $showempty = 1, int<0, 1> $disablefavorites = 0, int<0, 1> $addspecialentries = 0, string[] $exclude_country_code = array(), int<0, 1> $hideflags = 0, int<0, 1> $forcecombo = 0)

Return combo list of activated countries, into language of user

from  Form
string
select_incoterms(string $selected = '', string $location_incoterms = '', string $page = '', string $htmlname = 'incoterm_id', string $htmloption = '', int<0, 1> $forcecombo = 1, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), int<0, 1> $disableautocomplete = 0)

Return select list of incoterms

from  Form
void
select_type_of_lines(string $selected = '', string $htmlname = 'type', int<0, 1>|string $showempty = 0, int $hidetext = 0, int $forceall = 0, string $morecss = "", int $useajaxcombo = 1)

Return list of types of lines (product or service) Example: 0=product, 1=service, 9=other (for external module)

from  Form
int
load_cache_types_fees()

Load into cache cache_types_fees, array of types of fees

from  Form
void
select_type_fees(string $selected = '', string $htmlname = 'type', int $showempty = 0)

Return list of types of notes

from  Form
string
select_company(int|string $selected = '', string $htmlname = 'socid', string $filter = '', string|int<1, 1> $showempty = '', int<0, 1> $showtype = 0, int<0, 1> $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), int $limit = 0, string $morecss = 'minwidth100', string $moreparam = '', string $selected_input_value = '', int<0, 3> $hidelabel = 1, array<string, string|string[]> $ajaxoptions = array(), bool $multiple = false, string[] $excludeids = array(), int<0, 1> $showcode = 0)

Output html form to select a third party This call select_thirdparty_list() or ajax depending on setup. This component is not able to support multiple select.

from  Form
int|string
select_contact(int $socid, int|string $selected = '', string $htmlname = 'contactid', int<0, 3>|string $showempty = 0, string $exclude = '', string $limitto = '', int<0, 1> $showfunction = 0, string $morecss = '', bool $nokeyifsocid = true, int $showsoc = 0, int<0, 1> $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), string $moreparam = '', string $htmlid = '', string $selected_input_value = '', string $filter = '')

Output html form to select a contact This call select_contacts() or ajax depending on setup. This component is not able to support multiple select.

from  Form
array<int, array{key: int, value: string, label: string, labelhtml: string}>|string
select_thirdparty_list(string $selected = '', string $htmlname = 'socid', string $filter = '', string|int<0, 1> $showempty = '', int<0, 1> $showtype = 0, int $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), string $filterkey = '', int<0, 1> $outputmode = 0, int $limit = 0, string $morecss = 'minwidth100', string $moreparam = '', bool $multiple = false, string[] $excludeids = array(), int<0, 1> $showcode = 0)

Output html form to select a third party.

from  Form
int|string|array<int, array{key: int, value: string, label: string, labelhtml: string}>
selectcontacts(int $socid, string[]|int|string $selected = array(), string $htmlname = 'contactid', int<0, 3>|string $showempty = 0, string $exclude = '', string $limitto = '', int<0, 1> $showfunction = 0, string $morecss = '', int $options_only = 0, int<0, 1> $showsoc = 0, int $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), string $moreparam = '', string $htmlid = '', bool $multiple = false, int $disableifempty = 0, string $filter = '')

Return HTML code of the SELECT of list of all contacts (for a third party or all).

from  Form
int
select_remises(string $selected, string $htmlname, string $filter, int $socid, int $maxvalue = 0)

Return HTML combo list of absolute discounts

from  Form
void
select_users(string $selected = '', string $htmlname = 'userid', int<0, 1> $show_empty = 0, int[] $exclude = null, int<0, 1> $disabled = 0, int[]|""|"hierarchy"|"hierarchyme" $include = '', int[]|int $enableonly = array(), string $force_entity = '0') deprecated

Return the HTML select list of users

from  Form
string|array<int, string|array{id: int, label: string, labelhtml: string, color: string, picto: string}>
select_dolusers(string|int|User $selected = '', string $htmlname = 'userid', int<0, 1>|string $show_empty = 0, int[]|null $exclude = null, int $disabled = 0, int[]|""|"hierarchy"|"hierarchyme" $include = '', int[]|"" $enableonly = '', string $force_entity = '', int $maxlength = 0, int<-1, 1> $showstatus = 0, string $morefilter = '', int<0, 3> $showalso = 0, string $enableonlytext = '', string $morecss = '', int<0, 1> $notdisabled = 0, int<0, 2> $outputmode = 0, bool $multiple = false, int<0, 1> $forcecombo = 0)

Return select list of users

from  Form
string
select_dolusers_forevent(string $action = '', string $htmlname = 'userid', int<0, 1> $show_empty = 0, int[] $exclude = null, int<0, 1> $disabled = 0, int[]|""|"hierarchy"|"hierarchyme" $include = array(), int[]|int $enableonly = array(), string $force_entity = '0', int $maxlength = 0, int<0, 1> $showstatus = 0, string $morefilter = '', int $showproperties = 0, int[] $listofuserid = array(), int[] $listofcontactid = array(), int[] $listofotherid = array(), int $canremoveowner = 1)

Return select list of users. Selected users are stored into session.

from  Form
string
select_dolresources_forevent(string $action = '', string $htmlname = 'userid', int<0, 1> $show_empty = 0, int[] $exclude = null, int<0, 1> $disabled = 0, int[]|string $include = array(), int[] $enableonly = array(), string $force_entity = '0', int $maxlength = 0, int<-1, 1> $showstatus = 0, string $morefilter = '', int<0, 1> $showproperties = 0, array<int, array{transparency: bool|int<0, 1>}> $listofresourceid = array())

Return select list of resources. Selected resources are stored into session.

from  Form
select_produits(int $selected = 0, $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1, $warehouseId = 0)

Return list of products.

from  Form
void|string
select_bom(string $selected = '', string $htmlname = 'bom_id', int $limit = 0, int $status = 1, int $type = 0, string|int<0, 1> $showempty = '1', string $morecss = '', string $nooutput = '', int $forcecombo = 0, string[] $TProducts = [])

Return list of BOM for customer in Ajax if Ajax activated or go to select_produits_list

from  Form
string|array<array{key: string, value: string, label: string, label2: string, desc: string, type: string, price_ht: string, price_ttc: string, price_ht_locale: string, price_ttc_locale: string, pricebasetype: string, tva_tx: string, default_vat_code: string, qty: string, discount: string, duration_value: string, duration_unit: string, pbq: string, labeltrans: string, desctrans: string, ref_customer: string}>
select_produits_list(int $selected = 0, string $htmlname = 'productid', string $filtertype = '', int $limit = 20, int $price_level = 0, string $filterkey = '', int<-1, 1> $status = 1, int $finished = 2, int $outputmode = 0, int $socid = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = 'maxwidth500', int<0, 1> $hidepriceinlabel = 0, ""|"warehouseopen"|"warehouseclosed"|"warehouseinternal" $warehouseStatus = '', int<-1, 1> $status_purchase = -1, int $warehouseId = 0)

Return list of products for a customer.

from  Form
void
constructProductListOption(stdClass $objp, string $opt, array{key?: string, value?: string, label?: string, label2?: string, desc?: string, type?: string, price_ht?: string, price_ttc?: string, price_ht_locale?: string, price_ttc_locale?: string, pricebasetype?: string, tva_tx?: string, default_vat_code?: string, qty?: string, discount?: string, duration_value?: string, duration_unit?: string, pbq?: string, labeltrans?: string, desctrans?: string, ref_customer?: string} $optJson, int $price_level, int $selected, int<0, 1> $hidepriceinlabel = 0, string $filterkey = '', int<0, 1> $novirtualstock = 0)

Function to forge the string with OPTIONs of SELECT.

from  Form
string|void
select_produits_fournisseurs(int $socid, string|int $selected = '', string $htmlname = 'productid', string $filtertype = '', string $filtre = '', array<string, string|string[]> $ajaxoptions = array(), int<0, 1> $hidelabel = 0, int<0, 1> $alsoproductwithnosupplierprice = 0, string $morecss = '', string $placeholder = '', int $nooutput = 0)

Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)

from  Form
array<array<string, mixed>>|string
select_produits_fournisseurs_list(int $socid, string $selected = '', string $htmlname = 'productid', ""|int<0, 1> $filtertype = '', string $filtre = '', string $filterkey = '', int $statut = -1, int $outputmode = 0, int $limit = 100, int $alsoproductwithnosupplierprice = 0, string $morecss = '', int $showstockinlist = 0, string $placeholder = '')

Return list of suppliers products

from  Form
string
select_product_fourn_price(int $productid, string $htmlname = 'productfournpriceid', int $selected_supplier = 0)

Return list of suppliers prices for a product

from  Form
int
load_cache_conditions_paiements()

Load into cache list of payment terms

from  Form
int<-1, 1>
load_cache_rule_for_lines_dates()

Loads into a cache property the list of possible rules for line dates

from  Form
int
load_cache_availability()

Load int a cache property the list of possible delivery delays.

from  Form
void
selectAvailabilityDelay(""|int $selected = '', string $htmlname = 'availid', string|int<0, 1> $filtertype = '', int<0, 1> $addempty = 0, string $morecss = '')

Return the list of type of delay available.

from  Form
int
loadCacheInputReason()

Load into cache cache_demand_reason, array of input reasons

from  Form
void
selectInputReason(string $selected = '', string $htmlname = 'demandreasonid', string $exclude = '', int $addempty = 0, string $morecss = '', int $notooltip = 0)

Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) List found into table c_input_reason loaded by loadCacheInputReason

from  Form
int
load_cache_types_paiements()

Charge dans cache la liste des types de paiements possibles

from  Form
void|string
select_conditions_paiements(int $selected = 0, string $htmlname = 'condid', int $filtertype = -1, int $addempty = 0, int $noinfoadmin = 0, string $morecss = '', float $deposit_percent = -1, int $noprint = 0) deprecated

print list of payment modes.

from  Form
string
getSelectConditionsPaiements(int $selected = 0, string $htmlname = 'condid', int $filtertype = -1, int $addempty = 0, int $noinfoadmin = 0, string $morecss = '', float $deposit_percent = -1)

Return list of payment modes.

from  Form
string
getSelectRuleForLinesDates(string $selected = '', string $htmlname = 'rule_for_lines_dates', int $addempty = 0)

Returns select with rule for lines dates

from  Form
string|void
select_types_paiements(string $selected = '', string $htmlname = 'paiementtype', string $filtertype = '', int $format = 0, int $empty = 1, int $noadmininfo = 0, int $maxlength = 0, int $active = 1, string $morecss = '', int<0, 1> $nooutput = 0)

Return list of payment methods Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.

from  Form
string
selectPriceBaseType(string $selected = '', string $htmlname = 'price_base_type', int $addjscombo = 0)

Selection HT or TTC

from  Form
int
load_cache_transport_mode()

Load in cache list of transport mode

from  Form
void
selectTransportMode(string $selected = '', string $htmlname = 'transportmode', int $format = 0, int $empty = 1, int $noadmininfo = 0, int $maxlength = 0, int $active = 1, string $morecss = '')

Return list of transport mode for intracomm report

from  Form
void
selectShippingMethod(string $selected = '', string $htmlname = 'shipping_method_id', string $filtre = '', int $useempty = 0, string $moreattrib = '', int $noinfoadmin = 0, string $morecss = '')

Return a HTML select list of shipping mode

from  Form
void
formSelectShippingMethod(string $page, string $selected = '', string $htmlname = 'shipping_method_id', int $addempty = 0)

Display form to select shipping mode

from  Form
string
selectSituationInvoices(string $selected = '', int $socid = 0)

Creates HTML last in cycle situation invoices selector

from  Form
string
selectUnits(int|"" $selected = '', string $htmlname = 'units', int<0, 1> $showempty = 0, string $unit_type = '')

Creates HTML units selector (code => label)

from  Form
int|string
select_comptes(int|"" $selected = '', string $htmlname = 'accountid', int<0, 2> $status = 0, string $filtre = '', int<0, 2>|string $useempty = 0, string $moreattrib = '', int<0, 1> $showcurrency = 0, string $morecss = '', int<0, 1> $nooutput = 0, int<0, 1> $addentrynone = 0)

Return a HTML select list of bank accounts

from  Form
int|string
selectRib(int|"" $selected = '', string $htmlname = 'ribcompanyid', string $filtre = '', int|string $useempty = 0, string $moreattrib = '', int $showibanbic = 0, string $morecss = '', int<0, 1> $nooutput = 0)

Return a HTML select list of bank accounts customer

from  Form
int
selectEstablishments(string $selected = '', string $htmlname = 'entity', int $status = 0, string $filtre = '', int $useempty = 0, string $moreattrib = '')

Return a HTML select list of establishment

from  Form
void
formSelectAccount(string $page, string $selected = '', string $htmlname = 'fk_account', int<0, 2> $addempty = 0)

Display form to select bank account

from  Form
void
formRib(string $page, string $selected = '', string $htmlname = 'ribcompanyid', string $filtre = '', int $addempty = 0, int $showibanbic = 0)

Display form to select bank customer account

from  Form
string
selectCategories(string $categtype, string $htmlname, CommonObject $object = null)

Return HTML component to select a category

from  Form
string|array<int, string>|array<int, array{id: int, fulllabel: string, data-html?: string, color: string, picto: string}>|array<int, array{rowid: int, id: int, fk_parent: int, label: string, description: string, color: string, position: string, visible: int, ref_ext: string, picto: string, fullpath: string, fulllabel: string, data-html?: string}>
select_all_categories(string|int $type, int|"auto"|"" $selected = '', string $htmlname = "parent", int $maxlength = 64, int|string|int[] $fromid = 0, int<0, 3> $outputmode = 0, int<0, 1> $include = 0, string $morecss = '', int<0, 2> $useempty = 1)

Return list of categories having chosen type

from  Form
void
form_confirm(string $page, string $title, string $question, string $action, array<array{name?: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>}>|string|null $formquestion = array(), string $selectedchoice = "", int<0, 2>|string $useajax = 0, int $height = 170, int $width = 500) deprecated

Show a confirmation HTML form or AJAX popup

from  Form
string
formconfirm(string $page, string $title, string $question, string $action, null|string|array<array{name?: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}>|array{text: string, 0?: array{name: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}, 1?: array{name: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}} $formquestion = '', int<0, 1>|""|"no"|"yes"|"1"|"0" $selectedchoice = '', int<0, 2>|string $useajax = 0, int|string $height = 0, int $width = 500, int $disableformtag = 0, string $labelbuttonyes = 'Yes', string $labelbuttonno = 'No')

Show a confirmation HTML form or AJAX popup.

from  Form
string
form_project(string $page, int $socid, int|string|Project $selected = '', string $htmlname = 'projectid', int<0, 2> $discard_closed = 0, int $maxlength = 20, int $forcefocus = 0, int<0, 1> $nooutput = 0, string $textifnoproject = '', string $morecss = '')

Show a form to select a project

from  Form
string
form_conditions_reglement(string $page, string $selected = '', string $htmlname = 'cond_reglement_id', int<0, 1> $addempty = 0, ""|"direct-debit"|"bank-transfer" $type = '', int $filtertype = -1, float $deposit_percent = -1, int<0, 1> $nooutput = 0)

Show a form to select payment conditions

from  Form
string
form_rule_for_lines_dates(string $page, string $selected = '', string $htmlname = 'rule_for_lines_dates', int $addempty = 0, int $nooutput = 0)

Form select for rule for lines dates

from  Form
void
form_availability(string $page, string $selected = '', string $htmlname = 'availability', int<0, 1> $addempty = 0)

Show a form to select a delivery delay

from  Form
void
formInputReason(string $page, string $selected = '', string $htmlname = 'demandreason', int $addempty = 0, string $morecss = '')

Output HTML form to select list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) List found into table c_input_reason loaded by loadCacheInputReason

from  Form
string
form_date(string $page, int|"" $selected, string $htmlname, int $displayhour = 0, int $displaymin = 0, int<0, 1> $nooutput = 0, string $type = '')

Show a form + html select a date

from  Form
void
form_users(string $page, string $selected = '', string $htmlname = 'userid', int[] $exclude = array(), int[] $include = array())

Show a select form to choose a user

from  Form
string
form_modes_reglement(string $page, string $selected = '', string $htmlname = 'mode_reglement_id', string $filtertype = '', int<-1, 1> $active = 1, int<0, 1> $addempty = 0, string $type = '', int<0, 1> $nooutput = 0)

Show form with payment mode

from  Form
void
formSelectTransportMode(string $page, int|"" $selected = '', string $htmlname = 'transport_mode_id', int<-1, 1> $active = 1, int<0, 1> $addempty = 0)

Show form with transport mode

from  Form
void
form_multicurrency_code(string $page, string $selected = '', string $htmlname = 'multicurrency_code')

Show form with multicurrency code

from  Form
void
form_multicurrency_rate(string $page, float $rate = 0.0, string $htmlname = 'multicurrency_tx', string $currency = '')

Show form with multicurrency rate

from  Form
void
form_remise_dispo(string $page, int $selected, string $htmlname, int $socid, float $amount, string $filter = '', int $maxvalue = 0, string $more = '', int $hidelist = 0, int $discount_type = 0)

Show a select box with available absolute discounts

from  Form
void
form_contacts(string $page, Societe $societe, string $selected = '', string $htmlname = 'contactid')

Show forms to select a contact

from  Form
string
form_thirdparty(string $page, string $selected = '', string $htmlname = 'socid', string $filter = '', string|int<0, 1> $showempty = 0, int<0, 1> $showtype = 0, int<0, 1> $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), int<0, 1> $nooutput = 0, int[] $excludeids = array(), string $textifnothirdparty = '')

Output html select to select thirdparty

from  Form
void
select_currency(string $selected = '', string $htmlname = 'currency_id') deprecated

Retourne la liste des devises, dans la langue de l'utilisateur

from  Form
string
selectCurrency(string $selected = '', string $htmlname = 'currency_id', int $mode = 0, string $useempty = '')

Retourne la liste des devises, dans la langue de l'utilisateur

from  Form
string
selectMultiCurrency(string $selected = '', string $htmlname = 'multicurrency_code', int $useempty = 0, string $filter = '', bool $excludeConfCurrency = false, string $morecss = 'maxwidth200 widthcentpercentminusx')

Return array of currencies in user language

from  Form
int
load_cache_vatrates($country_code)

Load into the cache ->cache_vatrates, all the vat rates of a country

from  Form
load_tva(string $htmlname = 'tauxtva', $selectedrate = '', $societe_vendeuse = null, $societe_acheteuse = null, $idprod = 0, $info_bits = 0, $type = '', $options_only = false, $mode = 0, $type_vat = 0)

Output an HTML select vat rate.

from  Form
select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = 0, $addplusone = '', $adddateof = '')

Show a HTML widget to input a date or combo list for day, month, years and optionally hours and minutes.

from  Form
selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0, $forcenewline = 0)

Show 2 HTML widget to input a date or combo list for day, month, years and optionally hours and minutes.

from  Form
selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto', $calendarpicto = '')

Show a HTML widget to input a date or combo list for day, month, years and optionally hours and minutes.

from  Form
string
selectTypeDuration(string $prefix, string $selected = 'i', string[] $excludetypes = array(), string $morecss = 'minwidth75 maxwidth100')

selectTypeDuration

from  Form
string
select_duration(string $prefix, int|string $iSecond = '', int $disabled = 0, string $typehour = 'select', int $minunderhours = 0, int<0, 1> $nooutput = 0)

Function to show a form to select a duration on a page

from  Form
string
selectTickets(string $selected = '', string $htmlname = 'ticketid', string $filtertype = '', int $limit = 0, int $status = 1, string $selected_input_value = '', int<0, 3> $hidelabel = 0, array<string, string|string[]> $ajaxoptions = array(), int $socid = 0, string|int<0, 1> $showempty = '1', int<0, 1> $forcecombo = 0, string $morecss = '', array<string, string> $selected_combinations = null, int<0, 1> $nooutput = 0)

Return list of tickets in Ajax if Ajax activated or go to selectTicketsList

from  Form
array<array{key: string, value: mixed, type: int}>|string
selectTicketsList(string $selected = '', string $htmlname = 'ticketid', string $filtertype = '', int $limit = 20, string $filterkey = '', int $status = 1, int $outputmode = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '')

Return list of tickets.

from  Form
void
constructTicketListOption(object $objp, string $opt, array{key?: string, value?: mixed, type?: int} $optJson, string $selected, string $filterkey = '')

constructTicketListOption.

from  Form
string
selectProjects(string $selected = '', string $htmlname = 'projectid', string $filtertype = '', int<0, max> $limit = 0, int $status = 1, string $selected_input_value = '', int<0, 3> $hidelabel = 0, array<string, string|string[]> $ajaxoptions = array(), int $socid = 0, string|int<0, 1> $showempty = '1', int<0, 1> $forcecombo = 0, string $morecss = '', array<string, string> $selected_combinations = null, int<0, 1> $nooutput = 0)

Return list of projects in Ajax if Ajax activated or go to selectTicketsList

from  Form
mixed[]|string
selectProjectsList(string $selected = '', string $htmlname = 'projectid', string $filtertype = '', int $limit = 20, string $filterkey = '', int $status = 1, int $outputmode = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '')

Return list of projects.

from  Form
void
constructProjectListOption(stdClass $objp, string $opt, array{} $optJson, string $selected, string $filterkey = '')

constructProjectListOption.

from  Form
string
selectMembers(string $selected = '', string $htmlname = 'adherentid', string $filtertype = '', int $limit = 0, int $status = 1, string $selected_input_value = '', int<0, 3> $hidelabel = 0, array<string, string|string[]> $ajaxoptions = array(), int $socid = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '', array<string, string> $selected_combinations = null, int<0, 1> $nooutput = 0, string[] $excludeids = array())

Return list of members in Ajax if Ajax activated or go to selectTicketsList

from  Form
mixed[]|string
selectMembersList(string $selected = '', string $htmlname = 'adherentid', string $filtertype = '', int $limit = 20, string $filterkey = '', int $status = 1, int $outputmode = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '', string[] $excludeids = array())

Return list of adherents.

from  Form
void
constructMemberListOption(object $objp, string $opt, array{key?: string, value?: mixed, type?: int} $optJson, string $selected, string $filterkey = '')

constructMemberListOption.

from  Form
selectForForms($objectdesc, $htmlname, $preSelectedValue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '', $objectfield = '')

Generic method to select a component from a combo list.

from  Form
string|array<array{key: string, value: mixed, label: string}>
selectForFormsList(CommonObject $objecttmp, string $htmlname, int $preselectedvalue, string|int<0, 1> $showempty = '', string $searchkey = '', string $placeholder = '', string $morecss = '', string $moreparams = '', int $forcecombo = 0, int $outputmode = 0, int $disabled = 0, string $sortfield = '', string $filter = '', string $sortorder = 'ASC')

Output html form to select an object.

from  Form
static string
radio(string $htmlName, array<string, string|array{label: string, value?: string|int, attr?: array<string, string|int|bool|null>, unescapedAttr?: string[], attrLabel?: array<string, string|int|bool|null>, unescapedAttrLabel?: string[], disabled?: bool, css?: string, labelIsHtml?: bool}> $radioItems, string|int $selected = '', array<string, array<string, string|int|bool|null>|string|bool> $moreGlobalParams = [])

Generates a set of HTML radio inputs from an array of key-value items.

from  Form
static 
selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = 'minwidth75', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)

Return a HTML select string, built from an array of key+value.

from  Form
static 
selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)

Return a HTML select string, built from an array of key+value, but content returned into select come from an Ajax call of an URL.

from  Form
static 
selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')

Return a HTML select string, built from an array of key+value, but content returned into select is defined into $array parameter.

from  Form
static 
multiselectarray($htmlname, $array, $selected = array(), $key_in_label = 0, $value_as_key = 0, $morecss = '', $translate = 0, $width = 0, $moreattrib = '', $nu = '', $placeholder = '', $addjscombo = -1)

Show a multiselect form from an array. WARNING: Use this only for short lists.

from  Form
static string
multiSelectArrayWithCheckbox(string $htmlname, array<string, array{label: string, checked?: string, enabled?: string, type?: string, langfile?: string, position?: int, help?: string}> $array, string $varpage, int|string $pos = '')

Show a multiselect dropbox from an array.

from  Form
string
showCategories(int $id, string $type, int<0, 1> $rendermode = 0, int<0, 1> $nolink = 0)

Render list of categories linked to object with id $id and type $type

from  Form
int
showLinkedObjectBlock(CommonObject $object, string $morehtmlright = '', array<int, string> $compatibleImportElementsList = array(), string $title = 'RelatedObjects')

Show linked object block.

from  Form
array{linktoelem: string, htmltoenteralink: string}|string
showLinkToObjectBlock(CommonObject $object, string[]|null $restrictlinksto = array(), string[]|null $excludelinksto = array(), int<0, 1> $nooutput = 0)

Show block with links "to link to" other objects.

from  Form
string
selectyesno(string $htmlname, string|int<min, 1> $value = '', int<0, 1> $option = 0, bool|int<0, 1> $disabled = false, int<0, 1> $useempty = 0, int<0, 1> $addjscombo = 0, string $morecss = 'yesno width75', string $labelyes = 'Yes', string $labelno = 'No')

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

from  Form
void
select_export_model(string $selected = '', string $htmlname = 'exportmodelid', string $type = '', int $useempty = 0)

Return list of export templates

from  Form
string
showrefnav(CommonObject $object, string $paramid, string $morehtml = '', int<0, 1> $shownav = 1, string $fieldid = 'rowid', string $fieldref = 'ref', string $morehtmlref = '', string $moreparam = '', int<0, 1> $nodbprefix = 0, string $morehtmlleft = '', string $morehtmlstatus = '', string $morehtmlright = '')

Return a HTML area with the reference of object and a navigation bar for a business object Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criteria.

from  Form
string
showbarcode(CommonObject $object, int $width = 100, string $morecss = '')

Return HTML code to output a barcode

from  Form
static string
showphoto(string $modulepart, Societe|Adherent|Contact|User|CommonObject $object, int $width = 100, int $height = 0, int<0, 1> $caneditfield = 0, string $cssclass = 'photowithmargin', string $imagesize = '', int<0, 1> $addlinktofullsize = 1, int<0, 1> $cache = 0, ""|"user"|"environment" $forcecapture = '', int<0, 1> $noexternsourceoverwrite = 0)

Return HTML code to output a photo

from  Form
string
select_dolgroups(int|object|array<int|object> $selected = 0, string $htmlname = 'groupid', int<0, 1> $show_empty = 0, string|int[] $exclude = '', int<0, 1> $disabled = 0, string|int[] $include = '', int[] $enableonly = array(), string $force_entity = '0', bool $multiple = false, string $morecss = 'minwidth200')

Return select list of user groups

from  Form
string
showFilterButtons(string $pos = '')

Return HTML to show the search and clear search button

from  Form
string
showCheckAddButtons(string $cssclass = 'checkforaction', int $calljsfunction = 0, string $massactionname = "massaction")

Return HTML to show the search and clear search button

from  Form
string
showFilterAndCheckAddButtons(int $addcheckuncheckall = 0, string $cssclass = 'checkforaction', int $calljsfunction = 0, string $massactionname = "massaction")

Return HTML to show the search and clear search button

from  Form
string
selectExpenseCategories(string $selected = '', string $htmlname = 'fk_c_exp_tax_cat', int<0, 1> $useempty = 0, int[] $excludeid = array(), string $target = '', int $default_selected = 0, array<string, int|string> $params = array(), int<0, 1> $info_admin = 1)

Return HTML to show the select of expense categories

from  Form
string
selectExpenseRanges(string $selected = '', string $htmlname = 'fk_range', int $useempty = 0)

Return HTML to show the select ranges of expense range

from  Form
string
selectExpenseFees(string $selected = '', string $htmlname = 'fk_c_type_fees', int $useempty = 0, int $allchoice = 1, int $useid = 0)

Return HTML to show a select of expense

from  Form
string
selectInvoiceForTimeProject(int $socid = -1, string $selected = '', string $htmlname = 'invoiceid', int $maxlength = 24, int $option_only = 0, string $show_empty = '1', int $discard_closed = 0, int $forcefocus = 0, int $disabled = 0, string $morecss = 'maxwidth500', string $projectsListId = '', string $showproject = 'all', User $usertofilter = null)

Output a combo list with invoices for a project

from  Form
int
selectInvoiceRec(string $selected = '', string $htmlname = 'facrecid', int $maxlength = 24, int $option_only = 0, string $show_empty = '1', int $forcefocus = 0, int $disabled = 0, string $morecss = 'maxwidth500')

Output a combo list with invoices qualified for a third party TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database.

from  Form
string
searchComponent(array<array<string, array{type: string}>> $arrayofcriterias, array<int, string> $search_component_params, string[] $arrayofinputfieldsalreadyoutput = array(), string $search_component_params_hidden = '', array<string, array{type: string}> $arrayoffiltercriterias = array())

Output the component to make advanced search criteria

from  Form
string
selectModelMail(string $prefix, string $modelType = '', int<0, 1> $default = 0, int<0, 1> $addjscombo = 0, int|string $selected = 0, string $morecss = '')

selectModelMail

from  Form
string
buttonsSaveCancel(string $save_label = 'Save', string $cancel_label = 'Cancel', array<array{addclass?: string, name?: string, label_key?: string}> $morebuttons = array(), bool|int<0, 1> $withoutdiv = false, string $morecss = '', string $dol_openinpopup = '')

Output the buttons to submit a creation/edit form

from  Form
int
load_cache_invoice_subtype()

Load into cache list of invoice subtypes

from  Form
string
getSelectInvoiceSubtype(int $selected = 0, string $htmlname = 'subtypeid', int<0, 1> $addempty = 0, int<0, 1> $noinfoadmin = 0, string $morecss = '')

Return list of invoice subtypes.

from  Form
string
getSearchFilterToolInput(string $dataTarget, string $htmlName = 'search-tools-input', string $value = '', mixed[] $params = [])

No description

from  Form
string
inputType(string $type, string $name, string $value = '', string $id = '', string $morecss = '', string $moreparam = '', string $label = '', string $addInputLabel = '')

Html for input with label

from  Form
string
inputSelectAjax(string $htmlName, array<string, mixed> $array, string $id, string $ajaxUrl, array<string, string> $ajaxData = [], string $morecss = 'minwidth75', string $moreparam = '')

Html for select with get options by AJAX

from  Form
string
inputHtml(string $htmlName, string $value, string $morecss = '', string $moreparam = '')

Html for HTML area

from  Form
string
inputText(string $htmlName, string $value, string $morecss = '', string $moreparam = '', array<string, mixed> $options = array())

Html for HTML area

from  Form
string
inputRadio(string $htmlName, array<string, string> $options, string $selectedValue, string $morecss = '', string $moreparam = '')

Html for input radio

from  Form
string
inputStars(string $htmlName, int $size, int $value, string $morecss = '', string $moreparam = '')

Html for input stars

from  Form
string
inputIcon(string $htmlName, string $value, string $morecss = '', string $moreparam = '')

Html for input icon

from  Form
string
inputGeoPoint(string $htmlName, string $value, string $type = '')

Html for input geo point

from  Form
string
outputMultiValues(string[] $values)

Html for show selected multiple values

from  Form
string
outputStars(int $size, int $value)

Html for show stars

from  Form
string
outputIcon(string $value)

Html for show icon

from  Form
string
outputGeoPoint(string $value, string $type)

Html for show geo point

from  Form
string
getNomUrl(CommonObject $object, int $withpicto = 0, string $option = '', int $maxlength = 0, int $save_lastsearch_value = -1, int $notooltip = 0, string $morecss = '', int $add_label = 0, string $sep = ' - ')

Return link of object

from  Form
selectFiscalYear(int $selected = 0, string $htmlname = 'fiscalyear', $useempty = 0, $maxlen = 0, $help = 1)

Return list of fiscal year

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

array{y: string, m: string, w: string, d: string, h: string, i: string, s: string} getDurationTypes(Translate $langs, bool $plurial = true, bool $reverse = false)

Return an array of Duration Types

Parameters

Translate $langs

Translation to be used

bool $plurial

return plurial or singular

bool $reverse

change order of duration types

Return Value

array{y: string, m: string, w: string, d: string, h: string, i: string, s: string}

Types of durations

string editfieldkey(string $text, string $htmlname, string $preselected, ?object $object, int<0, 1>|bool $perm, string $typeofdata = 'string', string $moreparam = '', int<0, 1> $fieldrequired = 0, int<0, 3> $notabletag = 0, "id"|"socid"|"projectid" $paramid = 'id', string $help = '')

Output key field for an editable field

Parameters

string $text

Text of label or key to translate

string $htmlname

Name of select field ('edit' prefix will be added)

string $preselected

Value to show/edit (not used in this function)

?object $object

Object (on the page we show)

int<0, 1>|bool $perm

Permission to allow button to edit parameter. Set it to 0 to have a not edited field.

string $typeofdata

Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)

string $moreparam

More param to add on a href URL.

int<0, 1> $fieldrequired

1 if we want to show field as mandatory using the "fieldrequired" CSS.

int<0, 3> $notabletag

1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' '

"id"|"socid"|"projectid" $paramid

Key of parameter for id ('id', 'socid')

string $help

Tooltip help

Return Value

string

HTML edit field

string editfieldval(string $text, string $htmlname, string|int $value, CommonObject|ActionsCardProduct|ActionsCardService $object, bool|int<0, 1> $perm, string $typeofdata = 'string', ?string $editvalue = '', CommonObject $extObject = null, string|array<string, string>|null $custommsg = null, string $moreparam = '', int<0, 1> $notabletag = 1, string $formatfunc = '', string $paramid = 'id', string $gm = 'auto', array<string, int> $moreoptions = array(), string $editaction = '')

Output value of a field for an editable field

Parameters

string $text

Text of label (not used in this function)

string $htmlname

Name of select field

string|int $value

Value to show/edit

CommonObject|ActionsCardProduct|ActionsCardService $object

Object (that we want to show)

bool|int<0, 1> $perm

Permission to allow button to edit parameter

string $typeofdata

Type of data ('string' by default, 'checkbox', 'email', 'phone', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'safehtmlstring', 'restricthtml', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...')

?string $editvalue

When in edit mode, use this value as $value instead of value (for example, you can provide here a formatted price instead of numeric value, or a select combo). Use '' to use same than $value

CommonObject $extObject

External object ???

string|array<string, string>|null $custommsg

String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')

string $moreparam

More param to add on the form on action href URL parameter

int<0, 1> $notabletag

Do no output table tags

string $formatfunc

Call a specific method of $object->$formatfunc to output field in view mode (For example: 'dol_print_email')

string $paramid

Key of parameter for id ('id', 'socid')

string $gm

'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date)

array<string, int> $moreoptions

Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1)

string $editaction

[=''] use GETPOST default action or set action to edit mode

Return Value

string

HTML edit field

string widgetForTranslation(string $fieldname, CommonObject $object, bool|int<0, 1> $perm, string $typeofdata = 'string', string $check = '', string $morecss = '')

Output edit in place form

Parameters

string $fieldname

Name of the field

CommonObject $object Object
bool|int<0, 1> $perm

Permission to allow button to edit parameter. Set it to 0 to have a not edited field.

string $typeofdata

Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)

string $check

Same coe than $check parameter of GETPOST()

string $morecss

More CSS

Return Value

string

HTML code for the edit of alternative language

protected string editInPlace(CommonObject $object, string $value, string $htmlname, int $condition, string $inputType = 'textarea', ?string $editvalue = null, CommonObject $extObject = null, string|array<string, string>|null $custommsg = null)

Output edit in place form

Parameters

CommonObject $object Object
string $value

Value to show/edit

string $htmlname

DIV ID (field name)

int $condition

Condition to edit

string $inputType

Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly')

?string $editvalue

When in edit mode, use this value as $value instead of value

CommonObject $extObject

External object

string|array<string, string>|null $custommsg

String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')

Return Value

string

HTML edit in place

textwithtooltip(string $text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)

Show a text and picto with tooltip on text or picto.

Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip

Parameters

string $text

Text to show @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. @param int<0,3> $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both @param int<-1,1> $direction -1=image is before, 0=no image, 1=image is after @param string $img Html code for image (use img_xxx() function to get it) @param string $extracss Add a CSS style to td tags @param int<0,3> $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span @param string $incbefore Include code before the text @param int<0,1> $noencodehtmltext Do not encode into html entity the htmltext @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) @param int<0,1> $forcenowrap Force no wrap between text and picto (works with notabs=2 only) @return string Code html du tooltip (texte+picto) @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can.

$htmltext
$tooltipon
$direction
$img
$extracss
$notabs
$incbefore
$noencodehtmltext
$tooltiptrigger
$forcenowrap

string textwithpicto(string $text, string $htmltooltip, int<-1, 1> $direction = 1, string $type = 'help', string $extracss = 'valignmiddle', int<0, 1> $noencodehtmltext = 0, int<0, 3> $notabs = 3, string $tooltiptrigger = '', int<0, 1> $forcenowrap = 0)

Show a text with a picto and a tooltip on picto

Parameters

string $text

Text to show

string $htmltooltip

Content of tooltip. Warning: By default we keep only tags.

int<-1, 1> $direction

1=Icon is after text, -1=Icon is before text, 0=no icon

string $type

Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'

string $extracss

Add a CSS style to td, div or span tag

int<0, 1> $noencodehtmltext

Do not encode into html entity the htmltext

int<0, 3> $notabs

0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span

string $tooltiptrigger

''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable')

int<0, 1> $forcenowrap

Force no wrap between text and picto (works with notabs=2 only)

Return Value

string

HTML code of text, picto, tooltip

string|void selectMassAction(string $selected, array<string, string> $arrayofaction, int $alwaysvisible = 0, string $name = 'massaction', string $cssclass = 'checkforselect')

Generate select HTML to choose massaction

Parameters

string $selected

Value auto selected when at least one record is selected. Not a preselected value. Use '0' by default.

array<string, string> $arrayofaction

array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action.

int $alwaysvisible

1=select button always visible

string $name

Name for massaction

string $cssclass

CSS class used to check for select

Return Value

string|void

Select list

string select_country(int|string $selected = '', string $htmlname = 'country_id', string $htmloption = '', int $maxlength = 0, string $morecss = 'minwidth300', string $usecodeaskey = '', int<0, 1>|string $showempty = 1, int<0, 1> $disablefavorites = 0, int<0, 1> $addspecialentries = 0, string[] $exclude_country_code = array(), int<0, 1> $hideflags = 0, int<0, 1> $forcecombo = 0)

Return combo list of activated countries, into language of user

Parameters

int|string $selected

Id or Code or Label of preselected country

string $htmlname

Name of html select object

string $htmloption

More html options on select object

int $maxlength

Max length for labels (0=no limit)

string $morecss

More css class

string $usecodeaskey

''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key

int<0, 1>|string $showempty

Show empty choice

int<0, 1> $disablefavorites

1=Disable favorites,

int<0, 1> $addspecialentries

1=Add dedicated entries for group of countries (like 'European Economic Community', ...)

string[] $exclude_country_code

Array of country code (iso2) to exclude

int<0, 1> $hideflags

Hide flags

int<0, 1> $forcecombo

Force to load all values and output a standard combobox (with no beautification)

Return Value

string

HTML string with select

string select_incoterms(string $selected = '', string $location_incoterms = '', string $page = '', string $htmlname = 'incoterm_id', string $htmloption = '', int<0, 1> $forcecombo = 1, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), int<0, 1> $disableautocomplete = 0)

Return select list of incoterms

Parameters

string $selected

Id or Code of preselected incoterm

string $location_incoterms

Value of input location

string $page

Defined the form action

string $htmlname

Name of html select object

string $htmloption

Options html on select object

int<0, 1> $forcecombo

Force to load all values and output a standard combobox (with no beautification)

array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events

Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

int<0, 1> $disableautocomplete

Disable autocomplete

Return Value

string

HTML string with select and input

void select_type_of_lines(string $selected = '', string $htmlname = 'type', int<0, 1>|string $showempty = 0, int $hidetext = 0, int $forceall = 0, string $morecss = "", int $useajaxcombo = 1)

Return list of types of lines (product or service) Example: 0=product, 1=service, 9=other (for external module)

Parameters

string $selected

Preselected type

string $htmlname

Name of field in html form

int<0, 1>|string $showempty

Add an empty field

int $hidetext

Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)

int $forceall

1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')

string $morecss

More css

int $useajaxcombo

1=Use ajaxcombo

Return Value

void

int load_cache_types_fees()

Load into cache cache_types_fees, array of types of fees

Return Value

int

Nb of lines loaded, <0 if KO

void select_type_fees(string $selected = '', string $htmlname = 'type', int $showempty = 0)

Return list of types of notes

Parameters

string $selected

Preselected type

string $htmlname

Name of field in form

int $showempty

Add an empty field

Return Value

void

string select_company(int|string $selected = '', string $htmlname = 'socid', string $filter = '', string|int<1, 1> $showempty = '', int<0, 1> $showtype = 0, int<0, 1> $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), int $limit = 0, string $morecss = 'minwidth100', string $moreparam = '', string $selected_input_value = '', int<0, 3> $hidelabel = 1, array<string, string|string[]> $ajaxoptions = array(), bool $multiple = false, string[] $excludeids = array(), int<0, 1> $showcode = 0)

Output html form to select a third party This call select_thirdparty_list() or ajax depending on setup. This component is not able to support multiple select.

Parameters

int|string $selected

Preselected ID

string $htmlname

Name of field in form

string $filter

Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>()] are allowed here. Example: ((s.client:IN:1,3) AND (s.status:=:1)). Do not use a filter coming from input of users.

string|int<1, 1> $showempty

Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty')

int<0, 1> $showtype

Show third party type in combolist (customer, prospect or supplier)

int<0, 1> $forcecombo

Force to load all values and output a standard combobox (with no beautification)

array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events

Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

int $limit

Maximum number of elements

string $morecss

Add more css styles to the SELECT component

string $moreparam

Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container

string $selected_input_value

Value of preselected input text (for use with ajax)

int<0, 3> $hidelabel

Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder 'Search', 3 search icon after)

array<string, string|string[]> $ajaxoptions

Options for ajax_autocompleter

bool $multiple

add [] in the name of element and add 'multiple' attribute (not working with ajax_autocompleter)

string[] $excludeids

Exclude IDs from the select combo

int<0, 1> $showcode

Show code

Return Value

string

HTML string with select box for thirdparty.

int|string select_contact(int $socid, int|string $selected = '', string $htmlname = 'contactid', int<0, 3>|string $showempty = 0, string $exclude = '', string $limitto = '', int<0, 1> $showfunction = 0, string $morecss = '', bool $nokeyifsocid = true, int $showsoc = 0, int<0, 1> $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), string $moreparam = '', string $htmlid = '', string $selected_input_value = '', string $filter = '')

Output html form to select a contact This call select_contacts() or ajax depending on setup. This component is not able to support multiple select.

Return HTML code of the SELECT of list of all contacts (for a third party or all). This also set the number of contacts found into $this->num

Parameters

int $socid

Id of third party or 0 for all or -1 for empty list

int|string $selected

ID of preselected contact id

string $htmlname

Name of HTML field ('none' for a not editable field)

int<0, 3>|string $showempty

0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list

string $exclude

List of contacts id to exclude

string $limitto

Not used

int<0, 1> $showfunction

Add function into label

string $morecss

Add more class to class style

bool $nokeyifsocid

When 1, we force the option "Press a key to show list" to 0 if there is a value for $socid

int $showsoc

Add company into label

int<0, 1> $forcecombo

1=Force to use combo box (so no ajax beautify effect)

array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events

Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

string $moreparam

Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container

string $htmlid

Html id to use instead of htmlname

string $selected_input_value

Value of preselected input text (for use with ajax)

string $filter

Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>()] are allowed here. Example: ((s.client:IN:1,3) AND (s.status:=:1)). Do not use a filter coming from input of users.

Return Value

int|string

Return integer <0 if KO, HTML with select string if OK.

array<int, array{key: int, value: string, label: string, labelhtml: string}>|string select_thirdparty_list(string $selected = '', string $htmlname = 'socid', string $filter = '', string|int<0, 1> $showempty = '', int<0, 1> $showtype = 0, int $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), string $filterkey = '', int<0, 1> $outputmode = 0, int $limit = 0, string $morecss = 'minwidth100', string $moreparam = '', bool $multiple = false, string[] $excludeids = array(), int<0, 1> $showcode = 0)

Output html form to select a third party.

Note: you must use the select_company() to get the component to select a third party. This function must only be called by select_company.

Parameters

string $selected

Preselected type

string $htmlname

Name of field in form

string $filter

Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>] are allowed here, example: 's.rowid <> x' If you need parenthesis, use the Universal Filter Syntax, example: '(s.client:in:1,3)' Do not use a filter coming from input of users.

string|int<0, 1> $showempty

Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty')

int<0, 1> $showtype

Show third party nature in combolist (customer, prospect or supplier)

int $forcecombo

Force to use standard HTML select component without beautification

array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events

Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

string $filterkey

Filter on key value

int<0, 1> $outputmode

0=HTML select string, 1=Array

int $limit

Limit number of answers

string $morecss

Add more css styles to the SELECT component

string $moreparam

Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container

bool $multiple

add [] in the name of element and add 'multiple' attribute

string[] $excludeids

Exclude IDs from the select combo

int<0, 1> $showcode

Show code in list

Return Value

array<int, array{key: int, value: string, label: string, labelhtml: string}>|string

HTML string with

See also

select_company()

int|string|array<int, array{key: int, value: string, label: string, labelhtml: string}> selectcontacts(int $socid, string[]|int|string $selected = array(), string $htmlname = 'contactid', int<0, 3>|string $showempty = 0, string $exclude = '', string $limitto = '', int<0, 1> $showfunction = 0, string $morecss = '', int $options_only = 0, int<0, 1> $showsoc = 0, int $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), string $moreparam = '', string $htmlid = '', bool $multiple = false, int $disableifempty = 0, string $filter = '')

Return HTML code of the SELECT of list of all contacts (for a third party or all).

This also set the number of contacts found into $this->num Note: you must use the select_contact() to get the component to select a contact. This function must only be called by select_contact.

Parameters

int $socid

Id of third party or 0 for all or -1 for empty list

string[]|int|string $selected

Array of ID of preselected contact id

string $htmlname

Name of HTML field ('none' for a not editable field)

int<0, 3>|string $showempty

0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list

string $exclude

List of contacts id to exclude

string $limitto

Disable answers that are not id in this array list

int<0, 1> $showfunction

Add function into label

string $morecss

Add more class to class style

int $options_only

1=Return options only (for ajax treatment), 2=Return array

int<0, 1> $showsoc

Add company into label

int $forcecombo

Force to use combo box (so no ajax beautify effect)

array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events

Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

string $moreparam

Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container

string $htmlid

Html id to use instead of htmlname

bool $multiple

add [] in the name of element and add 'multiple' attribute

int $disableifempty

Set tag 'disabled' on select if there is no choice

string $filter

Optional filters criteras. You must use the USF (Universal Search Filter) syntax, example: '(s.client:in:1,3)' Do not use a filter coming from input of users.

Return Value

int|string|array<int, array{key: int, value: string, label: string, labelhtml: string}>

Return integer <0 if KO, HTML with select string if OK.

int select_remises(string $selected, string $htmlname, string $filter, int $socid, int $maxvalue = 0)

Return HTML combo list of absolute discounts

Parameters

string $selected

Id Fixed reduction preselected

string $htmlname

Name of the form field

string $filter

Optional filter critreria

int $socid

Id of thirdparty

int $maxvalue

Max value for lines that can be selected

Return Value

int

Return number of qualifed lines in list

void select_users(string $selected = '', string $htmlname = 'userid', int<0, 1> $show_empty = 0, int[] $exclude = null, int<0, 1> $disabled = 0, int[]|""|"hierarchy"|"hierarchyme" $include = '', int[]|int $enableonly = array(), string $force_entity = '0') deprecated

deprecated Use select_dolusers instead

Return the HTML select list of users

Parameters

string $selected

Id user preselected

string $htmlname

Field name in form

int<0, 1> $show_empty

0=liste sans valeur nulle, 1=ajoute valeur inconnue

int[] $exclude

Array list of users id to exclude

int<0, 1> $disabled

If select list must be disabled

int[]|""|"hierarchy"|"hierarchyme" $include

Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me

int[]|int $enableonly

Array list of users id to be enabled. All other must be disabled

string $force_entity

'0' or Ids of environment to force

Return Value

void

See also

select_dolusers()

string|array<int, string|array{id: int, label: string, labelhtml: string, color: string, picto: string}> select_dolusers(string|int|User $selected = '', string $htmlname = 'userid', int<0, 1>|string $show_empty = 0, int[]|null $exclude = null, int $disabled = 0, int[]|""|"hierarchy"|"hierarchyme" $include = '', int[]|"" $enableonly = '', string $force_entity = '', int $maxlength = 0, int<-1, 1> $showstatus = 0, string $morefilter = '', int<0, 3> $showalso = 0, string $enableonlytext = '', string $morecss = '', int<0, 1> $notdisabled = 0, int<0, 2> $outputmode = 0, bool $multiple = false, int<0, 1> $forcecombo = 0)

Return select list of users

Parameters

string|int|User $selected

User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1 or '', keep unselected (if empty is allowed)

string $htmlname

Field name in form

int<0, 1>|string $show_empty

0=list with no empty value, 1=add also an empty value into list

int[]|null $exclude

Array list of users id to exclude

int $disabled

If select list must be disabled

int[]|""|"hierarchy"|"hierarchyme" $include

Array list of users id to include. Use '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me

int[]|"" $enableonly

Array list of users id to be enabled. If defined, it means that others will be disabled

string $force_entity

'0' or list of Ids of environment to force, separated by a comma, or 'default' = do no extend to all entities allowed to superadmin.

int $maxlength

Maximum length of string into list (0=no limit)

int<-1, 1> $showstatus

0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status

string $morefilter

Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input.

int<0, 3> $showalso

0=default list, 1=add also a value "Everybody" at beginning of list, 2=add also a value "My team" at beginning of list (if user has at least 1 people), 3=add also "Everybody" + "My Team"

string $enableonlytext

If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.

string $morecss

More css

int<0, 1> $notdisabled

Show only active users (note: this will also happen, whatever is this option, if USER_HIDE_INACTIVE_IN_COMBOBOX is on).

int<0, 2> $outputmode

0=HTML select string, 1=Array, 2=Detailed array

bool $multiple

add [] in the name of element and add 'multiple' attribute

int<0, 1> $forcecombo

Force the component to be a simple combo box without ajax

Return Value

string|array<int, string|array{id: int, label: string, labelhtml: string, color: string, picto: string}>

HTML select string

See also

select_dolgroups()

string select_dolusers_forevent(string $action = '', string $htmlname = 'userid', int<0, 1> $show_empty = 0, int[] $exclude = null, int<0, 1> $disabled = 0, int[]|""|"hierarchy"|"hierarchyme" $include = array(), int[]|int $enableonly = array(), string $force_entity = '0', int $maxlength = 0, int<0, 1> $showstatus = 0, string $morefilter = '', int $showproperties = 0, int[] $listofuserid = array(), int[] $listofcontactid = array(), int[] $listofotherid = array(), int $canremoveowner = 1)

Return select list of users. Selected users are stored into session.

List of users are provided into $_SESSION['assignedtouser'].

Parameters

string $action

Value for $action

string $htmlname

Field name in form

int<0, 1> $show_empty

0=list without the empty value, 1=add empty value

int[] $exclude

Array list of users id to exclude

int<0, 1> $disabled

If select list must be disabled

int[]|""|"hierarchy"|"hierarchyme" $include

Array list of users id to include or 'hierarchy' to have only supervised users

int[]|int $enableonly

Array list of users id to be enabled. All other must be disabled

string $force_entity

'0' or Ids of environment to force

int $maxlength

Maximum length of string into list (0=no limit)

int<0, 1> $showstatus

0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status

string $morefilter

Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input.

int $showproperties

Show properties of each attendees

int[] $listofuserid

Array with properties of each user

int[] $listofcontactid

Array with properties of each contact

int[] $listofotherid

Array with properties of each other contact

int $canremoveowner

1 if we can remove owner, 0=no way

Return Value

string

HTML select string

See also

select_dolgroups()

string select_dolresources_forevent(string $action = '', string $htmlname = 'userid', int<0, 1> $show_empty = 0, int[] $exclude = null, int<0, 1> $disabled = 0, int[]|string $include = array(), int[] $enableonly = array(), string $force_entity = '0', int $maxlength = 0, int<-1, 1> $showstatus = 0, string $morefilter = '', int<0, 1> $showproperties = 0, array<int, array{transparency: bool|int<0, 1>}> $listofresourceid = array())

Return select list of resources. Selected resources are stored into session.

List of resources are provided into $_SESSION['assignedtoresource'].

Parameters

string $action

Value for $action

string $htmlname

Field name in form

int<0, 1> $show_empty

0=list without the empty value, 1=add empty value

int[] $exclude

Array list of users id to exclude

int<0, 1> $disabled

If select list must be disabled

int[]|string $include

Array list of users id to include or 'hierarchy' to have only supervised users

int[] $enableonly

Array list of users id to be enabled. All other must be disabled

string $force_entity

'0' or Ids of environment to force

int $maxlength

Maximum length of string into list (0=no limit)

int<-1, 1> $showstatus

0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status

string $morefilter

Add more filters into sql request

int<0, 1> $showproperties

Show properties of each attendees

array<int, array{transparency: bool|int<0, 1>}> $listofresourceid

Array with properties of each resource

Return Value

string

HTML select string

select_produits(int $selected = 0, $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1, $warehouseId = 0)

Return list of products.

Use Ajax if Ajax activated or go to select_produits_list

Parameters

int $selected

Preselected products @param string $htmlname Name of HTML select field (must be unique in page). @param int|'' $filtertype Filter on product type (''=nofilter, 0=product, 1=service) @param int $limit Limit on number of returned lines @param int $price_level Level of price to show @param int<-1,1> $status Sell status: -1=No filter on sell status, 0=Products not on sell, 1=Products on sell @param int<0,2> $finished 2=all, 1=finished, 0=raw material @param string $selected_input_value Value of preselected input text (for use with ajax) @param int<0,3> $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) @param array<string,string|string[]> $ajaxoptions Options for ajax_autocompleter @param int $socid Thirdparty Id (to get also price dedicated to this customer) @param string|int<0,1> $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. @param int<0,1> $forcecombo Force to use combo box. @param string $morecss Add more css on select @param int<0,1> $hidepriceinlabel 1=Hide prices in label @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used 'warehouseopen' = count products from open warehouses, 'warehouseclosed' = count products from closed warehouses, 'warehouseinternal' = count products from warehouses for internal correct/transfer only @param ?array<string,mixed> $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) @param int<0,1> $nooutput No print if 1, return the output into a string @param int<-1,1> $status_purchase Purchase status: -1=No filter on purchase status, 0=Products not on purchase, 1=Products on purchase @param int $warehouseId Filter by Warehouses Id where there is real stock @return void|string

$htmlname
$filtertype
$limit
$price_level
$status
$finished
$selected_input_value
$hidelabel
$ajaxoptions
$socid
$showempty
$forcecombo
$morecss
$hidepriceinlabel
$warehouseStatus
$selected_combinations
$nooutput
$status_purchase
$warehouseId

void|string select_bom(string $selected = '', string $htmlname = 'bom_id', int $limit = 0, int $status = 1, int $type = 0, string|int<0, 1> $showempty = '1', string $morecss = '', string $nooutput = '', int $forcecombo = 0, string[] $TProducts = [])

Return list of BOM for customer in Ajax if Ajax activated or go to select_produits_list

Parameters

string $selected

Preselected BOM id

string $htmlname

Name of HTML select field (must be unique in page).

int $limit

Limit on number of returned lines

int $status

Sell status -1=Return all bom, 0=Draft BOM, 1=Validated BOM

int $type

Type of the BOM (-1=Return all BOM, 0=Return disassemble BOM, 1=Return manufacturing BOM)

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

string $morecss

Add more css on select

string $nooutput

No print, return the output into a string

int $forcecombo

Force to use combo box

string[] $TProducts

Add filter on a defined product

Return Value

void|string

string|array<array{key: string, value: string, label: string, label2: string, desc: string, type: string, price_ht: string, price_ttc: string, price_ht_locale: string, price_ttc_locale: string, pricebasetype: string, tva_tx: string, default_vat_code: string, qty: string, discount: string, duration_value: string, duration_unit: string, pbq: string, labeltrans: string, desctrans: string, ref_customer: string}> select_produits_list(int $selected = 0, string $htmlname = 'productid', string $filtertype = '', int $limit = 20, int $price_level = 0, string $filterkey = '', int<-1, 1> $status = 1, int $finished = 2, int $outputmode = 0, int $socid = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = 'maxwidth500', int<0, 1> $hidepriceinlabel = 0, ""|"warehouseopen"|"warehouseclosed"|"warehouseinternal" $warehouseStatus = '', int<-1, 1> $status_purchase = -1, int $warehouseId = 0)

Return list of products for a customer.

Not optimized for high number of product, use instead select_produits() for large databases (so select_produits will call this function with a $limit parameter).

Parameters

int $selected

Preselected product

string $htmlname

Name of select html

string $filtertype

Filter on product type (''=nofilter, 0=product, 1=service)

int $limit

Limit on number of returned lines

int $price_level

Level of price to show

string $filterkey

Filter on product

int<-1, 1> $status

-1=Return all products, 0=Products not on sell, 1=Products on sell

int $finished

Filter on finished field: 2=No filter

int $outputmode

0=HTML select string, 1=Array

int $socid

Thirdparty Id (to get also price dedicated to this customer)

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int $forcecombo

Force to use combo box

string $morecss

Add more css on select

int<0, 1> $hidepriceinlabel

1=Hide prices in label

""|"warehouseopen"|"warehouseclosed"|"warehouseinternal" $warehouseStatus

Warehouse status filter to group/count stock. Following comma separated filter options can be used. 'warehouseopen' = count products from open warehouses, 'warehouseclosed' = count products from closed warehouses, 'warehouseinternal' = count products from warehouses for internal correct/transfer only

int<-1, 1> $status_purchase

Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase

int $warehouseId

Filter by Warehouses Id where there is real stock

Return Value

string|array<array{key: string, value: string, label: string, label2: string, desc: string, type: string, price_ht: string, price_ttc: string, price_ht_locale: string, price_ttc_locale: string, pricebasetype: string, tva_tx: string, default_vat_code: string, qty: string, discount: string, duration_value: string, duration_unit: string, pbq: string, labeltrans: string, desctrans: string, ref_customer: string}>

Array of keys for json

protected void constructProductListOption(stdClass $objp, string $opt, array{key?: string, value?: string, label?: string, label2?: string, desc?: string, type?: string, price_ht?: string, price_ttc?: string, price_ht_locale?: string, price_ttc_locale?: string, pricebasetype?: string, tva_tx?: string, default_vat_code?: string, qty?: string, discount?: string, duration_value?: string, duration_unit?: string, pbq?: string, labeltrans?: string, desctrans?: string, ref_customer?: string} $optJson, int $price_level, int $selected, int<0, 1> $hidepriceinlabel = 0, string $filterkey = '', int<0, 1> $novirtualstock = 0)

Function to forge the string with OPTIONs of SELECT.

This define value for &$opt and &$optJson. This function is called by select_produits_list().

Parameters

stdClass $objp

Resultset of fetch

string $opt

Option (var used for returned value in string option format)

array{key?: string, value?: string, label?: string, label2?: string, desc?: string, type?: string, price_ht?: string, price_ttc?: string, price_ht_locale?: string, price_ttc_locale?: string, pricebasetype?: string, tva_tx?: string, default_vat_code?: string, qty?: string, discount?: string, duration_value?: string, duration_unit?: string, pbq?: string, labeltrans?: string, desctrans?: string, ref_customer?: string} $optJson

Option (var used for returned value in json format)

int $price_level

Price level

int $selected

Preselected value

int<0, 1> $hidepriceinlabel

Hide price in label

string $filterkey

Filter key to highlight

int<0, 1> $novirtualstock

Do not load virtual stock, even if slow option STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO is on.

Return Value

void

string|void select_produits_fournisseurs(int $socid, string|int $selected = '', string $htmlname = 'productid', string $filtertype = '', string $filtre = '', array<string, string|string[]> $ajaxoptions = array(), int<0, 1> $hidelabel = 0, int<0, 1> $alsoproductwithnosupplierprice = 0, string $morecss = '', string $placeholder = '', int $nooutput = 0)

Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list)

Parameters

int $socid

Id third party

string|int $selected

Preselected product

string $htmlname

Name of HTML Select

string $filtertype

Filter on product type (''=nofilter, 0=product, 1=service)

string $filtre

For a SQL filter

array<string, string|string[]> $ajaxoptions

Options for ajax_autocompleter

int<0, 1> $hidelabel

Hide label (0=no, 1=yes)

int<0, 1> $alsoproductwithnosupplierprice

1=Add also product without supplier prices

string $morecss

More CSS

string $placeholder Placeholder
int $nooutput

1=do not output but return string instead

Return Value

string|void

HTML select or nothing

array<array<string, mixed>>|string select_produits_fournisseurs_list(int $socid, string $selected = '', string $htmlname = 'productid', ""|int<0, 1> $filtertype = '', string $filtre = '', string $filterkey = '', int $statut = -1, int $outputmode = 0, int $limit = 100, int $alsoproductwithnosupplierprice = 0, string $morecss = '', int $showstockinlist = 0, string $placeholder = '')

Return list of suppliers products

Parameters

int $socid

Id of supplier thirdparty (0 = no filter)

string $selected

Product price preselected (must be 'id' in product_fournisseur_price or 'idprod_IDPROD')

string $htmlname

Name of HTML select

""|int<0, 1> $filtertype

Filter on product type (''=nofilter, 0=product, 1=service)

string $filtre

Generic filter. Data must not come from user input.

string $filterkey

Filter of produdts

int $statut

-1=Return all products, 0=Products not on buy, 1=Products on buy

int $outputmode

0=HTML select string, 1=Array

int $limit

Limit of line number

int $alsoproductwithnosupplierprice

1=Add also product without supplier prices

string $morecss

Add more CSS

int $showstockinlist

Show stock information (slower).

string $placeholder Placeholder

Return Value

array<array<string, mixed>>|string

Array of keys for json or HTML component

string select_product_fourn_price(int $productid, string $htmlname = 'productfournpriceid', int $selected_supplier = 0)

Return list of suppliers prices for a product

Parameters

int $productid

Id of product

string $htmlname

Name of HTML field

int $selected_supplier

Pre-selected supplier if more than 1 result

Return Value

string

int load_cache_conditions_paiements()

Load into cache list of payment terms

Return Value

int

Nb of lines loaded, <0 if KO

int<-1, 1> load_cache_rule_for_lines_dates()

Loads into a cache property the list of possible rules for line dates

Return Value

int<-1, 1>

Return 1 if OK, -1 if empty

int load_cache_availability()

Load int a cache property the list of possible delivery delays.

Return Value

int

Nb of lines loaded, <0 if KO

void selectAvailabilityDelay(""|int $selected = '', string $htmlname = 'availid', string|int<0, 1> $filtertype = '', int<0, 1> $addempty = 0, string $morecss = '')

Return the list of type of delay available.

Parameters

""|int $selected

Id du type de delais pre-selectionne

string $htmlname

Nom de la zone select

string|int<0, 1> $filtertype

To add a filter

int<0, 1> $addempty

Add empty entry

string $morecss

More CSS

Return Value

void

int loadCacheInputReason()

Load into cache cache_demand_reason, array of input reasons

Return Value

int

Nb of lines loaded, <0 if KO

void selectInputReason(string $selected = '', string $htmlname = 'demandreasonid', string $exclude = '', int $addempty = 0, string $morecss = '', int $notooltip = 0)

Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) List found into table c_input_reason loaded by loadCacheInputReason

Parameters

string $selected

Id or code of type origin to select by default

string $htmlname

Nom de la zone select

string $exclude

To exclude a code value (Example: SRC_PROP)

int $addempty

Add an empty entry

string $morecss

Add more css to the HTML select component

int $notooltip

Do not show the tooltip for admin

Return Value

void

int load_cache_types_paiements()

Charge dans cache la liste des types de paiements possibles

Return Value

int

Nb of lines loaded, <0 if KO

void|string select_conditions_paiements(int $selected = 0, string $htmlname = 'condid', int $filtertype = -1, int $addempty = 0, int $noinfoadmin = 0, string $morecss = '', float $deposit_percent = -1, int $noprint = 0) deprecated

deprecated Use getSelectConditionsPaiements() instead and handle noprint locally.

print list of payment modes.

Constant MAIN_DEFAULT_PAYMENT_TERM_ID can be used to set default value but scope is all application, probably not what you want. See instead to force the default value by the caller.

Parameters

int $selected

Id of payment term to preselect by default

string $htmlname

Nom de la zone select

int $filtertype

If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)

int $addempty

Add an empty entry

int $noinfoadmin

0=Add admin info, 1=Disable admin info

string $morecss

Add more CSS on select tag

float $deposit_percent

< 0 : deposit_percent input makes no sense (for example, in list filters) 0 : use default deposit percentage from entry

0 : force deposit percentage (for example, from company object)

int $noprint

if set to one we return the html to print, if 0 (default) we print it

Return Value

void|string

string getSelectConditionsPaiements(int $selected = 0, string $htmlname = 'condid', int $filtertype = -1, int $addempty = 0, int $noinfoadmin = 0, string $morecss = '', float $deposit_percent = -1)

Return list of payment modes.

Constant MAIN_DEFAULT_PAYMENT_TERM_ID can be used to set default value but scope is all application, probably not what you want. See instead to force the default value by the caller.

Parameters

int $selected

Id of payment term to preselect by default

string $htmlname

Nom de la zone select

int $filtertype

If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)

int $addempty

Add an empty entry

int $noinfoadmin

0=Add admin info, 1=Disable admin info

string $morecss

Add more CSS on select tag

float $deposit_percent

< 0 : deposit_percent input makes no sense (for example, in list filters) 0 : use default deposit percentage from entry

0 : force deposit percentage (for example, from company object)

Return Value

string

String for the HTML select component

string getSelectRuleForLinesDates(string $selected = '', string $htmlname = 'rule_for_lines_dates', int $addempty = 0)

Returns select with rule for lines dates

Parameters

string $selected

Selected value

string $htmlname

HTML element name

int $addempty

Add empty option ?

Return Value

string

HTML string with all datas

string|void select_types_paiements(string $selected = '', string $htmlname = 'paiementtype', string $filtertype = '', int $format = 0, int $empty = 1, int $noadmininfo = 0, int $maxlength = 0, int $active = 1, string $morecss = '', int<0, 1> $nooutput = 0)

Return list of payment methods Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.

Parameters

string $selected

Id or code or preselected payment mode

string $htmlname

Name of select field

string $filtertype

To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))

int $format

0=id+label, 1=code+code, 2=code+label, 3=id+code

int $empty

1=can be empty, 0 otherwise

int $noadmininfo

0=Add admin info, 1=Disable admin info

int $maxlength

Max length of label

int $active

Active or not, -1 = all

string $morecss

Add more CSS on select tag

int<0, 1> $nooutput

1=Return string, do not send to output

Return Value

string|void

String for the HTML select component

string selectPriceBaseType(string $selected = '', string $htmlname = 'price_base_type', int $addjscombo = 0)

Selection HT or TTC

Parameters

string $selected

Id pre-selectionne

string $htmlname

Nom de la zone select

int $addjscombo

Add js combo

Return Value

string

Code of HTML select to chose tax or not

int load_cache_transport_mode()

Load in cache list of transport mode

Return Value

int

Nb of lines loaded, <0 if KO

void selectTransportMode(string $selected = '', string $htmlname = 'transportmode', int $format = 0, int $empty = 1, int $noadmininfo = 0, int $maxlength = 0, int $active = 1, string $morecss = '')

Return list of transport mode for intracomm report

Parameters

string $selected

Id of the transport mode preselected

string $htmlname

Name of the select field

int $format

0=id+label, 1=code+code, 2=code+label, 3=id+code

int $empty

1=can be empty, 0 else

int $noadmininfo

0=Add admin info, 1=Disable admin info

int $maxlength

Max length of label

int $active

Active or not, -1 = all

string $morecss

Add more CSS on select tag

Return Value

void

void selectShippingMethod(string $selected = '', string $htmlname = 'shipping_method_id', string $filtre = '', int $useempty = 0, string $moreattrib = '', int $noinfoadmin = 0, string $morecss = '')

Return a HTML select list of shipping mode

Parameters

string $selected

Id shipping mode preselected

string $htmlname

Name of select zone

string $filtre

To filter list. This parameter must not come from input of users

int $useempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

string $moreattrib

To add more attribute on select

int $noinfoadmin

0=Add admin info, 1=Disable admin info

string $morecss

More CSS

Return Value

void

void formSelectShippingMethod(string $page, string $selected = '', string $htmlname = 'shipping_method_id', int $addempty = 0)

Display form to select shipping mode

Parameters

string $page Page
string $selected

Id of shipping mode

string $htmlname

Name of select html field

int $addempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

Return Value

void

string selectSituationInvoices(string $selected = '', int $socid = 0)

Creates HTML last in cycle situation invoices selector

Parameters

string $selected

Preselected ID

int $socid

Company ID

Return Value

string

HTML select

string selectUnits(int|"" $selected = '', string $htmlname = 'units', int<0, 1> $showempty = 0, string $unit_type = '')

Creates HTML units selector (code => label)

Parameters

int|"" $selected

Preselected Unit ID

string $htmlname

Select name

int<0, 1> $showempty

Add an empty line

string $unit_type

Restrict to one given unit type

Return Value

string

HTML select

int|string select_comptes(int|"" $selected = '', string $htmlname = 'accountid', int<0, 2> $status = 0, string $filtre = '', int<0, 2>|string $useempty = 0, string $moreattrib = '', int<0, 1> $showcurrency = 0, string $morecss = '', int<0, 1> $nooutput = 0, int<0, 1> $addentrynone = 0)

Return a HTML select list of bank accounts

Parameters

int|"" $selected

Id account preselected

string $htmlname

Name of select zone

int<0, 2> $status

Status of searched accounts (0=open, 1=closed, 2=both)

string $filtre

To filter the list. This parameter must not come from input of users

int<0, 2>|string $useempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

string $moreattrib

To add more attribute on select

int<0, 1> $showcurrency

Show currency in label

string $morecss

More CSS

int<0, 1> $nooutput

1=Return string, do not send to output

int<0, 1> $addentrynone

Add an entry None

Return Value

int|string

If nooutput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string.

int|string selectRib(int|"" $selected = '', string $htmlname = 'ribcompanyid', string $filtre = '', int|string $useempty = 0, string $moreattrib = '', int $showibanbic = 0, string $morecss = '', int<0, 1> $nooutput = 0)

Return a HTML select list of bank accounts customer

Parameters

int|"" $selected

Id account preselected

string $htmlname

Name of select zone

string $filtre

To filter the list. This parameter must not come from input of users

int|string $useempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

string $moreattrib

To add more attribute on select

int $showibanbic

Show iban/bic in label

string $morecss

More CSS

int<0, 1> $nooutput

1=Return string, do not send to output

Return Value

int|string

If nooutput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string.

int selectEstablishments(string $selected = '', string $htmlname = 'entity', int $status = 0, string $filtre = '', int $useempty = 0, string $moreattrib = '')

Return a HTML select list of establishment

Parameters

string $selected

Id establishment preselected

string $htmlname

Name of select zone

int $status

Status of searched establishment (0=open, 1=closed, 2=both)

string $filtre

To filter list. This parameter must not come from input of users

int $useempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

string $moreattrib

To add more attribute on select

Return Value

int

Return integer <0 if error, Num of establishment found if OK (0, 1, 2, ...)

void formSelectAccount(string $page, string $selected = '', string $htmlname = 'fk_account', int<0, 2> $addempty = 0)

Display form to select bank account

Parameters

string $page Page
string $selected

Id of bank account

string $htmlname

Name of select html field

int<0, 2> $addempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

Return Value

void

void formRib(string $page, string $selected = '', string $htmlname = 'ribcompanyid', string $filtre = '', int $addempty = 0, int $showibanbic = 0)

Display form to select bank customer account

Parameters

string $page Page
string $selected

Id of bank customer account

string $htmlname

Name of select html field

string $filtre

filtre for rib selected

int $addempty

1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.

int $showibanbic

Show iban/bic in label

Return Value

void

string selectCategories(string $categtype, string $htmlname, CommonObject $object = null)

Return HTML component to select a category

Parameters

string $categtype

Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) should be avoid and is keptfor internal use only.

string $htmlname

Html name

CommonObject $object Object

Return Value

string

HTML component

See also

getFilterBox()

string|array<int, string>|array<int, array{id: int, fulllabel: string, data-html?: string, color: string, picto: string}>|array<int, array{rowid: int, id: int, fk_parent: int, label: string, description: string, color: string, position: string, visible: int, ref_ext: string, picto: string, fullpath: string, fulllabel: string, data-html?: string}> select_all_categories(string|int $type, int|"auto"|"" $selected = '', string $htmlname = "parent", int $maxlength = 64, int|string|int[] $fromid = 0, int<0, 3> $outputmode = 0, int<0, 1> $include = 0, string $morecss = '', int<0, 2> $useempty = 1)

Return list of categories having chosen type

Parameters

string|int $type

Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) should be avoid and is kept for internal use only.

int|"auto"|"" $selected

Id of category preselected or 'auto' (autoselect category if there is only one element). Not used if $outputmode = 1.

string $htmlname

HTML field name

int $maxlength

Maximum length for labels

int|string|int[] $fromid

Keep only or Exclude (depending on $include parameter) all categories (including the leaf $fromid) into the tree after this id $fromid. $fromid can be an :

  • int (id of category)
    • string (categories ids separated by comma)
  • array (list of categories ids)
int<0, 3> $outputmode

0=HTML select string, 1=Array with full label only, 2=Array extended, 3=Array with full picto + label

int<0, 1> $include

[=0] Removed or 1=Keep only

string $morecss

More CSS

int<0, 2> $useempty

0=No empty value, 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. Default is 1.

Return Value

string|array<int, string>|array<int, array{id: int, fulllabel: string, data-html?: string, color: string, picto: string}>|array<int, array{rowid: int, id: int, fk_parent: int, label: string, description: string, color: string, position: string, visible: int, ref_ext: string, picto: string, fullpath: string, fulllabel: string, data-html?: string}>

String list or Array of categories

See also

select_categories()

void form_confirm(string $page, string $title, string $question, string $action, array<array{name?: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>}>|string|null $formquestion = array(), string $selectedchoice = "", int<0, 2>|string $useajax = 0, int $height = 170, int $width = 500) deprecated

deprecated

Show a confirmation HTML form or AJAX popup

Parameters

string $page

Url of page to call if confirmation is OK

string $title Title
string $question Question
string $action Action
array<array{name?: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>}>|string|null $formquestion

An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', 'other', 'onecolumn' or 'hidden'...

string $selectedchoice

"" or "no" or "yes"

int<0, 2>|string $useajax

0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx

int $height

Force height of box

int $width

Force width of box

Return Value

void

See also

formconfirm()

string formconfirm(string $page, string $title, string $question, string $action, null|string|array<array{name?: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}>|array{text: string, 0?: array{name: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}, 1?: array{name: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}} $formquestion = '', int<0, 1>|""|"no"|"yes"|"1"|"0" $selectedchoice = '', int<0, 2>|string $useajax = 0, int|string $height = 0, int $width = 500, int $disableformtag = 0, string $labelbuttonyes = 'Yes', string $labelbuttonno = 'No')

Show a confirmation HTML form or AJAX popup.

Easiest way to use this is with useajax=1. If you use useajax='xxx', you must also add jquery code to trigger opening of box (with correct parameters) just after calling this method. For example: print ''."\n";

Parameters

string $page

Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformatted)

string $title Title
string $question Question
string $action Action
null|string|array<array{name?: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}>|array{text: string, 0?: array{name: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}, 1?: array{name: string, value?: string|float|bool, values?: string[], default?: string, label?: string, type: string, size?: int|string, morecss?: string, moreattr?: string, style?: string, inputko?: int<0, 1>, tdclass?: string}} $formquestion

An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', 'other', 'onecolumn' or 'hidden'...

int<0, 1>|""|"no"|"yes"|"1"|"0" $selectedchoice

'' or 'no', or 'yes' or '1', 1, '0' or 0

int<0, 2>|string $useajax

0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx

int|string $height

Force height of box (0 = auto)

int $width

Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.

int $disableformtag

1=Disable form tag. Can be used if we are already inside a

section.

string $labelbuttonyes

Label for Yes

string $labelbuttonno

Label for No

Return Value

string

HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form

string form_project(string $page, int $socid, int|string|Project $selected = '', string $htmlname = 'projectid', int<0, 2> $discard_closed = 0, int $maxlength = 20, int $forcefocus = 0, int<0, 1> $nooutput = 0, string $textifnoproject = '', string $morecss = '')

Show a form to select a project

Parameters

string $page Page
int $socid

Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)

int|string|Project $selected

Id of the preselected project

string $htmlname

Name of select field

int<0, 2> $discard_closed

Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable)

int $maxlength

Max length

int $forcefocus

Force focus on field (works with javascript only)

int<0, 1> $nooutput

No print is done. String is returned.

string $textifnoproject

Text to show if no project

string $morecss

More CSS

Return Value

string

Return html content

string form_conditions_reglement(string $page, string $selected = '', string $htmlname = 'cond_reglement_id', int<0, 1> $addempty = 0, ""|"direct-debit"|"bank-transfer" $type = '', int $filtertype = -1, float $deposit_percent = -1, int<0, 1> $nooutput = 0)

Show a form to select payment conditions

Parameters

string $page Page
string $selected

Id condition pre-selectionne

string $htmlname

Name of select html field

int<0, 1> $addempty

Add empty entry

""|"direct-debit"|"bank-transfer" $type

Type ('direct-debit' or 'bank-transfer')

int $filtertype

If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)

float $deposit_percent

< 0 : deposit_percent input makes no sense (for example, in list filters) 0 : use default deposit percentage from entry

0 : force deposit percentage (for example, from company object)

int<0, 1> $nooutput

No print is done. String is returned.

Return Value

string

HTML output or ''

string form_rule_for_lines_dates(string $page, string $selected = '', string $htmlname = 'rule_for_lines_dates', int $addempty = 0, int $nooutput = 0)

Form select for rule for lines dates

Parameters

string $page Page
string $selected

Id condition pre-selectionne

string $htmlname

Name of select html field

int $addempty

Add empty entry

int $nooutput

No print is done. String is returned.

Return Value

string

HTML output or ''

void form_availability(string $page, string $selected = '', string $htmlname = 'availability', int<0, 1> $addempty = 0)

Show a form to select a delivery delay

Parameters

string $page Page
string $selected

Id condition pre-selectionne

string $htmlname

Name of select html field

int<0, 1> $addempty

Add an empty entry

Return Value

void

void formInputReason(string $page, string $selected = '', string $htmlname = 'demandreason', int $addempty = 0, string $morecss = '')

Output HTML form to select list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) List found into table c_input_reason loaded by loadCacheInputReason

Parameters

string $page Page
string $selected

Id condition pre-selectionne

string $htmlname

Name of select html field

int $addempty

Add empty entry

string $morecss

More CSS

Return Value

void

string form_date(string $page, int|"" $selected, string $htmlname, int $displayhour = 0, int $displaymin = 0, int<0, 1> $nooutput = 0, string $type = '')

Show a form + html select a date

Parameters

string $page Page
int|"" $selected

Date preselected

string $htmlname

Html name of date input fields or 'none'

int $displayhour

Display hour selector

int $displaymin

Display minutes selector

int<0, 1> $nooutput

1=No print output, return string

string $type

'direct-debit' or 'bank-transfer'

Return Value

string

See also

selectDate()

void form_users(string $page, string $selected = '', string $htmlname = 'userid', int[] $exclude = array(), int[] $include = array())

Show a select form to choose a user

Parameters

string $page Page
string $selected

Id of user preselected

string $htmlname

Name of input html field. If 'none', we just output the user link.

int[] $exclude

List of users id to exclude

int[] $include

List of users id to include

Return Value

void

string form_modes_reglement(string $page, string $selected = '', string $htmlname = 'mode_reglement_id', string $filtertype = '', int<-1, 1> $active = 1, int<0, 1> $addempty = 0, string $type = '', int<0, 1> $nooutput = 0)

Show form with payment mode

Parameters

string $page Page
string $selected

Id mode pre-selectionne

string $htmlname

Name of select html field

string $filtertype

To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))

int<-1, 1> $active

Active or not, -1 = all

int<0, 1> $addempty

1=Add empty entry

string $type

Type ('direct-debit' or 'bank-transfer')

int<0, 1> $nooutput

1=Return string, no output

Return Value

string

HTML output or ''

void formSelectTransportMode(string $page, int|"" $selected = '', string $htmlname = 'transport_mode_id', int<-1, 1> $active = 1, int<0, 1> $addempty = 0)

Show form with transport mode

Parameters

string $page Page
int|"" $selected

Id mode pre-select

string $htmlname

Name of select html field

int<-1, 1> $active

Active or not, -1 = all

int<0, 1> $addempty

1=Add empty entry

Return Value

void

void form_multicurrency_code(string $page, string $selected = '', string $htmlname = 'multicurrency_code')

Show form with multicurrency code

Parameters

string $page Page
string $selected

code pre-selectionne

string $htmlname

Name of select html field

Return Value

void

void form_multicurrency_rate(string $page, float $rate = 0.0, string $htmlname = 'multicurrency_tx', string $currency = '')

Show form with multicurrency rate

Parameters

string $page Page
float $rate

Current rate

string $htmlname

Name of select html field

string $currency

Currency code to explain the rate

Return Value

void

void form_remise_dispo(string $page, int $selected, string $htmlname, int $socid, float $amount, string $filter = '', int $maxvalue = 0, string $more = '', int $hidelist = 0, int $discount_type = 0)

Show a select box with available absolute discounts

Parameters

string $page

Page URL where form is shown

int $selected

Value preselected

string $htmlname

Name of SELECT component. If 'none', not changeable. Example 'remise_id'.

int $socid

Third party id

float $amount

Total amount available

string $filter

SQL filter on discounts

int $maxvalue

Max value for lines that can be selected

string $more

More string to add

int $hidelist

1=Hide list

int $discount_type

0 => customer discount, 1 => supplier discount

Return Value

void

void form_contacts(string $page, Societe $societe, string $selected = '', string $htmlname = 'contactid')

Show forms to select a contact

Parameters

string $page Page
Societe $societe

Filter on third party

string $selected

Id contact pre-selectionne

string $htmlname

Name of HTML select. If 'none', we just show contact link.

Return Value

void

string form_thirdparty(string $page, string $selected = '', string $htmlname = 'socid', string $filter = '', string|int<0, 1> $showempty = 0, int<0, 1> $showtype = 0, int<0, 1> $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), int<0, 1> $nooutput = 0, int[] $excludeids = array(), string $textifnothirdparty = '')

Output html select to select thirdparty

Parameters

string $page Page
string $selected

Id preselected

string $htmlname

Name of HTML select

string $filter

Optional filters criteras. WARNING: To avoid SQL injection, only few chars [.a-z0-9 =<>()] are allowed here (example: 's.rowid <> x', 's.client IN (1,3)'). Do not use a filter coming from input of users.

string|int<0, 1> $showempty

Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty')

int<0, 1> $showtype

Show third party type in combolist (customer, prospect or supplier)

int<0, 1> $forcecombo

Force to use combo box

array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events

Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

int<0, 1> $nooutput

No print output. Return it only.

int[] $excludeids

Exclude IDs from the select combo

string $textifnothirdparty

Text to show if no thirdparty

Return Value

string

HTML output or ''

void select_currency(string $selected = '', string $htmlname = 'currency_id') deprecated

deprecated

Retourne la liste des devises, dans la langue de l'utilisateur

Parameters

string $selected

preselected currency code

string $htmlname

name of HTML select list

Return Value

void

string selectCurrency(string $selected = '', string $htmlname = 'currency_id', int $mode = 0, string $useempty = '')

Retourne la liste des devises, dans la langue de l'utilisateur

Parameters

string $selected

Preselected currency code

string $htmlname

Name of HTML select list

int $mode

0 = Add currency symbol into label, 1 = Add 3 letter iso code, 2 = Add both symbol and code

string $useempty

'1'=Allow empty value

Return Value

string

HTML component

string selectMultiCurrency(string $selected = '', string $htmlname = 'multicurrency_code', int $useempty = 0, string $filter = '', bool $excludeConfCurrency = false, string $morecss = 'maxwidth200 widthcentpercentminusx')

Return array of currencies in user language

Parameters

string $selected

Preselected currency code

string $htmlname

Name of HTML select list

int $useempty

1=Add empty line

string $filter

Optional filters criteras (example: 'code <> x', ' in (1,3)'). Do not use external string here.

bool $excludeConfCurrency

false = If company current currency not in table, we add it into list. Should always be available. true = we are in currency_rate update , we don't want to see conf->currency in select

string $morecss

More css

Return Value

string

HTML component

int load_cache_vatrates($country_code)

Load into the cache ->cache_vatrates, all the vat rates of a country

@param string $country_code Country code with quotes ("'CA'", or "'CA,IN,...'")

Parameters

$country_code

Return Value

int

Nb of loaded lines, 0 if already loaded, <0 if KO

load_tva(string $htmlname = 'tauxtva', $selectedrate = '', $societe_vendeuse = null, $societe_acheteuse = null, $idprod = 0, $info_bits = 0, $type = '', $options_only = false, $mode = 0, $type_vat = 0)

Output an HTML select vat rate.

The name of this function should be selectVat. We keep bad name for compatibility purpose.

Parameters

string $htmlname

Name of HTML select field @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (CODE)' for example. Use -1 or '' for no forcing (auto mode). @param ?Societe $societe_vendeuse Thirdparty seller @param ?Societe $societe_acheteuse Thirdparty buyer @param int $idprod Id product. O if unknown of NA. @param int $info_bits Miscellaneous information on line (1 for NPR) @param int<0,1>|'' $type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined) If seller not subject to VAT, default VAT=0. End of rule. If (seller country==buyer country), then default VAT=product's VAT. End of rule. If (seller and buyer in EU) and sold product = new means of transportation (car, boat, airplane), default VAT =0 (VAT must be paid by the buyer to his country's tax office and not the seller). End of rule. If (seller and buyer in EU) and buyer=private person, then default VAT=VAT of sold product. End of rule. If (seller and buyer in EU) and buyer=company then default VAT =0. End of rule. Else, default proposed VAT==0. End of rule. @param bool $options_only Return HTML options lines only (for ajax treatment) @param int<-1,1> $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key @param int<0,2> $type_vat 0=All types, 1=VAT rate for sales, 2=VAT rate for purchases @return string

$selectedrate
$societe_vendeuse
$societe_acheteuse
$idprod
$info_bits
$type
$options_only
$mode
$type_vat

select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = 0, $addplusone = '', $adddateof = '')

Show a HTML widget to input a date or combo list for day, month, years and optionally hours and minutes.

Fields are preselected with :

  • set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM')
  • local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
  • Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)

Parameters

$set_time
$prefix
$h
$m
$empty
$form_name
$d
$addnowlink
$nooutput
$disabled
$fullday
$addplusone
$adddateof

selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0, $forcenewline = 0)

Show 2 HTML widget to input a date or combo list for day, month, years and optionally hours and minutes.

Fields are preselected with :

  • set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM')
  • local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
  • Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)

Parameters

$set_time
$set_time_end
$prefix
$empty
$forcenewline

selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1, $labeladddateof = '', $placeholder = '', $gm = 'auto', $calendarpicto = '')

Show a HTML widget to input a date or combo list for day, month, years and optionally hours and minutes.

Fields are preselected with :

  • set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM')
  • local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
  • Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)

Parameters

$set_time
$prefix
$h
$m
$empty
$form_name
$d
$addnowlink
$disabled
$fullday
$addplusone
$adddateof
$openinghours
$stepminutes
$labeladddateof
$placeholder
$gm
$calendarpicto

string selectTypeDuration(string $prefix, string $selected = 'i', string[] $excludetypes = array(), string $morecss = 'minwidth75 maxwidth100')

selectTypeDuration

Parameters

string $prefix Prefix
string $selected

Selected duration type

string[] $excludetypes

Array of duration types to exclude. Example array('y', 'm')

string $morecss

Additional css on select

Return Value

string

HTML select string

string select_duration(string $prefix, int|string $iSecond = '', int $disabled = 0, string $typehour = 'select', int $minunderhours = 0, int<0, 1> $nooutput = 0)

Function to show a form to select a duration on a page

Parameters

string $prefix

Prefix for input fields

int|string $iSecond

Default preselected duration (number of seconds or '')

int $disabled

Disable the combo box

string $typehour

If 'select' then input hour and input min is a combo, If 'text' input hour is in text and input min is a text, If 'textselect' input hour is in text and input min is a combo

int $minunderhours

If 1, show minutes selection under the hours

int<0, 1> $nooutput

Do not output html string but return it

Return Value

string

HTML component

string selectTickets(string $selected = '', string $htmlname = 'ticketid', string $filtertype = '', int $limit = 0, int $status = 1, string $selected_input_value = '', int<0, 3> $hidelabel = 0, array<string, string|string[]> $ajaxoptions = array(), int $socid = 0, string|int<0, 1> $showempty = '1', int<0, 1> $forcecombo = 0, string $morecss = '', array<string, string> $selected_combinations = null, int<0, 1> $nooutput = 0)

Return list of tickets in Ajax if Ajax activated or go to selectTicketsList

Parameters

string $selected

Preselected tickets

string $htmlname

Name of HTML select field (must be unique in page).

string $filtertype

To add a filter

int $limit

Limit on number of returned lines

int $status

Ticket status

string $selected_input_value

Value of preselected input text (for use with ajax)

int<0, 3> $hidelabel

Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)

array<string, string|string[]> $ajaxoptions

Options for ajax_autocompleter

int $socid

Thirdparty Id (to get also price dedicated to this customer)

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int<0, 1> $forcecombo

Force to use combo box

string $morecss

Add more css on select

array<string, string> $selected_combinations

Selected combinations. Format: array([attrid] => attrval, [...])

int<0, 1> $nooutput

No print, return the output into a string

Return Value

string

array<array{key: string, value: mixed, type: int}>|string selectTicketsList(string $selected = '', string $htmlname = 'ticketid', string $filtertype = '', int $limit = 20, string $filterkey = '', int $status = 1, int $outputmode = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '')

Return list of tickets.

Called by selectTickets.

Parameters

string $selected

Preselected ticket

string $htmlname

Name of select html

string $filtertype

Filter on ticket type

int $limit

Limit on number of returned lines

string $filterkey

Filter on ticket ref or subject

int $status

Ticket status

int $outputmode

0=HTML select string, 1=Array

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int $forcecombo

Force to use combo box

string $morecss

Add more css on select

Return Value

array<array{key: string, value: mixed, type: int}>|string

Array of keys for json or HTML component

protected void constructTicketListOption(object $objp, string $opt, array{key?: string, value?: mixed, type?: int} $optJson, string $selected, string $filterkey = '')

constructTicketListOption.

This define value for &$opt and &$optJson.

Parameters

object $objp

Result set of fetch

string $opt

Option (var used for returned value in string option format)

array{key?: string, value?: mixed, type?: int} $optJson

Option (var used for returned value in json format)

string $selected

Preselected value

string $filterkey

Filter key to highlight

Return Value

void

string selectProjects(string $selected = '', string $htmlname = 'projectid', string $filtertype = '', int<0, max> $limit = 0, int $status = 1, string $selected_input_value = '', int<0, 3> $hidelabel = 0, array<string, string|string[]> $ajaxoptions = array(), int $socid = 0, string|int<0, 1> $showempty = '1', int<0, 1> $forcecombo = 0, string $morecss = '', array<string, string> $selected_combinations = null, int<0, 1> $nooutput = 0)

Return list of projects in Ajax if Ajax activated or go to selectTicketsList

Parameters

string $selected

Preselected tickets

string $htmlname

Name of HTML select field (must be unique in page).

string $filtertype

To add a filter

int<0, max> $limit

Limit on number of returned lines

int $status

Not used

string $selected_input_value

Value of preselected input text (for use with ajax)

int<0, 3> $hidelabel

Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)

array<string, string|string[]> $ajaxoptions

Options for ajax_autocompleter

int $socid

Thirdparty Id (to get also price dedicated to this customer)

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int<0, 1> $forcecombo

Force to use combo box

string $morecss

Add more css on select

array<string, string> $selected_combinations

Selected combinations. Format: array([attrid] => attrval, [...])

int<0, 1> $nooutput

No print, return the output into a string

Return Value

string

mixed[]|string selectProjectsList(string $selected = '', string $htmlname = 'projectid', string $filtertype = '', int $limit = 20, string $filterkey = '', int $status = 1, int $outputmode = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '')

Return list of projects.

Called by selectProjects.

Parameters

string $selected

Preselected project

string $htmlname

Name of select html

string $filtertype

Filter on project type

int $limit

Limit on number of returned lines

string $filterkey

Filter on project ref or subject

int $status

Not used

int $outputmode

0=HTML select string, 1=Array

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int $forcecombo

Force to use combo box

string $morecss

Add more css on select

Return Value

mixed[]|string

Array of keys for json or HTML component

protected void constructProjectListOption(stdClass $objp, string $opt, array{} $optJson, string $selected, string $filterkey = '')

constructProjectListOption.

This define value for &$opt and &$optJson.

Parameters

stdClass $objp

Result set of fetch

string $opt

Option (var used for returned value in string option format)

array{} $optJson

Option (var used for returned value in json format) @phan-output-reference

string $selected

Preselected value

string $filterkey

Filter key to highlight

Return Value

void

string selectMembers(string $selected = '', string $htmlname = 'adherentid', string $filtertype = '', int $limit = 0, int $status = 1, string $selected_input_value = '', int<0, 3> $hidelabel = 0, array<string, string|string[]> $ajaxoptions = array(), int $socid = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '', array<string, string> $selected_combinations = null, int<0, 1> $nooutput = 0, string[] $excludeids = array())

Return list of members in Ajax if Ajax activated or go to selectTicketsList

Parameters

string $selected

Preselected tickets

string $htmlname

Name of HTML select field (must be unique in page).

string $filtertype

To add a filter

int $limit

Limit on number of returned lines

int $status

Ticket status

string $selected_input_value

Value of preselected input text (for use with ajax)

int<0, 3> $hidelabel

Hide label (0=no, 1=yes, 2=show search icon before and placeholder, 3 search icon after)

array<string, string|string[]> $ajaxoptions

Options for ajax_autocompleter

int $socid

Thirdparty Id (to get also price dedicated to this customer)

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int $forcecombo

Force to use combo box

string $morecss

Add more css on select

array<string, string> $selected_combinations

Selected combinations. Format: array([attrid] => attrval, [...])

int<0, 1> $nooutput

No print, return the output into a string

string[] $excludeids

Exclude IDs from the select combo

Return Value

string

mixed[]|string selectMembersList(string $selected = '', string $htmlname = 'adherentid', string $filtertype = '', int $limit = 20, string $filterkey = '', int $status = 1, int $outputmode = 0, string|int<0, 1> $showempty = '1', int $forcecombo = 0, string $morecss = '', string[] $excludeids = array())

Return list of adherents.

Called by selectMembers.

Parameters

string $selected

Preselected adherent

string $htmlname

Name of select html

string $filtertype

Filter on adherent type

int $limit

Limit on number of returned lines

string $filterkey

Filter on member status

int $status

Member status

int $outputmode

0=HTML select string, 1=Array

string|int<0, 1> $showempty

'' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.

int $forcecombo

Force to use combo box

string $morecss

Add more css on select

string[] $excludeids

Exclude IDs from the select combo

Return Value

mixed[]|string

Array of keys for json or HTML string component

protected void constructMemberListOption(object $objp, string $opt, array{key?: string, value?: mixed, type?: int} $optJson, string $selected, string $filterkey = '')

constructMemberListOption.

This define value for &$opt and &$optJson.

Parameters

object $objp

Result set of fetch

string $opt

Option (var used for returned value in string option format)

array{key?: string, value?: mixed, type?: int} $optJson

Option (var used for returned value in json format)

string $selected

Preselected value

string $filterkey

Filter key to highlight

Return Value

void

selectForForms($objectdesc, $htmlname, $preSelectedValue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '', $objectfield = '')

Generic method to select a component from a combo list.

Can use autocomplete with ajax after x key pressed (if $objecttmp->element.'_USE_SEARCH_TO_SELECT' is set) or a full combo, depending on setup. This is the generic method that will replace all specific existing methods.

Parameters

$objectdesc
$htmlname
$preSelectedValue
$showempty
$searchkey
$placeholder
$morecss
$moreparams
$forcecombo
$disabled
$selected_input_value
$objectfield

string|array<array{key: string, value: mixed, label: string}> selectForFormsList(CommonObject $objecttmp, string $htmlname, int $preselectedvalue, string|int<0, 1> $showempty = '', string $searchkey = '', string $placeholder = '', string $morecss = '', string $moreparams = '', int $forcecombo = 0, int $outputmode = 0, int $disabled = 0, string $sortfield = '', string $filter = '', string $sortorder = 'ASC')

Output html form to select an object.

Note, this function is called by selectForForms or by ajax selectobject.php

Parameters

CommonObject $objecttmp

Object to know the table to scan for combo.

string $htmlname

Name of HTML select component

int $preselectedvalue

Preselected value (ID of element)

string|int<0, 1> $showempty

''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)

string $searchkey

Search value

string $placeholder

Place holder

string $morecss

More CSS

string $moreparams

More params provided to ajax call

int $forcecombo

Force to load all values and output a standard combobox (with no beautification)

int $outputmode

0=HTML select string, 1=Array

int $disabled

1=Html component is disabled

string $sortfield

Sort field

string $filter

Add more filter (Universal Search Filter)

string $sortorder

Sort order field

Return Value

string|array<array{key: string, value: mixed, label: string}>

Return HTML string

See also

selectForForms()

static string radio(string $htmlName, array<string, string|array{label: string, value?: string|int, attr?: array<string, string|int|bool|null>, unescapedAttr?: string[], attrLabel?: array<string, string|int|bool|null>, unescapedAttrLabel?: string[], disabled?: bool, css?: string, labelIsHtml?: bool}> $radioItems, string|int $selected = '', array<string, array<string, string|int|bool|null>|string|bool> $moreGlobalParams = [])

Generates a set of HTML radio inputs from an array of key-value items.

Parameters

string $htmlName

Name of the HTML input group

array<string, string|array{label: string, value?: string|int, attr?: array<string, string|int|bool|null>, unescapedAttr?: string[], attrLabel?: array<string, string|int|bool|null>, unescapedAttrLabel?: string[], disabled?: bool, css?: string, labelIsHtml?: bool}> $radioItems

Array of items in the form key => label or key => array of item properties

string|int $selected

Preselected key for selection.

array<string, array<string, string|int|bool|null>|string|bool> $moreGlobalParams

Additional global parameters applied to all items (e.g., attributes)

Return Value

string

HTML string containing all radio inputs wrapped in

static selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = 'minwidth75', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)

Return a HTML select string, built from an array of key+value.

Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.

Parameters

$htmlname
$array
$id
$show_empty
$key_in_label
$value_as_key
$moreparam
$translate
$maxlen
$disabled
$sort
$morecss
$addjscombo
$moreparamonempty
$disablebademail
$nohtmlescape

static selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)

Return a HTML select string, built from an array of key+value, but content returned into select come from an Ajax call of an URL.

Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.

Parameters

$htmlname
$url
$id
$moreparam
$moreparamtourl
$disabled
$minimumInputLength
$morecss
$callurlonselect
$placeholder
$acceptdelayedhtml

static selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')

Return a HTML select string, built from an array of key+value, but content returned into select is defined into $array parameter.

Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.

Parameters

$htmlname
$array
$id
$moreparam
$disableFiltering
$disabled
$minimumInputLength
$morecss
$callurlonselect
$placeholder
$acceptdelayedhtml
$textfortitle

static multiselectarray($htmlname, $array, $selected = array(), $key_in_label = 0, $value_as_key = 0, $morecss = '', $translate = 0, $width = 0, $moreattrib = '', $nu = '', $placeholder = '', $addjscombo = -1)

Show a multiselect form from an array. WARNING: Use this only for short lists.

Parameters

$htmlname
$array
$selected
$key_in_label
$value_as_key
$morecss
$translate
$width
$moreattrib
$nu
$placeholder
$addjscombo

static string multiSelectArrayWithCheckbox(string $htmlname, array<string, array{label: string, checked?: string, enabled?: string, type?: string, langfile?: string, position?: int, help?: string}> $array, string $varpage, int|string $pos = '')

Show a multiselect dropbox from an array.

If a saved selection of fields exists for user (into $user->conf->MAIN_SELECTEDFIELDS_contextofpage), we use this one instead of default.

Parameters

string $htmlname

Name of HTML field

array<string, array{label: string, checked?: string, enabled?: string, type?: string, langfile?: string, position?: int, help?: string}> $array

Array with array of fields we could show. This array may be modified according to setup of user.

string $varpage

Id of context for page. Can be set by caller with $varpage=(empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage);

int|string $pos

Position of the colon in list: 1 or 'left' or '' (meaning 'right').

Return Value

string

HTML multiselect string

See also

selectarray()

string showCategories(int $id, string $type, int<0, 1> $rendermode = 0, int<0, 1> $nolink = 0)

Render list of categories linked to object with id $id and type $type

Parameters

int $id

Id of object

string $type

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

int<0, 1> $rendermode

0=Default, use multiselect (deprecated). 1=Emulate multiselect (recommended)

int<0, 1> $nolink

1=Do not add html links

Return Value

string

String with categories

int showLinkedObjectBlock(CommonObject $object, string $morehtmlright = '', array<int, string> $compatibleImportElementsList = array(), string $title = 'RelatedObjects')

Show linked object block.

Parameters

CommonObject $object

Object we want to show links to

string $morehtmlright

More html to show on right of title

array<int, string> $compatibleImportElementsList

Array of compatibles elements object for "import from" action

string $title Title

Return Value

int

Return Number of different types

array{linktoelem: string, htmltoenteralink: string}|string showLinkToObjectBlock(CommonObject $object, string[]|null $restrictlinksto = array(), string[]|null $excludelinksto = array(), int<0, 1> $nooutput = 0)

Show block with links "to link to" other objects.

Parameters

CommonObject $object

Object we want to show links to

string[]|null $restrictlinksto

Restrict links to some elements, for example array('order') or array('supplier_order'). null or array() if no restriction.

string[]|null $excludelinksto

Do not show links of this type, for example array('order') or array('supplier_order'). null or array() if no exclusion.

int<0, 1> $nooutput

1=Return array with content instead of printing it.

Return Value

array{linktoelem: string, htmltoenteralink: string}|string

HTML block

string selectyesno(string $htmlname, string|int<min, 1> $value = '', int<0, 1> $option = 0, bool|int<0, 1> $disabled = false, int<0, 1> $useempty = 0, int<0, 1> $addjscombo = 0, string $morecss = 'yesno width75', string $labelyes = 'Yes', string $labelno = 'No')

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

Parameters

string $htmlname

Name of html select field

string|int<min, 1> $value

Pre-selected value

int<0, 1> $option

0 return yes/no, 1 return 1/0

bool|int<0, 1> $disabled

true or false

int<0, 1> $useempty

1=Add empty line

int<0, 1> $addjscombo

1=Add js beautifier on combo box

string $morecss

More CSS

string $labelyes

Label for Yes

string $labelno

Label for No

Return Value

string

See option

void select_export_model(string $selected = '', string $htmlname = 'exportmodelid', string $type = '', int $useempty = 0)

Return list of export templates

Parameters

string $selected

Id modele pre-selectionne

string $htmlname

Name of HTML select

string $type

Type of searched templates

int $useempty

Affiche valeur vide dans liste

Return Value

void

string showrefnav(CommonObject $object, string $paramid, string $morehtml = '', int<0, 1> $shownav = 1, string $fieldid = 'rowid', string $fieldref = 'ref', string $morehtmlref = '', string $moreparam = '', int<0, 1> $nodbprefix = 0, string $morehtmlleft = '', string $morehtmlstatus = '', string $morehtmlright = '')

Return a HTML area with the reference of object and a navigation bar for a business object Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criteria.

Parameters

CommonObject $object

Object to show.

string $paramid

Name of parameter to use to name the id into the URL next/previous link.

string $morehtml

More html content to output just before the nav bar.

int<0, 1> $shownav

Show Condition (navigation is shown if value is 1).

string $fieldid

Name of field id into database to use for select next and previous (we make the select max and min on this field compared to $object->ref). Use 'none' to disable next/prev.

string $fieldref

Name of field ref of object (object->ref) to show or 'none' to not show ref.

string $morehtmlref

More html to show after ref.

string $moreparam

More param to add in nav link url. Must start with '&...'.

int<0, 1> $nodbprefix

Do not include DB prefix to forge table name.

string $morehtmlleft

More html code to show before ref.

string $morehtmlstatus

More html code to show under navigation arrows (status place).

string $morehtmlright

More html code to show after ref.

Return Value

string

Portion HTML with ref + navigation buttons

string showbarcode(CommonObject $object, int $width = 100, string $morecss = '')

Return HTML code to output a barcode

Parameters

CommonObject $object

Object containing data to retrieve file name

int $width

Width of photo

string $morecss

More CSS on img of barcode

Return Value

string

HTML code to output barcode

static string showphoto(string $modulepart, Societe|Adherent|Contact|User|CommonObject $object, int $width = 100, int $height = 0, int<0, 1> $caneditfield = 0, string $cssclass = 'photowithmargin', string $imagesize = '', int<0, 1> $addlinktofullsize = 1, int<0, 1> $cache = 0, ""|"user"|"environment" $forcecapture = '', int<0, 1> $noexternsourceoverwrite = 0)

Return HTML code to output a photo

Parameters

string $modulepart

Key to define module concerned ('societe', 'userphoto', 'memberphoto')

Societe|Adherent|Contact|User|CommonObject $object

Object containing data to retrieve file name

int $width

Width of photo

int $height

Height of photo (auto if 0)

int<0, 1> $caneditfield

Add edit fields

string $cssclass

CSS name to use on img for photo

string $imagesize

'mini', 'small' or '' (original)

int<0, 1> $addlinktofullsize

Add link to fullsize image

int<0, 1> $cache

1=Accept to use image in cache

""|"user"|"environment" $forcecapture

'', 'user' (user-facing camera) or 'environment' ('outward-facing camera'). Force the parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if ''.

int<0, 1> $noexternsourceoverwrite

No overwrite image with extern source (like 'gravatar' or other module)

Return Value

string

HTML code to output photo

See also

getImagePublicURLOfObject()

string select_dolgroups(int|object|array<int|object> $selected = 0, string $htmlname = 'groupid', int<0, 1> $show_empty = 0, string|int[] $exclude = '', int<0, 1> $disabled = 0, string|int[] $include = '', int[] $enableonly = array(), string $force_entity = '0', bool $multiple = false, string $morecss = 'minwidth200')

Return select list of user groups

Parameters

int|object|array<int|object> $selected

Id group or group(s) preselected

string $htmlname

Field name in form

int<0, 1> $show_empty

0=liste sans valeur nulle, 1=ajoute valeur inconnue

string|int[] $exclude

Array list of groups id to exclude

int<0, 1> $disabled

If select list must be disabled

string|int[] $include

Array list of groups id to include

int[] $enableonly

Array list of groups id to be enabled. All other must be disabled

string $force_entity

'0' or Ids of environment to force

bool $multiple

add [] in the name of element and add 'multiple' attribute (not working with ajax_autocompleter)

string $morecss

More css to add to html component

Return Value

string

HTML Componont to select a group

See also

select_dolusers()

string showFilterButtons(string $pos = '')

Return HTML to show the search and clear search button

Parameters

string $pos

Position of colon on the list. Value 'left' or 'right'

Return Value

string

string showCheckAddButtons(string $cssclass = 'checkforaction', int $calljsfunction = 0, string $massactionname = "massaction")

Return HTML to show the search and clear search button

Parameters

string $cssclass

CSS class

int $calljsfunction

0=default. 1=call function initCheckForSelect() after changing status of checkboxes

string $massactionname

Mass action button name that will launch an action on the selected items

Return Value

string

HTML code with checkbox button

string showFilterAndCheckAddButtons(int $addcheckuncheckall = 0, string $cssclass = 'checkforaction', int $calljsfunction = 0, string $massactionname = "massaction")

Return HTML to show the search and clear search button

Parameters

int $addcheckuncheckall

Add the check all/uncheck all checkbox (use javascript) and code to manage this

string $cssclass

CSS class

int $calljsfunction

0=default. 1=call function initCheckForSelect() after changing status of checkboxes

string $massactionname

Mass action name

Return Value

string

string selectExpenseCategories(string $selected = '', string $htmlname = 'fk_c_exp_tax_cat', int<0, 1> $useempty = 0, int[] $excludeid = array(), string $target = '', int $default_selected = 0, array<string, int|string> $params = array(), int<0, 1> $info_admin = 1)

Return HTML to show the select of expense categories

Parameters

string $selected

preselected category

string $htmlname

name of HTML select list

int<0, 1> $useempty

1=Add empty line

int[] $excludeid

id to exclude

string $target

htmlname of target select to bind event

int $default_selected

default category to select if fk_c_type_fees change = EX_KME

array<string, int|string> $params

param to give

int<0, 1> $info_admin

Show the tooltip help picto to setup list

Return Value

string

string selectExpenseRanges(string $selected = '', string $htmlname = 'fk_range', int $useempty = 0)

Return HTML to show the select ranges of expense range

Parameters

string $selected

Preselected category

string $htmlname

Name of HTML select list

int $useempty

1=Add empty line

Return Value

string

string selectExpenseFees(string $selected = '', string $htmlname = 'fk_c_type_fees', int $useempty = 0, int $allchoice = 1, int $useid = 0)

Return HTML to show a select of expense

Parameters

string $selected

preselected category

string $htmlname

name of HTML select list

int $useempty

1=Add empty choice

int $allchoice

1=Add all choice

int $useid

0=use 'code' as key, 1=use 'id' as key

Return Value

string

string selectInvoiceForTimeProject(int $socid = -1, string $selected = '', string $htmlname = 'invoiceid', int $maxlength = 24, int $option_only = 0, string $show_empty = '1', int $discard_closed = 0, int $forcefocus = 0, int $disabled = 0, string $morecss = 'maxwidth500', string $projectsListId = '', string $showproject = 'all', User $usertofilter = null)

Output a combo list with invoices for a project

Parameters

int $socid

Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)

string $selected

Id invoice preselected

string $htmlname

Name of HTML select

int $maxlength

Maximum length of label

int $option_only

Return only html options lines without the select tag

string $show_empty

Add an empty line ('1' or string to show for empty line)

int $discard_closed

Discard closed projects (0=Keep,1=hide completely,2=Disable)

int $forcefocus

Force focus on field (works with javascript only)

int $disabled Disabled
string $morecss

More css added to the select component

string $projectsListId

''=Automatic filter on project allowed. List of id=Filter on project ids.

string $showproject

'all' = Show project info, ''=Hide project info

User $usertofilter

User object to use for filtering

Return Value

string

HTML Select Invoice

int selectInvoiceRec(string $selected = '', string $htmlname = 'facrecid', int $maxlength = 24, int $option_only = 0, string $show_empty = '1', int $forcefocus = 0, int $disabled = 0, string $morecss = 'maxwidth500')

Output a combo list with invoices qualified for a third party TODO Bad method. This is used by viewcat.php. We must use a generic method in viewcat to use an ajax search ad remove this one that download all the database.

Parameters

string $selected

Id invoice preselected

string $htmlname

Name of HTML select

int $maxlength

Maximum length of label

int $option_only

Return only html options lines without the select tag

string $show_empty

Add an empty line ('1' or string to show for empty line)

int $forcefocus

Force focus on field (works with javascript only)

int $disabled Disabled
string $morecss

More css added to the select component

Return Value

int

Nbr of project if OK, <0 if KO

string searchComponent(array<array<string, array{type: string}>> $arrayofcriterias, array<int, string> $search_component_params, string[] $arrayofinputfieldsalreadyoutput = array(), string $search_component_params_hidden = '', array<string, array{type: string}> $arrayoffiltercriterias = array())

Output the component to make advanced search criteria

Parameters

array<array<string, array{type: string}>> $arrayofcriterias

Array of available search criteria. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)

array<int, string> $search_component_params

Array of selected search criteria

string[] $arrayofinputfieldsalreadyoutput

Array of input fields already inform. The component will not generate a hidden input field if it is in this list.

string $search_component_params_hidden

String with $search_component_params criteria

array<string, array{type: string}> $arrayoffiltercriterias

Array of available filter criteria for an object and linked objects

Return Value

string

HTML component for advanced search

string selectModelMail(string $prefix, string $modelType = '', int<0, 1> $default = 0, int<0, 1> $addjscombo = 0, int|string $selected = 0, string $morecss = '')

selectModelMail

Parameters

string $prefix Prefix
string $modelType

Model type

int<0, 1> $default

1=Show also Default mail template

int<0, 1> $addjscombo

Add js combobox

int|string $selected

Selected model mail

string $morecss

More css added to the select component

Return Value

string

HTML select string

string buttonsSaveCancel(string $save_label = 'Save', string $cancel_label = 'Cancel', array<array{addclass?: string, name?: string, label_key?: string}> $morebuttons = array(), bool|int<0, 1> $withoutdiv = false, string $morecss = '', string $dol_openinpopup = '')

Output the buttons to submit a creation/edit form

Parameters

string $save_label

Alternative label for save button

string $cancel_label

Alternative label for cancel button

array<array{addclass?: string, name?: string, label_key?: string}> $morebuttons

Add additional buttons between save and cancel

bool|int<0, 1> $withoutdiv

Option to remove enclosing centered div

string $morecss

More CSS

string $dol_openinpopup

If the button are shown in a context of a page shown inside a popup, we put here the string name of popup.

Return Value

string

Html code with the buttons

int load_cache_invoice_subtype()

Load into cache list of invoice subtypes

Return Value

int

Nb of lines loaded, <0 if KO

string getSelectInvoiceSubtype(int $selected = 0, string $htmlname = 'subtypeid', int<0, 1> $addempty = 0, int<0, 1> $noinfoadmin = 0, string $morecss = '')

Return list of invoice subtypes.

Parameters

int $selected

Id of invoice subtype to preselect by default

string $htmlname

Select field name

int<0, 1> $addempty

Add an empty entry

int<0, 1> $noinfoadmin

0=Add admin info, 1=Disable admin info

string $morecss

Add more CSS on select tag

Return Value

string

String for the HTML select component

string getSearchFilterToolInput(string $dataTarget, string $htmlName = 'search-tools-input', string $value = '', mixed[] $params = [])

No description

Parameters

string $dataTarget

a css target like '.element-item-to-search-in' OR '#id-of-parent .class-of-container > .element-item-to-search-in' Ex : search element in a table row : '#table-id tr'

string $htmlName

the html name attribute

string $value

the html value attribute

mixed[] $params

a mixed array of params

Return Value

string

string inputType(string $type, string $name, string $value = '', string $id = '', string $morecss = '', string $moreparam = '', string $label = '', string $addInputLabel = '')

Html for input with label

Parameters

string $type

Type of input : button, checkbox, color, email, hidden, month, number, password, radio, range, tel, text, time, url, week

string $name Name
string $value

[=''] Value

string $id

[=''] Id

string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

string $label

[=''] Label

string $addInputLabel

[=''] Add label for input

Return Value

string

Html for input with label

string inputSelectAjax(string $htmlName, array<string, mixed> $array, string $id, string $ajaxUrl, array<string, string> $ajaxData = [], string $morecss = 'minwidth75', string $moreparam = '')

Html for select with get options by AJAX

Parameters

string $htmlName Name
array<string, mixed> $array

Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...))

string $id

Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record.

string $ajaxUrl

Ajax page Url

array<string, string> $ajaxData

Additional data send to the AJAX page

string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

Return Value

string

Html for input with label

string inputHtml(string $htmlName, string $value, string $morecss = '', string $moreparam = '')

Html for HTML area

Parameters

string $htmlName

Html name

string $value

[=''] Value

string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

Return Value

string

Html for input with label

string inputText(string $htmlName, string $value, string $morecss = '', string $moreparam = '', array<string, mixed> $options = array())

Html for HTML area

Parameters

string $htmlName

Html name

string $value

[=''] Value

string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

array<string, mixed> $options

Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...))

Return Value

string

Html for input with label

string inputRadio(string $htmlName, array<string, string> $options, string $selectedValue, string $morecss = '', string $moreparam = '')

Html for input radio

Parameters

string $htmlName

Html name

array<string, string> $options

List of option

string $selectedValue

Selected value

string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

Return Value

string

Html for input radio

string inputStars(string $htmlName, int $size, int $value, string $morecss = '', string $moreparam = '')

Html for input stars

Parameters

string $htmlName

Html name

int $size

Number of stars

int $value Value
string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

Return Value

string

Html for input stars

string inputIcon(string $htmlName, string $value, string $morecss = '', string $moreparam = '')

Html for input icon

Parameters

string $htmlName

Html name

string $value Value
string $morecss

[=''] Class

string $moreparam

[=''] Add attributes (checked, required, etc)

Return Value

string

Html for input icon

string inputGeoPoint(string $htmlName, string $value, string $type = '')

Html for input geo point

Parameters

string $htmlName

Html name

string $value Value
string $type

Type (linestrg, multipts, point, polygon)

Return Value

string

Html for input geo point

string outputMultiValues(string[] $values)

Html for show selected multiple values

Parameters

string[] $values Values

Return Value

string

Html for show selected multiple values

string outputStars(int $size, int $value)

Html for show stars

Parameters

int $size

Number of stars

int $value Value

Return Value

string

Html for show stars

string outputIcon(string $value)

Html for show icon

Parameters

string $value Value

Return Value

string

Html for show icon

string outputGeoPoint(string $value, string $type)

Html for show geo point

Parameters

string $value Value
string $type

Type (linestrg, multipts, point, polygon)

Return Value

string

Html for show geo point

string getNomUrl(CommonObject $object, int $withpicto = 0, string $option = '', int $maxlength = 0, int $save_lastsearch_value = -1, int $notooltip = 0, string $morecss = '', int $add_label = 0, string $sep = ' - ')

Return link of object

Parameters

CommonObject $object

Object handler

int $withpicto

Add picto into link

string $option

Where point the link ('stock', 'composition', 'category', 'supplier', '')

int $maxlength

Maxlength of ref

int $save_lastsearch_value

-1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking

int $notooltip

No tooltip

string $morecss

''=Add more css on link

int $add_label

0=Default, 1=Add label into string, >1=Add first chars into string

string $sep

' - '=Separator between ref and label if option 'add_label' is set

Return Value

string

String with URL

selectFiscalYear(int $selected = 0, string $htmlname = 'fiscalyear', $useempty = 0, $maxlen = 0, $help = 1)

Return list of fiscal year

Parameters

int $selected

Preselected type

string $htmlname

Name of field in form @param int $useempty Set to 1 if we want an empty value @param int $maxlen Max length of text in combo box @param int $help Add or not the admin help picto @return void|string HTML component with the select

$useempty
$maxlen
$help