dolibarr  9.0.0
html.formother.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
5  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
7  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
8  * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
9  * Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
10  * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
11  * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
38 class FormOther
39 {
40  private $db;
41 
45  public $error;
46 
47 
53  function __construct($db)
54  {
55  $this->db = $db;
56  }
57 
58 
59  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
70  function select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null)
71  {
72  // phpcs:enable
73  $sql = "SELECT rowid, label";
74  $sql.= " FROM ".MAIN_DB_PREFIX."export_model";
75  $sql.= " WHERE type = '".$type."'";
76  if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user;
77  $sql.= " ORDER BY rowid";
78  $result = $this->db->query($sql);
79  if ($result)
80  {
81  print '<select class="flat minwidth200" name="'.$htmlname.'">';
82  if ($useempty)
83  {
84  print '<option value="-1">&nbsp;</option>';
85  }
86 
87  $num = $this->db->num_rows($result);
88  $i = 0;
89  while ($i < $num)
90  {
91  $obj = $this->db->fetch_object($result);
92  if ($selected == $obj->rowid)
93  {
94  print '<option value="'.$obj->rowid.'" selected>';
95  }
96  else
97  {
98  print '<option value="'.$obj->rowid.'">';
99  }
100  print $obj->label;
101  print '</option>';
102  $i++;
103  }
104  print "</select>";
105  }
106  else {
107  dol_print_error($this->db);
108  }
109  }
110 
111 
112  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
122  function select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0)
123  {
124  // phpcs:enable
125  $sql = "SELECT rowid, label";
126  $sql.= " FROM ".MAIN_DB_PREFIX."import_model";
127  $sql.= " WHERE type = '".$type."'";
128  $sql.= " ORDER BY rowid";
129  $result = $this->db->query($sql);
130  if ($result)
131  {
132  print '<select class="flat minwidth200" name="'.$htmlname.'">';
133  if ($useempty)
134  {
135  print '<option value="-1">&nbsp;</option>';
136  }
137 
138  $num = $this->db->num_rows($result);
139  $i = 0;
140  while ($i < $num)
141  {
142  $obj = $this->db->fetch_object($result);
143  if ($selected == $obj->rowid)
144  {
145  print '<option value="'.$obj->rowid.'" selected>';
146  }
147  else
148  {
149  print '<option value="'.$obj->rowid.'">';
150  }
151  print $obj->label;
152  print '</option>';
153  $i++;
154  }
155  print "</select>";
156  }
157  else {
158  dol_print_error($this->db);
159  }
160  }
161 
162 
163  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
171  function select_ecotaxes($selected='', $htmlname='ecotaxe_id')
172  {
173  // phpcs:enable
174  global $langs;
175 
176  $sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,";
177  $sql.= " c.label as country";
178  $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c";
179  $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid";
180  $sql.= " ORDER BY country, e.organization ASC, e.code ASC";
181 
182  dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG);
183  $resql=$this->db->query($sql);
184  if ($resql)
185  {
186  print '<select class="flat" name="'.$htmlname.'">';
187  $num = $this->db->num_rows($resql);
188  $i = 0;
189  print '<option value="-1">&nbsp;</option>'."\n";
190  if ($num)
191  {
192  while ($i < $num)
193  {
194  $obj = $this->db->fetch_object($resql);
195  if ($selected && $selected == $obj->rowid)
196  {
197  print '<option value="'.$obj->rowid.'" selected>';
198  }
199  else
200  {
201  print '<option value="'.$obj->rowid.'">';
202  //print '<option onmouseover="showtip(\''.$obj->label.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
203  }
204  $selectOptionValue = $obj->code.' - '.$obj->label.' : '.price($obj->price).' '.$langs->trans("HT").' ('.$obj->organization.')';
205  print $selectOptionValue;
206  print '</option>';
207  $i++;
208  }
209  }
210  print '</select>';
211  return 0;
212  }
213  else
214  {
215  dol_print_error($this->db);
216  return 1;
217  }
218  }
219 
220 
221  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
230  function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='')
231  {
232  // phpcs:enable
233  global $langs;
234 
235  $out='';
236 
237  $sql = "SELECT r.taux, r.revenuestamp_type";
238  $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c";
239  $sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid";
240  $sql.= " AND c.code = '".$country_code."'";
241 
242  dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG);
243  $resql=$this->db->query($sql);
244  if ($resql)
245  {
246  $out.='<select class="flat" name="'.$htmlname.'">';
247  $num = $this->db->num_rows($resql);
248  $i = 0;
249  $out.='<option value="0">&nbsp;</option>'."\n";
250  if ($num)
251  {
252  while ($i < $num)
253  {
254  $obj = $this->db->fetch_object($resql);
255  if (($selected && $selected == $obj->taux) || $num == 1)
256  {
257  $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>';
258  }
259  else
260  {
261  $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>';
262  //print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
263  }
264  $out.=$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '');
265  $out.='</option>';
266  $i++;
267  }
268  }
269  $out.='</select>';
270  return $out;
271  }
272  else
273  {
274  dol_print_error($this->db);
275  return '';
276  }
277  }
278 
279 
280  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
293  function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0)
294  {
295  // phpcs:enable
296  $return = '<select class="flat" name="'.$htmlname.'" '.($disabled?'disabled':'').'>';
297  if ($showempty) $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'>&nbsp;</option>';
298 
299  for ($i = $start ; $i <= $end ; $i += $increment)
300  {
301  if ($selected != '' && (int) $selected == $i)
302  {
303  $return.= '<option value="'.$i.'" selected>';
304  }
305  else
306  {
307  $return.= '<option value="'.$i.'">';
308  }
309  $return.= $i.' % ';
310  $return.= '</option>';
311  }
312 
313  $return.= '</select>';
314 
315  return $return;
316  }
317 
318  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
331  function select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='')
332  {
333  // phpcs:enable
334  global $conf, $langs;
335  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
336 
337  // For backward compatibility
338  if (is_numeric($type))
339  {
340  dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
341  }
342 
343  // Load list of "categories"
344  $static_categs = new Categorie($this->db);
345  $tab_categs = $static_categs->get_full_arbo($type);
346 
347  $moreforfilter = '';
348  // Enhance with select2
349  if ($conf->use_javascript_ajax)
350  {
351  include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
352  $comboenhancement = ajax_combobox('select_categ_'.$htmlname);
353  $moreforfilter.=$comboenhancement;
354  }
355 
356  // Print a select with each of them
357  $moreforfilter.='<select class="flat minwidth100'.($morecss?' '.$morecss:'').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
358  if ($showempty) $moreforfilter.='<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
359 
360  if (is_array($tab_categs))
361  {
362  foreach ($tab_categs as $categ)
363  {
364  $moreforfilter.='<option value="'.$categ['id'].'"';
365  if ($categ['id'] == $selected) $moreforfilter.=' selected';
366  $moreforfilter.='>'.dol_trunc($categ['fulllabel'],50,'middle').'</option>';
367  }
368  }
369  if ($nocateg)
370  {
371  $langs->load("categories");
372  $moreforfilter.='<option value="-2"'.($selected == -2 ? ' selected':'').'>- '.$langs->trans("NotCategorized").' -</option>';
373  }
374  $moreforfilter.='</select>';
375 
376  return $moreforfilter;
377  }
378 
379 
380  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
392  function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1,$morecss='')
393  {
394  // phpcs:enable
395  global $conf,$langs;
396  $langs->load('users');
397 
398  $out = '';
399  // Enhance with select2
400  if ($conf->use_javascript_ajax)
401  {
402  include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
403 
404  $comboenhancement = ajax_combobox($htmlname);
405  if ($comboenhancement)
406  {
407  $out.=$comboenhancement;
408  }
409  }
410  // Select each sales and print them in a select input
411  $out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
412  if ($showempty) $out.='<option value="0">&nbsp;</option>';
413 
414  // Get list of users allowed to be viewed
415  $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
416  $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
417  $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
418  if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
419  if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_soc = ".$user->societe_id;
420  // Add existing sales representatives of thirdparty of external user
421  if (empty($user->rights->user->user->lire) && $user->societe_id)
422  {
423  $sql_usr.=" UNION ";
424  $sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
425  $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
426  $sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
427  $sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
428  }
429  $sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
430  //print $sql_usr;exit;
431 
432  $resql_usr = $this->db->query($sql_usr);
433  if ($resql_usr)
434  {
435  while ($obj_usr = $this->db->fetch_object($resql_usr))
436  {
437 
438  $out.='<option value="'.$obj_usr->rowid.'"';
439 
440  if ($obj_usr->rowid == $selected) $out.=' selected';
441 
442  $out.='>';
443  $out.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->lastname);
444  // Complete name with more info
445  $moreinfo=0;
446  if (! empty($conf->global->MAIN_SHOW_LOGIN))
447  {
448  $out.=($moreinfo?' - ':' (').$obj_usr->login;
449  $moreinfo++;
450  }
451  if ($showstatus >= 0)
452  {
453  if ($obj_usr->statut == 1 && $showstatus == 1)
454  {
455  $out.=($moreinfo?' - ':' (').$langs->trans('Enabled');
456  $moreinfo++;
457  }
458  if ($obj_usr->statut == 0)
459  {
460  $out.=($moreinfo?' - ':' (').$langs->trans('Disabled');
461  $moreinfo++;
462  }
463  }
464  $out.=($moreinfo?')':'');
465  $out.='</option>';
466  }
467  $this->db->free($resql_usr);
468  }
469  else
470  {
471  dol_print_error($this->db);
472  }
473  $out.='</select>';
474 
475  return $out;
476  }
477 
493  function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0, $filteronprojstatus='', $morecss='')
494  {
495  global $user, $langs;
496 
497  require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
498 
499  //print $modeproject.'-'.$modetask;
500  $task=new Task($this->db);
501  $tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode, '', $filteronprojstatus);
502  if ($tasksarray)
503  {
504  print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
505  if ($useempty) print '<option value="0">&nbsp;</option>';
506  $j=0;
507  $level=0;
508  $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid);
509  print '</select>';
510 
511  print ajax_combobox($htmlname);
512  }
513  else
514  {
515  print '<div class="warning">'.$langs->trans("NoProject").'</div>';
516  }
517  }
518 
531  private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0)
532  {
533  global $langs, $user, $conf;
534 
535  $lastprojectid=0;
536 
537  $numlines=count($lines);
538  for ($i = 0 ; $i < $numlines ; $i++)
539  {
540  if ($lines[$i]->fk_parent == $parent)
541  {
542  $var = !$var;
543 
544  //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
545 
546  // Break on a new project
547  if ($parent == 0) // We are on a task at first level
548  {
549  if ($lines[$i]->fk_project != $lastprojectid) // Break found on project
550  {
551  if ($i > 0) print '<option value="0" disabled>----------</option>';
552  print '<option value="'.$lines[$i]->fk_project.'_0"';
553  if ($selectedproject == $lines[$i]->fk_project) print ' selected';
554  print '>'; // Project -> Task
555  print $langs->trans("Project").' '.$lines[$i]->projectref;
556  if (empty($lines[$i]->public))
557  {
558  print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
559  }
560  else
561  {
562  print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
563  }
564  //print '-'.$parent.'-'.$lines[$i]->fk_project.'-'.$lastprojectid;
565  print "</option>\n";
566 
567  $lastprojectid=$lines[$i]->fk_project;
568  $inc++;
569  }
570  }
571 
572  $newdisablechildoftaskid=$disablechildoftaskid;
573 
574  // Print task
575  if (isset($lines[$i]->id)) // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0
576  {
577  // Check if we must disable entry
578  $disabled=0;
579  if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid)))
580  {
581  $disabled++;
582  if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too
583  }
584 
585  print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"';
586  if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) print ' selected';
587  if ($disabled) print ' disabled';
588  print '>';
589  print $langs->trans("Project").' '.$lines[$i]->projectref;
590  print ' '.$lines[$i]->projectlabel;
591  if (empty($lines[$i]->public))
592  {
593  print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
594  }
595  else
596  {
597  print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
598  }
599  if ($lines[$i]->id) print ' > ';
600  for ($k = 0 ; $k < $level ; $k++)
601  {
602  print "&nbsp;&nbsp;&nbsp;";
603  }
604  print $lines[$i]->ref.' '.$lines[$i]->label."</option>\n";
605  $inc++;
606  }
607 
608  $level++;
609  if ($lines[$i]->id) $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject, $newdisablechildoftaskid);
610  $level--;
611  }
612  }
613  }
614 
615 
624  static function showColor($color, $textifnotdefined='')
625  {
626  $textcolor='FFF';
627  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
628  if(colorIsLight($color)) $textcolor='000';
629 
630  $color = colorArrayToHex(colorStringToArray($color,array()),'');
631 
632  if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';
633  else print $textifnotdefined;
634  }
635 
636  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
649  function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
650  {
651  // phpcs:enable
652  print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors);
653  }
654 
667  static function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
668  {
669  // Deprecation warning
670  if ($form_name) {
671  dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING);
672  }
673 
674  global $langs,$conf;
675 
676  $out='';
677 
678  if (! is_array($arrayofcolors) || count($arrayofcolors) < 1)
679  {
680  $langs->load("other");
681  if (empty($conf->dol_use_jmobile))
682  {
683  $out.= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />';
684  $out.= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
685  $out.= '<script type="text/javascript">
686  jQuery(document).ready(function(){
687  $(\'#colorpicker'.$prefix.'\').jPicker( {
688  window: {
689  title: \''.dol_escape_js($langs->trans("SelectAColor")).'\', /* any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null */
690  effects:
691  {
692  type: \'show\', /* effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade" */
693  speed:
694  {
695  show: \'fast\', /* duration of "show" effect. Acceptable values are "fast", "slow", or time in ms */
696  hide: \'fast\' /* duration of "hide" effect. Acceptable values are "fast", "slow", or time in ms */
697  }
698  },
699  position:
700  {
701  x: \'screenCenter\', /* acceptable values "left", "center", "right", "screenCenter", or relative px value */
702  y: \'center\' /* acceptable values "top", "bottom", "center", or relative px value */
703  },
704  },
705  images: {
706  clientPath: \''.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/images/\',
707  picker: { file: \'../../../../../theme/common/colorpicker.png\', width: 14, height: 14 }
708  },
709  localization: // alter these to change the text presented by the picker (e.g. different language)
710  {
711  text:
712  {
713  title: \''.dol_escape_js($langs->trans("SelectAColor")).'\',
714  newColor: \''.dol_escape_js($langs->trans("New")).'\',
715  currentColor: \''.dol_escape_js($langs->trans("Current")).'\',
716  ok: \''.dol_escape_js($langs->trans("Save")).'\',
717  cancel: \''.dol_escape_js($langs->trans("Cancel")).'\'
718  }
719  }
720  } ); });
721  </script>';
722  }
723  $out.= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss?' '.$morecss:'').'" type="text" value="'.$set_color.'" />';
724  }
725  else // In most cases, this is not used. We used instead function with no specific list of colors
726  {
727  if (empty($conf->dol_use_jmobile))
728  {
729  $out.= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />';
730  $out.= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>';
731  $out.= '<script type="text/javascript">
732  jQuery(document).ready(function(){
733  jQuery(\'#colorpicker'.$prefix.'\').colorpicker({
734  size: 14,
735  label: \'\',
736  hide: true
737  });
738  });
739  </script>';
740  }
741  $out.= '<select id="colorpicker'.$prefix.'" class="flat'.($morecss?' '.$morecss:'').'" name="'.$prefix.'">';
742  //print '<option value="-1">&nbsp;</option>';
743  foreach ($arrayofcolors as $val)
744  {
745  $out.= '<option value="'.$val.'"';
746  if ($set_color == $val) $out.= ' selected';
747  $out.= '>'.$val.'</option>';
748  }
749  $out.= '</select>';
750  }
751 
752  return $out;
753  }
754 
755  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
766  function CreateColorIcon($color,$module,$name,$x='12',$y='12')
767  {
768  // phpcs:enable
769  global $conf;
770 
771  $file = $conf->$module->dir_temp.'/'.$name.'.png';
772 
773  // On cree le repertoire contenant les icones
774  if (! file_exists($conf->$module->dir_temp))
775  {
776  dol_mkdir($conf->$module->dir_temp);
777  }
778 
779  // On cree l'image en vraies couleurs
780  $image = imagecreatetruecolor($x,$y);
781 
782  $color = substr($color,1,6);
783 
784  $rouge = hexdec(substr($color,0,2)); //conversion du canal rouge
785  $vert = hexdec(substr($color,2,2)); //conversion du canal vert
786  $bleu = hexdec(substr($color,4,2)); //conversion du canal bleu
787 
788  $couleur = imagecolorallocate($image,$rouge,$vert,$bleu);
789  //print $rouge.$vert.$bleu;
790  imagefill($image,0,0,$couleur); //on remplit l'image
791  // On cree la couleur et on l'attribue a une variable pour ne pas la perdre
792  ImagePng($image,$file); //renvoie une image sous format png
793  ImageDestroy($image);
794  }
795 
796  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
805  function select_dayofweek($selected='',$htmlname='weekid',$useempty=0)
806  {
807  // phpcs:enable
808  global $langs;
809 
810  $week = array(
811  0=>$langs->trans("Day0"),
812  1=>$langs->trans("Day1"),
813  2=>$langs->trans("Day2"),
814  3=>$langs->trans("Day3"),
815  4=>$langs->trans("Day4"),
816  5=>$langs->trans("Day5"),
817  6=>$langs->trans("Day6")
818  );
819 
820  $select_week = '<select class="flat" name="'.$htmlname.'">';
821  if ($useempty)
822  {
823  $select_week .= '<option value="-1">&nbsp;</option>';
824  }
825  foreach ($week as $key => $val)
826  {
827  if ($selected == $key)
828  {
829  $select_week .= '<option value="'.$key.'" selected>';
830  }
831  else
832  {
833  $select_week .= '<option value="'.$key.'">';
834  }
835  $select_week .= $val;
836  $select_week .= '</option>';
837  }
838  $select_week .= '</select>';
839  return $select_week;
840  }
841 
842  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
853  function select_month($selected='', $htmlname='monthid', $useempty=0, $longlabel=0, $morecss='')
854  {
855  // phpcs:enable
856  global $langs;
857 
858  require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
859 
860  if ($longlabel) $montharray = monthArray($langs, 0); // Get array
861  else $montharray = monthArray($langs, 1);
862 
863  $select_month = '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
864  if ($useempty)
865  {
866  $select_month .= '<option value="0">&nbsp;</option>';
867  }
868  foreach ($montharray as $key => $val)
869  {
870  if ($selected == $key)
871  {
872  $select_month .= '<option value="'.$key.'" selected>';
873  }
874  else
875  {
876  $select_month .= '<option value="'.$key.'">';
877  }
878  $select_month .= $val;
879  $select_month .= '</option>';
880  }
881  $select_month .= '</select>';
882  return $select_month;
883  }
884 
885  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
900  function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto')
901  {
902  // phpcs:enable
903  print $this->selectyear($selected,$htmlname,$useempty,$min_year,$max_year,$offset,$invert,$option,$morecss);
904  }
905 
920  function selectyear($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto')
921  {
922  $out='';
923 
924  $currentyear = date("Y")+$offset;
925  $max_year = $currentyear+$max_year;
926  $min_year = $currentyear-$min_year;
927  if(empty($selected) && empty($useempty)) $selected = $currentyear;
928 
929  $out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
930  if($useempty)
931  {
932  $selected_html='';
933  if ($selected == '') $selected_html = ' selected';
934  $out.= '<option value=""' . $selected_html . '>&nbsp;</option>';
935  }
936  if (! $invert)
937  {
938  for ($y = $max_year; $y >= $min_year; $y--)
939  {
940  $selected_html='';
941  if ($selected > 0 && $y == $selected) $selected_html = ' selected';
942  $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
943  }
944  }
945  else
946  {
947  for ($y = $min_year; $y <= $max_year; $y++)
948  {
949  $selected_html='';
950  if ($selected > 0 && $y == $selected) $selected_html = ' selected';
951  $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>';
952  }
953  }
954  $out.= "</select>\n";
955 
956  return $out;
957  }
958 
959  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
971  function form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='')
972  {
973  // phpcs:enable
974  global $langs,$conf;
975  global $form;
976 
977  if ($htmlname != "none")
978  {
979  print '<form method="post" action="'.$page.'">';
980  print '<input type="hidden" name="action" value="setaddress">';
981  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
982  $form->select_address($selected, $socid, $htmlname, 1);
983  print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
984  $langs->load("companies");
985  print ' &nbsp; <a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$originid.'>'.$langs->trans("AddAddress").'</a>';
986  print '</form>';
987  }
988  else
989  {
990  if ($selected)
991  {
992  require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php';
993  $address=new Address($this->db);
994  $result=$address->fetch_address($selected);
995  print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>';
996  }
997  else
998  {
999  print "&nbsp;";
1000  }
1001  }
1002  }
1003 
1004 
1005 
1014  static function getBoxesArea($user,$areacode)
1015  {
1016  global $conf,$langs,$db;
1017 
1018  include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
1019 
1020  $confuserzone='MAIN_BOXES_'.$areacode;
1021 
1022  // $boxactivated will be array of boxes enabled into global setup
1023  // $boxidactivatedforuser will be array of boxes choosed by user
1024 
1025  $selectboxlist='';
1026  $boxactivated=InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone)?null:$user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup)
1027 
1028  $boxidactivatedforuser=array();
1029  foreach($boxactivated as $box)
1030  {
1031  if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
1032  }
1033 
1034  // Define selectboxlist
1035  $arrayboxtoactivatelabel=array();
1036  if (! empty($user->conf->$confuserzone))
1037  {
1038  $boxorder='';
1039  $langs->load("boxes"); // Load label of boxes
1040  foreach($boxactivated as $box)
1041  {
1042  if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
1043  $label=$langs->transnoentitiesnoconv($box->boxlabel);
1044  //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
1045  if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone')
1046  {
1047  $label=$label.' <span class="fa fa-bar-chart"></span>';
1048  }
1049  $arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list
1050  }
1051  foreach($boxidactivatedforuser as $boxid)
1052  {
1053  if (empty($boxorder)) $boxorder.='A:';
1054  $boxorder.=$boxid.',';
1055  }
1056 
1057  //var_dump($boxidactivatedforuser);
1058 
1059  // Class Form must have been already loaded
1060  $selectboxlist.='<!-- Form with select box list -->'."\n";
1061  $selectboxlist.='<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
1062  $selectboxlist.='<input type="hidden" name="addbox" value="addbox">';
1063  $selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">';
1064  $selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">';
1065  $selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">';
1066  $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1);
1067  if (empty($conf->use_javascript_ajax)) $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">';
1068  $selectboxlist.='</form>';
1069  if (! empty($conf->use_javascript_ajax))
1070  {
1071  include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1072  $selectboxlist.=ajax_combobox("boxcombo");
1073  }
1074  }
1075 
1076  // Javascript code for dynamic actions
1077  if (! empty($conf->use_javascript_ajax))
1078  {
1079  $selectboxlist.='<script type="text/javascript" language="javascript">
1080 
1081  // To update list of activated boxes
1082  function updateBoxOrder(closing) {
1083  var left_list = cleanSerialize(jQuery("#boxhalfleft").sortable("serialize"));
1084  var right_list = cleanSerialize(jQuery("#boxhalfright").sortable("serialize"));
1085  var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
1086  if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title
1087  {
1088  jQuery.ajax({
1089  url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=0&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
1090  async: false
1091  });
1092  // We force reload to be sure to get all boxes into list
1093  window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=delbox\';
1094  }
1095  else
1096  {
1097  jQuery.ajax({
1098  url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=\'+closing+\'&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
1099  async: true
1100  });
1101  }
1102  }
1103 
1104  jQuery(document).ready(function() {
1105  jQuery("#boxcombo").change(function() {
1106  var boxid=jQuery("#boxcombo").val();
1107  if (boxid > 0) {
1108  var left_list = cleanSerialize(jQuery("#boxhalfleft").sortable("serialize"));
1109  var right_list = cleanSerialize(jQuery("#boxhalfright").sortable("serialize"));
1110  var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
1111  jQuery.ajax({
1112  url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&boxid=\'+boxid+\'&zone='.$areacode.'&userid='.$user->id.'\',
1113  async: false
1114  });
1115  window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=addbox&boxid=\'+boxid;
1116  }
1117  });';
1118  if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();';
1119  $selectboxlist.='
1120 
1121  jQuery("#boxhalfleft, #boxhalfright").sortable({
1122  handle: \'.boxhandle\',
1123  revert: \'invalid\',
1124  items: \'.boxdraggable\',
1125  containment: \'document\',
1126  connectWith: \'#boxhalfleft, #boxhalfright\',
1127  stop: function(event, ui) {
1128  updateBoxOrder(1); /* 1 to avoid message after a move */
1129  }
1130  });
1131 
1132  jQuery(".boxclose").click(function() {
1133  var self = this; // because JQuery can modify this
1134  var boxid=self.id.substring(8);
1135  var label=jQuery(\'#boxlabelentry\'+boxid).val();
1136  console.log("We close box "+boxid);
1137  jQuery(\'#boxto_\'+boxid).remove();
1138  if (boxid > 0) jQuery(\'#boxcombo\').append(new Option(label, boxid));
1139  updateBoxOrder(1); /* 1 to avoid message after a remove */
1140  });
1141 
1142  });'."\n";
1143 
1144  $selectboxlist.='</script>'."\n";
1145  }
1146 
1147  // Define boxlista and boxlistb
1148  $nbboxactivated=count($boxidactivatedforuser);
1149 
1150  if ($nbboxactivated)
1151  {
1152  // Load translation files required by the page
1153  $langs->loadLangs(array("boxes","projects"));
1154 
1155  $emptybox=new ModeleBoxes($db);
1156 
1157  $boxlista.="\n<!-- Box left container -->\n";
1158 
1159  // Define $box_max_lines
1160  $box_max_lines=5;
1161  if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
1162 
1163  $ii=0;
1164  foreach ($boxactivated as $key => $box)
1165  {
1166  if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
1167  if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0
1168  if (preg_match('/^A/i',$box->box_order)) // column A
1169  {
1170  $ii++;
1171  //print 'box_id '.$boxactivated[$ii]->box_id.' ';
1172  //print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
1173  // Show box
1174  $box->loadBox($box_max_lines);
1175  $boxlista.= $box->outputBox();
1176  }
1177  }
1178 
1179  if ($conf->browser->layout != 'phone')
1180  {
1181  $emptybox->box_id='A';
1182  $emptybox->info_box_head=array();
1183  $emptybox->info_box_contents=array();
1184  $boxlista.= $emptybox->outputBox(array(),array());
1185  }
1186  $boxlista.= "<!-- End box left container -->\n";
1187 
1188  $boxlistb.= "\n<!-- Box right container -->\n";
1189 
1190  $ii=0;
1191  foreach ($boxactivated as $key => $box)
1192  {
1193  if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue;
1194  if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0
1195  if (preg_match('/^B/i',$box->box_order)) // colonne B
1196  {
1197  $ii++;
1198  //print 'box_id '.$boxactivated[$ii]->box_id.' ';
1199  //print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
1200  // Show box
1201  $box->loadBox($box_max_lines);
1202  $boxlistb.= $box->outputBox();
1203  }
1204  }
1205 
1206  if ($conf->browser->layout != 'phone')
1207  {
1208  $emptybox->box_id='B';
1209  $emptybox->info_box_head=array();
1210  $emptybox->info_box_contents=array();
1211  $boxlistb.= $emptybox->outputBox(array(),array());
1212  }
1213 
1214  $boxlistb.= "<!-- End box right container -->\n";
1215  }
1216 
1217  return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
1218  }
1219 
1220 
1221  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
1234  function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0,$moreattrib='')
1235  {
1236  // phpcs:enable
1237  global $langs, $conf;
1238 
1239  $langs->load("admin");
1240 
1241  $sql = "SELECT rowid, ".$keyfield.", ".$labelfield;
1242  $sql.= " FROM ".MAIN_DB_PREFIX.$dictionarytable;
1243  $sql.= " ORDER BY ".$labelfield;
1244 
1245  dol_syslog(get_class($this)."::select_dictionary", LOG_DEBUG);
1246  $result = $this->db->query($sql);
1247  if ($result)
1248  {
1249  $num = $this->db->num_rows($result);
1250  $i = 0;
1251  if ($num)
1252  {
1253  print '<select id="select'.$htmlname.'" class="flat selectdictionary" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
1254  if ($useempty == 1 || ($useempty == 2 && $num > 1))
1255  {
1256  print '<option value="-1">&nbsp;</option>';
1257  }
1258 
1259  while ($i < $num)
1260  {
1261  $obj = $this->db->fetch_object($result);
1262  if ($selected == $obj->rowid || $selected == $obj->$keyfield)
1263  {
1264  print '<option value="'.$obj->$keyfield.'" selected>';
1265  }
1266  else
1267  {
1268  print '<option value="'.$obj->$keyfield.'">';
1269  }
1270  print $obj->$labelfield;
1271  print '</option>';
1272  $i++;
1273  }
1274  print "</select>";
1275  }
1276  else
1277  {
1278  print $langs->trans("DictionaryEmpty");
1279  }
1280  }
1281  else {
1282  dol_print_error($this->db);
1283  }
1284  }
1285 }
print $object label
hash of file content (md5_file(dol_osencode($destfull))
Definition: edit.php:153
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
Convert a html select field into an ajax combobox.
Definition: ajax.lib.php:374
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->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) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
static showColor($color, $textifnotdefined='')
Output a HTML thumb of color or a text if not defined.
selectyear($selected='', $htmlname='yearid', $useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto')
Return HTML combo list of years.
select_percent($selected=0, $htmlname='percent', $disabled=0, $increment=5, $start=0, $end=100, $showempty=0)
Return a HTML select list to select a percent.
form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='')
Show form to select address.
select_ecotaxes($selected='', $htmlname='ecotaxe_id')
Return list of ecotaxes with label.
select_dictionary($htmlname, $dictionarytable, $keyfield='code', $labelfield='label', $selected='', $useempty=0, $moreattrib='')
Return a HTML select list of a dictionary.
static selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
Output a HTML code to select a color.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
__construct($db)
Constructor.
select_year($selected='', $htmlname='yearid', $useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto')
Return HTML combo list of years.
select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='')
Return list of revenue stamp for country.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class ModeleBoxes.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value (&#39;FFFFFF&#39;, &#39;255,255,255&#39;) into an array RGB array(255,255,255).
select_dayofweek($selected='', $htmlname='weekid', $useempty=0)
Return HTML combo list of week.
select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0)
Return list of export models.
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
type
Definition: viewcat.php:284
Class to manage categories.
_pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0)
Write lines of a project (all lines of a project if parent = 0)
Classe permettant la generation de composants html autre Only common components are here...
static listBoxes($db, $mode, $zone, $user=null, $excludelist=array(), $includehidden=1)
Return array of boxes qualified for area and user.
if(GETPOST('cancel', 'alpha')) if(! GETPOST( 'confirmmassaction', 'alpha') &&$massaction !='presend' &&$massaction !='confirm_presend')
Draft customers invoices.
Definition: list.php:156
monthArray($outputlangs, $short=0)
Return array of translated months or selected month.
Definition: date.lib.php:939
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0, $filteronprojstatus='', $morecss='')
Return list of project and tasks.
select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null)
Return HTML select list of export models.
Class to manage tasks.
Definition: task.class.php:33
select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
Output a HTML code to select a color.
colorArrayToHex($arraycolor, $colorifnotfound='888888')
Convert an array with RGB value into hex RGB value.
select_salesrepresentatives($selected, $htmlname, $user, $showstatus=0, $showempty=1, $morecss='')
Return select list for categories (to use in form search selectors)
select_month($selected='', $htmlname='monthid', $useempty=0, $longlabel=0, $morecss='')
Return HTML combo list of month.
colorIsLight($stringcolor)
Return true if the color is light.
Class to manage addresses.
static getBoxesArea($user, $areacode)
Get array with HTML tabs with boxes of a particular area including personalized choices of user...
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='')
Return select list for categories (to use in form search selectors)