62 $options_array = array();
64 $sql =
"SELECT code, label";
65 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
66 $sql .=
" WHERE active > 0";
67 $sql .=
" ORDER BY sortorder";
74 $obj = $this->
db->fetch_object(
$resql);
76 $level = $langs->trans($obj->code);
77 if ($level == $obj->code)
78 $level = $langs->trans($obj->label);
79 $options_array[$obj->code] = $level;
100 $langs->load(
"dict");
104 $countryArray = array();
107 $options_array = array();
109 $sql =
"SELECT rowid, code as code_iso, label";
110 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_country";
111 $sql .=
" WHERE active = 1 AND code<>''";
112 $sql .=
" ORDER BY code ASC";
119 $foundselected =
false;
122 $obj = $this->
db->fetch_object(
$resql);
123 $countryArray [$i] [
'rowid'] = $obj->rowid;
124 $countryArray [$i] [
'code_iso'] = $obj->code_iso;
125 $countryArray [$i] [
'label'] = ($obj->code_iso && $langs->transnoentitiesnoconv(
"Country".$obj->code_iso) !=
"Country".$obj->code_iso ? $langs->transnoentitiesnoconv(
"Country".$obj->code_iso) : ($obj->label !=
'-' ? $obj->label :
''));
126 $label[$i] = $countryArray[$i][
'label'];
130 array_multisort($label, SORT_ASC, $countryArray);
132 foreach ($countryArray as $row) {
133 $label =
dol_trunc($row[
'label'], $maxlength,
'middle');
134 if ($row[
'code_iso'])
135 $label .=
' ('.$row[
'code_iso'].
')';
137 $options_array[$row[
'rowid']] = $label;
160 $options_array = array();
163 $sql_usr .=
"SELECT DISTINCT u2.rowid, u2.lastname as name, u2.firstname, u2.login";
164 $sql_usr .=
" FROM ".MAIN_DB_PREFIX.
"user as u2, ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
165 $sql_usr .=
" WHERE u2.entity IN (0,".$conf->entity.
")";
166 $sql_usr .=
" AND u2.rowid = sc.fk_user ";
168 if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX))
169 $sql_usr .=
" AND u2.statut<>0 ";
170 $sql_usr .=
" ORDER BY name ASC";
173 $resql_usr = $this->
db->query($sql_usr);
175 while ($obj_usr = $this->
db->fetch_object($resql_usr)) {
176 $label = $obj_usr->firstname.
" ".$obj_usr->name.
" (".$obj_usr->login.
')';
178 $options_array [$obj_usr->rowid] = $label;
180 $this->
db->free($resql_usr);
198 global $conf, $langs;
200 $options_array = array();
202 $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
204 foreach ($langs_available as $key => $value)
207 $options_array[$key] = $label;
209 asort($options_array);
224 $options_array = array();
226 if (is_array($sqlqueryparam))
228 $param_list = array_keys($sqlqueryparam);
229 $InfoFieldList = explode(
":", $param_list [0]);
238 if (count($InfoFieldList) >= 3) {
239 if (strpos($InfoFieldList [3],
'extra.') !==
false) {
240 $keyList =
'main.'.$InfoFieldList [2].
' as rowid';
242 $keyList = $InfoFieldList [2].
' as rowid';
246 $sql =
'SELECT '.$keyList.
', '.$InfoFieldList [1];
247 $sql .=
' FROM '.MAIN_DB_PREFIX.$InfoFieldList [0];
248 if (!empty($InfoFieldList [3])) {
250 if (strpos($InfoFieldList [3],
'extra') !==
false) {
251 $sql .=
' as main, '.MAIN_DB_PREFIX.$InfoFieldList [0].
'_extrafields as extra';
252 $sql .=
' WHERE extra.fk_object=main.'.$InfoFieldList [2].
' AND '.$InfoFieldList [3];
254 $sql .=
' WHERE '.$InfoFieldList [3];
257 if (!empty($InfoFieldList[1])) {
258 $sql .=
" ORDER BY nom";
268 $obj = $this->
db->fetch_object(
$resql);
269 $labeltoshow =
dol_trunc($obj->$InfoFieldList [1], 90);
270 $options_array[$obj->rowid] = $labeltoshow;
290 global $conf, $langs, $user;
291 $langs->load(
"dict");
293 $options_array = array();
295 $sql =
"SELECT rowid, code, label as civilite, active FROM ".MAIN_DB_PREFIX.
"c_civility";
296 $sql .=
" WHERE active = 1";
308 $obj = $this->
db->fetch_object(
$resql);
310 $label = ($langs->trans(
"Civility".$obj->code) !=
"Civility".$obj->code ? $langs->trans(
"Civility".$obj->code) : ($obj->civilite !=
'-' ? $obj->civilite :
''));
312 $options_array[$obj->code] = $label;
333 public function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0)
335 global $conf, $langs;
337 $form =
new Form($this->
db);
338 $return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0,
'', 0, 295);
354 global $conf, $user, $langs;
358 $sql =
"SELECT c.rowid, c.name, c.fk_element";
359 $sql .=
" FROM ".MAIN_DB_PREFIX.
"advtargetemailing as c";
360 $sql .=
" WHERE type_element='$type_element'";
361 $sql .=
" ORDER BY c.name";
366 $out .=
'<select id="'.$htmlname.
'" class="flat'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'">';
368 $out .=
'<option value=""></option>';
373 $obj = $this->
db->fetch_object(
$resql);
376 $label = $obj->fk_element;
379 if ($selected > 0 && $selected == $obj->rowid) {
380 $out .=
'<option value="'.$obj->rowid.
'" selected="selected">'.$label.
'</option>';
382 $out .=
'<option value="'.$obj->rowid.
'">'.$label.
'</option>';
$conf db
API class for accounts.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.