64 public function select_interventions($socid = -1, $selected =
'', $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";
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);
84 if ($draftonly) $sql .=
" AND f.fk_statut = 0";
86 dol_syslog(get_class($this).
"::select_intervention", LOG_DEBUG);
87 $resql = $this->db->query($sql);
89 $out .=
'<select id="interventionid" class="flat" name="'.dol_escape_htmltag($htmlname).
'">';
91 $out .=
'<option value="0">';
92 if (!is_numeric($showempty)) $out .= $showempty;
93 else $out .=
' ';
96 $num = $this->db->num_rows($resql);
100 $obj = $this->db->fetch_object($resql);
102 if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight(
'societe',
'lire')) {
106 if (!empty($selected) && $selected == $obj->rowid && $obj->statut > 0) {
107 $out .=
'<option value="'.$obj->rowid.
'" selected>'.$labeltoshow.
'</option>';
110 if (!$obj->fk_statut > 0 && ! $draftonly) {
112 $labeltoshow .=
' ('.$langs->trans(
"Draft").
')';
114 if ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
116 $labeltoshow .=
' - '.$langs->trans(
"LinkedToAnotherCompany");
119 if ($hideunselectables && $disabled) {
122 $resultat =
'<option value="'.$obj->rowid.
'"';
124 $resultat .=
' disabled';
126 $resultat .=
'>'.$labeltoshow;
127 $resultat .=
'</option>';
136 $this->db->free($resql);
dol_print_error($db='', $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.