65 public function select_interventions($socid = -1, $selected = 0, $htmlname =
'interventionid', $maxlength = 16, $showempty =
'1', $draftonly =
false)
68 global $user,
$conf, $langs;
72 $hideunselectables =
false;
75 $sql =
"SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status";
76 $sql .=
" FROM ".$this->db->prefix().
"fichinter as f";
77 $sql .=
" WHERE f.entity = ".$conf->entity;
80 $sql .=
" AND (f.fk_soc = 0 OR f.fk_soc IS NULL)";
82 $sql .=
" AND f.fk_soc = ".((int) $socid);
86 $sql .=
" AND f.fk_statut = 0";
89 dol_syslog(get_class($this).
"::select_intervention", LOG_DEBUG);
90 $resql = $this->db->query($sql);
92 $out .=
'<select id="'.dol_escape_htmltag($htmlname).
'" class="flat" name="'.
dol_escape_htmltag($htmlname).
'">';
94 $out .=
'<option value="0">';
95 if (!is_numeric($showempty)) {
102 $num = $this->db->num_rows($resql);
106 $obj = $this->db->fetch_object($resql);
108 if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight(
'societe',
'lire')) {
112 if (!empty($selected) && $selected == $obj->rowid && $obj->status > 0) {
113 $out .=
'<option value="'.$obj->rowid.
'" selected>'.$labeltoshow.
'</option>';
116 if (!$obj->status > 0 && ! $draftonly) {
118 $labeltoshow .=
' ('.$langs->trans(
"Draft").
')';
120 if ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
122 $labeltoshow .=
' - '.$langs->trans(
"LinkedToAnotherCompany");
125 if ($hideunselectables && $disabled) {
128 $resultat =
'<option value="'.$obj->rowid.
'"';
130 $resultat .=
' disabled';
132 $resultat .=
'>'.$labeltoshow;
133 $resultat .=
'</option>';
142 $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...