64 public function select_interventions($socid = -1, $selected = 0, $htmlname =
'interventionid', $maxlength = 16, $showempty = 1, $draftonly =
false)
67 global $user,
$conf, $langs;
71 $hideunselectables =
false;
74 $sql =
"SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
75 $sql .=
" FROM ".$this->db->prefix().
"fichinter as f";
76 $sql .=
" WHERE f.entity = ".$conf->entity;
79 $sql .=
" AND (f.fk_soc = 0 OR f.fk_soc IS NULL)";
81 $sql .=
" AND f.fk_soc = ".((int) $socid);
85 $sql .=
" AND f.fk_statut = 0";
88 dol_syslog(get_class($this).
"::select_intervention", LOG_DEBUG);
89 $resql = $this->db->query($sql);
91 $out .=
'<select id="'.dol_escape_htmltag($htmlname).
'" class="flat" name="'.
dol_escape_htmltag($htmlname).
'">';
93 $out .=
'<option value="0">';
94 if (!is_numeric($showempty)) {
101 $num = $this->db->num_rows($resql);
105 $obj = $this->db->fetch_object($resql);
107 if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight(
'societe',
'lire')) {
111 if (!empty($selected) && $selected == $obj->rowid && $obj->status > 0) {
112 $out .=
'<option value="'.$obj->rowid.
'" selected>'.$labeltoshow.
'</option>';
115 if (!$obj->status > 0 && ! $draftonly) {
117 $labeltoshow .=
' ('.$langs->trans(
"Draft").
')';
119 if ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
121 $labeltoshow .=
' - '.$langs->trans(
"LinkedToAnotherCompany");
124 if ($hideunselectables && $disabled) {
127 $resultat =
'<option value="'.$obj->rowid.
'"';
129 $resultat .=
' disabled';
131 $resultat .=
'>'.$labeltoshow;
132 $resultat .=
'</option>';
141 $this->db->free($resql);
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...