23require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
60 public function selectFiscalYear($selected = 0, $htmlname =
'fiscalyear', $useempty = 0, $maxlen = 0, $help = 1)
66 $sql =
"SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut as status";
67 $sql .=
" FROM ".$this->db->prefix().
"accounting_fiscalyear as f";
68 $sql .=
" WHERE f.entity = ".$conf->entity;
69 $sql .=
" ORDER BY f.date_start ASC";
71 dol_syslog(get_class($this).
'::'.__METHOD__, LOG_DEBUG);
72 $resql = $this->db->query($sql);
74 $num = $this->db->num_rows($resql);
76 $out .=
'<select class="flat minwidth200" id="'.$htmlname.
'" name="'.$htmlname.
'">';
80 $out .=
'<option value="0"> </option>';
83 $obj = $this->db->fetch_object($resql);
85 $titletoshowhtml = ($maxlen ?
dol_trunc($obj->label, $maxlen) : $obj->label).
' <span class="opacitymedium">('.$obj->date_start .
" - " . $obj->date_end.
')</span>';
86 $titletoshow = ($maxlen ?
dol_trunc($obj->label, $maxlen) : $obj->label).
' <span class="opacitymedium">('.$langs->transnoentitiesnoconv(
"FiscalYearFromTo", $obj->date_start, $obj->date_end).
')</span>';
88 $out .=
'<option value="'.$obj->rowid.
'"';
89 if ($obj->rowid == $selected) {
93 $out .=
' data-html="'.dolPrintHTMLForAttribute($titletoshowhtml).
'"';
104 $out .=
'<span class="opacitymedium">'.$langs->trans(
"ErrorNoFiscalyearDefined", $langs->transnoentitiesnoconv(
"Accounting"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Fiscalyear")).
'</span>';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...