29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
46 public $errors = array();
88 public function select_projects($socid = -1, $selected =
'', $htmlname =
'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey =
'', $nooutput = 0, $forceaddid = 0, $morecss =
'', $htmlid =
'', $morefilter =
'')
91 global $langs,
$conf, $form;
93 $selected_input_value =
'';
94 if (is_object($selected)) {
95 $selected_input_value = $selected->ref;
96 $selected = $selected->id;
104 if ($selected && empty($selected_input_value)) {
105 require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
106 $project =
new Project($this->db);
107 $project->fetch($selected);
108 $selected_input_value = $project->ref;
110 $urloption =
'socid=' . ((int) $socid) .
'&htmlname=' . urlencode($htmlname) .
'&discardclosed=' . ((int) $discard_closed);
111 if ($morefilter ==
'usage_organize_event=1') {
112 $urloption .=
'&usage_organize_event=1';
114 $out .=
'<input type="text" class="minwidth200' . ($morecss ?
' ' . $morecss :
'') .
'" name="search_' . $htmlname .
'" id="search_' . $htmlname .
'" value="' . $selected_input_value .
'"' . $placeholder .
' />';
116 $out .=
ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT .
'/projet/ajax/projects.php', $urloption,
$conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array());
118 $out .= $this->
select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss, $morefilter);
120 if ($discard_closed > 0) {
122 $out .= $form->textwithpicto(
'', $langs->trans(
"ClosedProjectsAreHidden"));
126 if (empty($nooutput)) {
158 public function select_projects_list($socid = -1, $selected = 0, $htmlname =
'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey =
'', $nooutput = 0, $forceaddid = 0, $htmlid =
'', $morecss =
'maxwidth500', $morefilter =
'')
161 global $user,
$conf, $langs;
163 require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
165 if (empty($htmlid)) {
172 $hideunselectables =
false;
174 $hideunselectables =
true;
176 if (
getDolGlobalInt(
'PROJECT_ALWAYS_DISCARD_CLOSED_PROJECTS_IN_SELECT')) {
180 $projectsListId =
false;
181 if (!$user->hasRight(
'projet',
'all',
'lire')) {
182 $projectstatic =
new Project($this->db);
183 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
187 $sql =
"SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias";
188 $sql .=
" FROM " . $this->db->prefix() .
"projet as p LEFT JOIN " . $this->db->prefix() .
"societe as s ON s.rowid = p.fk_soc";
189 $sql .=
" WHERE p.entity IN (" .
getEntity(
'project') .
")";
190 if ($projectsListId !==
false) {
191 $sql .=
" AND p.rowid IN (" . $this->db->sanitize($projectsListId) .
")";
194 $sql .=
" AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
198 $sql .=
" AND (p.fk_soc=" . ((int) $socid) .
" OR p.fk_soc IS NULL)";
200 $sql .=
" AND (p.fk_soc IN (" . $this->db->sanitize(((
int) $socid) .
", " .
getDolGlobalString(
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) .
") OR p.fk_soc IS NULL)";
203 if (!empty($filterkey)) {
207 $sql .=
' AND (' . $this->db->sanitize($morefilter, 0, 1) .
')';
209 $sql .=
" ORDER BY p.ref ASC";
211 $resql = $this->db->query($sql);
213 if (!empty(
$conf->use_javascript_ajax)) {
214 $morecss .=
' minwidth100';
216 if (empty($option_only)) {
217 $out .=
'<select class="flat' . ($morecss ?
' ' . $morecss :
'') .
'"' . ($disabled ?
' disabled="disabled"' :
'') .
' id="' . $htmlid .
'" name="' . $htmlname .
'">';
219 if (!empty($show_empty)) {
220 if (is_numeric($show_empty)) {
221 $out .=
'<option value="0"> </option>';
223 $out .=
'<option value="-1">'.$show_empty.
'</option>';
226 $num = $this->db->num_rows($resql);
230 $obj = $this->db->fetch_object($resql);
232 if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight(
'societe',
'lire')) {
235 if ($discard_closed == 1 && $obj->fk_statut == 2 && $obj->rowid != $selected) {
243 $labeltoshow .=
', ' .
dol_trunc($obj->title, $maxlength);
245 $labeltoshow .=
' - ' . $obj->name;
246 if ($obj->name_alias) {
247 $labeltoshow .=
' (' . $obj->name_alias .
')';
252 if ($obj->fk_statut == 0) {
254 $labeltoshow .=
' - ' . $langs->trans(
"Draft");
255 } elseif ($obj->fk_statut == 2) {
256 if ($discard_closed == 2) {
259 $labeltoshow .=
' - ' . $langs->trans(
"Closed");
260 } elseif (!
getDolGlobalString(
'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
262 $labeltoshow .=
' - ' . $langs->trans(
"LinkedToAnotherCompany");
265 if (!empty($selected) && $selected == $obj->rowid) {
266 $out .=
'<option value="' . $obj->rowid .
'" selected';
268 $out .=
'>' . $labeltoshow .
'</option>';
270 if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
273 $resultat =
'<option value="' . $obj->rowid .
'"';
275 $resultat .=
' disabled';
280 $resultat .= $labeltoshow;
281 $resultat .=
'</option>';
286 'key' => (
int) $obj->rowid,
287 'value' => $obj->ref,
289 'labelx' => $labeltoshow,
290 'label' => ($disabled ?
'<span class="opacitymedium">' . $labeltoshow .
'</span>' : $labeltoshow),
291 'disabled' => (
bool) $disabled
299 $this->db->free($resql);
302 if (empty($option_only)) {
307 if (!empty(
$conf->use_javascript_ajax)) {
308 include_once DOL_DOCUMENT_ROOT .
'/core/lib/ajax.lib.php';
309 $comboenhancement =
ajax_combobox($htmlid, array(), 0, $forcefocus);
310 $out .= $comboenhancement;
311 $morecss .=
' minwidth100';
314 if (empty($nooutput)) {
349 public function selectTasks($socid = -1, $selected = 0, $htmlname =
'taskid', $maxlength = 24, $option_only = 0, $show_empty =
'1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss =
'maxwidth500', $projectsListId =
'', $showmore =
'all', $usertofilter =
null, $nooutput = 0)
351 global $user,
$conf, $langs;
353 require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
355 if (is_null($usertofilter)) {
356 $usertofilter = $user;
361 $hideunselectables =
false;
363 $hideunselectables =
true;
366 if (empty($projectsListId)) {
367 if (!$usertofilter->hasRight(
'projet',
'all',
'lire')) {
368 $projectstatic =
new Project($this->db);
369 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
374 $sql =
"SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,";
375 $sql .=
" p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,";
376 $sql .=
" s.nom as name";
377 $sql .=
" FROM " . $this->db->prefix() .
"projet as p";
378 $sql .=
" LEFT JOIN " . $this->db->prefix() .
"societe as s ON s.rowid = p.fk_soc,";
379 $sql .=
" " . $this->db->prefix() .
"projet_task as t";
380 $sql .=
" WHERE p.entity IN (" .
getEntity(
'project') .
")";
381 $sql .=
" AND t.fk_projet = p.rowid";
382 if ($projectsListId) {
383 $sql .=
" AND p.rowid IN (" . $this->db->sanitize($projectsListId) .
")";
386 $sql .=
" AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
389 $sql .=
" AND (p.fk_soc=" . ((int) $socid) .
" OR p.fk_soc IS NULL)";
391 $sql .=
" ORDER BY p.ref, t.ref ASC";
393 $resql = $this->db->query($sql);
396 if (empty($option_only) && !empty(
$conf->use_javascript_ajax)) {
397 include_once DOL_DOCUMENT_ROOT .
'/core/lib/ajax.lib.php';
398 $comboenhancement =
ajax_combobox($htmlname, [], 0, $forcefocus);
399 $out .= $comboenhancement;
400 $morecss .=
' minwidth150imp';
403 if (empty($option_only)) {
404 $out .=
'<select class="valignmiddle flat' . ($morecss ?
' ' . $morecss :
'') .
'"' . ($disabled ?
' disabled="disabled"' :
'') .
' id="' . $htmlname .
'" name="' . $htmlname .
'">';
406 if (!empty($show_empty)) {
407 $out .=
'<option value="0" class="optiongrey">';
408 if (!is_numeric($show_empty)) {
418 $num = $this->db->num_rows($resql);
422 $obj = $this->db->fetch_object($resql);
424 if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$usertofilter->hasRight(
'societe',
'lire')) {
433 $labeltoshowhtml =
'';
439 if ($discard_closed == 2) {
442 } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
446 if (preg_match(
'/all/', $showmore)) {
447 $labeltoshow .=
dol_trunc($obj->ref, 18);
450 $labeltoshow .=
' ' .
dol_trunc($obj->title, $maxlength);
451 $labeltoshowhtml = $labeltoshow;
454 $labeltoshow .=
' (' . $obj->name .
')';
455 $labeltoshowhtml .=
' <span class="opacitymedium">(' . $obj->name .
')</span>';
461 $labeltoshow .=
' - ' . $langs->trans(
"Draft");
462 $labeltoshowhtml .=
' - <span class="opacitymedium">' . $langs->trans(
"Draft") .
'</span>';
464 if ($discard_closed == 2) {
467 $labeltoshow .=
' - ' . $langs->trans(
"Closed");
468 $labeltoshowhtml .=
' - <span class="opacitymedium">' . $langs->trans(
"Closed") .
'</span>';
469 } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
471 $labeltoshow .=
' - ' . $langs->trans(
"LinkedToAnotherCompany");
472 $labeltoshowhtml .=
' - <span class="opacitymedium">' . $langs->trans(
"LinkedToAnotherCompany") .
'</span>';
474 $labeltoshow .=
' - ';
475 $labeltoshowhtml .=
' - ';
479 $labeltoshow .= $obj->tref .
' ' .
dol_trunc($obj->tlabel, $maxlength);
480 $labeltoshowhtml .= $obj->tref .
' - ' .
dol_trunc($obj->tlabel, $maxlength);
481 if ($obj->usage_task && preg_match(
'/progress/', $showmore)) {
482 $labeltoshow .=
' <span class="opacitymedium">(' . $obj->progress .
'%)</span>';
483 $labeltoshowhtml .=
' <span class="opacitymedium">(' . $obj->progress .
'%)</span>';
486 if (!empty($selected) && $selected == $obj->rowid) {
487 $out .=
'<option value="' . $obj->rowid .
'" selected';
490 $out .=
'>' . $labeltoshow .
'</option>';
492 if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
495 $resultat =
'<option value="' . $obj->rowid .
'"';
497 $resultat .=
' disabled';
503 $resultat .= $labeltoshow;
504 $resultat .=
'</option>';
512 if (empty($option_only)) {
516 $this->nboftasks = $num;
517 $this->db->free($resql);
520 if (empty($nooutput)) {
547 public function select_element($table_element, $socid = 0, $morecss =
'', $limitonstatus = -2, $projectkey =
"fk_projet", $placeholder =
'')
550 global
$conf, $langs;
552 if ($table_element ==
'projet_task') {
556 $linkedtothirdparty =
false;
562 'expensereport',
'loan',
570 $linkedtothirdparty =
true;
576 switch ($table_element) {
578 $sql =
"SELECT t.rowid, t.label as ref";
581 $sql =
"SELECT t.rowid, t.ref as ref";
583 case "facture_fourn":
584 $sql =
"SELECT t.rowid, t.ref, t.ref_supplier";
586 case "commande_fourn":
587 case "commande_fournisseur":
588 $sql =
"SELECT t.rowid, t.ref, t.ref_supplier";
591 $sql =
"SELECT t.rowid, t.titre as ref";
594 $sql =
"SELECT t.id as rowid, t.label as ref";
595 $projectkey =
"fk_project";
597 case "expensereport":
599 case "expensereport_det":
607 $sql =
"SELECT t.rowid, t.ref";
609 case 'stock_mouvement':
610 $sql =
"SELECT t.rowid, t.label as ref";
611 $projectkey =
'fk_origin';
613 case "payment_salary":
614 $sql =
"SELECT t.rowid, t.num_payment as ref";
616 case "payment_various":
617 $sql =
"SELECT t.rowid, t.num_payment as ref";
619 case "chargesociales":
621 $sql =
"SELECT t.rowid, t.ref";
624 if ($linkedtothirdparty) {
625 $sql .=
", s.nom as name";
627 $sql .=
" FROM " . $this->db->prefix() . $table_element .
" as t";
628 if ($linkedtothirdparty) {
629 $sql .=
", " . $this->db->prefix() .
"societe as s";
631 $sql .=
" WHERE " . $projectkey .
" is null";
632 if (!empty($socid) && $linkedtothirdparty) {
633 if (is_numeric($socid)) {
634 $sql .=
" AND t.fk_soc = " . ((int) $socid);
636 $sql .=
" AND t.fk_soc IN (" . $this->db->sanitize($socid) .
")";
639 if (!in_array($table_element, array(
'expensereport_det',
'stock_mouvement'))) {
640 $sql .=
' AND t.entity IN (' .
getEntity(
'project') .
')';
642 if ($linkedtothirdparty) {
643 $sql .=
" AND s.rowid = t.fk_soc";
646 $sql .=
" AND " . $sqlfilter;
648 $sql .=
" ORDER BY ref DESC";
650 dol_syslog(get_class($this) .
'::select_element', LOG_DEBUG);
651 $resql = $this->db->query($sql);
653 $num = $this->db->num_rows($resql);
658 $sellist =
'<select class="flat elementselect css' . $table_element . ($morecss ?
' ' . $morecss :
'') .
'" name="elementselect">';
659 $sellist .=
'<option value="-1"' . ($placeholder ?
' class="optiongrey"' :
'') .
'>' . $placeholder .
'</option>';
661 $obj = $this->db->fetch_object($resql);
662 $ref = $obj->ref ? $obj->ref : $obj->rowid;
663 if (!empty($obj->ref_supplier)) {
664 $ref .=
' (' . $obj->ref_supplier .
')';
666 if (!empty($obj->name)) {
667 $ref .=
' - ' . $obj->name;
669 $sellist .=
'<option value="' . $obj->rowid .
'">' . $ref .
'</option>';
672 $sellist .=
'</select>';
680 $this->db->free($resql);
685 $this->error = $this->db->lasterror();
686 $this->errors[] = $this->db->lasterror();
687 dol_syslog(get_class($this) .
"::select_element " . $this->error, LOG_ERR);
707 public function selectOpportunityStatus($htmlname, $preselected =
'-1', $showempty = 1, $useshortlabel = 0, $showallnone = 0, $showpercent = 0, $morecss =
'', $noadmininfo = 0, $addcombojs = 0)
709 global
$conf, $langs, $user;
711 $sql =
"SELECT rowid, code, label, percent";
712 $sql .=
" FROM " . $this->db->prefix() .
'c_lead_status';
713 $sql .=
" WHERE active = 1";
714 $sql .=
" ORDER BY position";
716 $resql = $this->db->query($sql);
718 $num = $this->db->num_rows($resql);
722 $sellist =
'<select class="flat oppstatus' . ($morecss ?
' ' . $morecss :
'') .
'" id="' . $htmlname .
'" name="' . $htmlname .
'">';
725 $sellist .=
'<option value="-1"> </option>';
728 $sellist .=
'<option value="all"' . ($preselected ==
'all' ?
' selected="selected"' :
'') .
'>-- ' . $langs->trans(
"OnlyOpportunitiesShort") .
'</option>';
729 $sellist .=
'<option value="openedopp"' . ($preselected ==
'openedopp' ?
' selected="selected"' :
'') .
'>-- ' . $langs->trans(
"OpenedOpportunitiesShort") .
'</option>';
730 $sellist .=
'<option value="notopenedopp"' . ($preselected ==
'notopenedopp' ?
' selected="selected"' :
'') .
'>-- ' . $langs->trans(
"NotOpenedOpportunitiesShort") .
'</option>';
731 $sellist .=
'<option value="none"' . ($preselected ==
'none' ?
' selected="selected"' :
'') .
'>-- ' . $langs->trans(
"NotAnOpportunityShort") .
'</option>';
734 $obj = $this->db->fetch_object($resql);
736 $sellist .=
'<option value="' . $obj->rowid .
'" defaultpercent="' . $obj->percent .
'" elemcode="' . $obj->code .
'"';
737 if ($obj->rowid == $preselected) {
738 $sellist .=
' selected="selected"';
741 if ($useshortlabel) {
742 $finallabel = ($langs->transnoentitiesnoconv(
"OppStatus" . $obj->code) !=
"OppStatus" . $obj->code ? $langs->transnoentitiesnoconv(
"OppStatus" . $obj->code) : $obj->label);
744 $finallabel = ($langs->transnoentitiesnoconv(
"OppStatus" . $obj->code) !=
"OppStatus" . $obj->code ? $langs->transnoentitiesnoconv(
"OppStatus" . $obj->code) : $obj->label);
746 $finallabel .=
' (' . $obj->percent .
'%)';
749 $sellist .= $finallabel;
750 $sellist .=
'</option>';
753 $sellist .=
'</select>';
755 if ($user->admin && !$noadmininfo) {
756 $sellist .=
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
769 $this->db->free($resql);
773 $this->error = $this->db->lasterror();
774 $this->errors[] = $this->db->lasterror();
775 dol_syslog(get_class($this) .
"::selectOpportunityStatus " . $this->error, LOG_ERR);
793 $statustohow = array(
799 $tmpproject =
new Project($this->db);
801 foreach ($statustohow as $key => $value) {
802 $tmpproject->statut = $key;
803 $options[$value] = $tmpproject->getLibStatut($short);
806 if (is_array($selected)) {
807 $selectedarray = $selected;
808 } elseif ($selected == 99) {
809 $selectedarray = array(0,1);
811 $selectedarray = explode(
',', $selected);
829 public function selectInvoiceAndLine($selectedInvoiceId = 0, $selectedLineId = 0, $htmlNameInvoice =
'invoiceid', $htmlNameInvoiceLine =
'invoicelineid', $morecss =
'maxwidth500', $filters = array(), $lineOnly = 0)
831 global $user,
$conf, $langs;
833 require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
836 if (empty($lineOnly)) {
838 $sql =
"SELECT f.rowid, f.ref as fref,";
839 $sql .=
' s.nom as name';
840 $sql .=
' FROM ' . $this->db->prefix() .
'projet as p';
841 $sql .=
' INNER JOIN ' . $this->db->prefix() .
'societe as s ON s.rowid = p.fk_soc';
842 $sql .=
' INNER JOIN ' . $this->db->prefix() .
'facture as f ON f.fk_projet = p.rowid';
843 $sql .=
" WHERE p.entity IN (" .
getEntity(
'project') .
")";
844 if (!empty($filters)) {
845 foreach ($filters as $key => $value) {
846 if ($key ==
'p.rowid') {
847 $sql .=
" AND p.rowid=" . (int) $value;
849 if ($key ==
'f.rowid') {
850 $sql .=
" AND f.rowid=" . (int) $value;
854 $sql .=
" ORDER BY p.ref, f.ref ASC";
856 $resql = $this->db->query($sql);
859 if (!empty(
$conf->use_javascript_ajax)) {
860 include_once DOL_DOCUMENT_ROOT .
'/core/lib/ajax.lib.php';
861 $comboenhancement =
ajax_combobox($htmlNameInvoice, array(array(
'method' =>
'getLines',
'url' =>
dol_buildpath(
'/core/ajax/ajaxinvoiceline.php', 1),
'htmlname' => $htmlNameInvoiceLine)), 0, 0);
862 $out .= $comboenhancement;
863 $morecss =
'minwidth200imp maxwidth500';
866 $out .=
'<select class="valignmiddle flat' . ($morecss ?
' ' . $morecss :
'') .
'" id="' . $htmlNameInvoice .
'" name="' . $htmlNameInvoice .
'">';
867 $num = $this->db->num_rows($resql);
869 while ($obj = $this->db->fetch_object($resql)) {
870 $labeltoshow = $obj->fref;
872 $labeltoshow .=
' - ' . $obj->name;
875 $out .=
'<option value="' . $obj->rowid .
'" ';
876 if (!empty($selectedInvoiceId) && $selectedInvoiceId == $obj->rowid) {
877 $out .=
' selected ';
879 $out .=
'>' . $labeltoshow .
'</option>';
890 $sql =
"SELECT fd.rowid, fd.label, fd.description";
891 $sql .=
' FROM ' . $this->db->prefix() .
'projet as p';
892 $sql .=
' INNER JOIN ' . $this->db->prefix() .
'societe as s ON s.rowid = p.fk_soc';
893 $sql .=
' INNER JOIN ' . $this->db->prefix() .
'facture as f ON f.fk_projet = p.rowid';
894 $sql .=
' INNER JOIN ' . $this->db->prefix() .
'facturedet as fd ON fd.fk_facture = f.rowid';
895 $sql .=
" WHERE p.entity IN (" .
getEntity(
'project') .
")";
896 if (!empty($filters)) {
897 foreach ($filters as $key => $value) {
898 if ($key ==
'p.rowid') {
899 $sql .=
" AND p.rowid=" . (int) $value;
903 if (!empty($selectedInvoiceId)) {
904 $sql .=
" AND f.rowid=" . (int) $selectedInvoiceId;
906 $sql .=
" ORDER BY p.ref, f.ref ASC";
907 $resql = $this->db->query($sql);
910 if (empty($lineOnly)) {
911 if (!empty(
$conf->use_javascript_ajax)) {
912 include_once DOL_DOCUMENT_ROOT .
'/core/lib/ajax.lib.php';
913 $comboenhancement =
ajax_combobox($htmlNameInvoiceLine, [], 0, 0);
914 $out .= $comboenhancement;
915 $morecss =
'minwidth200imp maxwidth500';
918 $out .=
'<select class="valignmiddle flat' . ($morecss ?
' ' . $morecss :
'') .
'" id="' . $htmlNameInvoiceLine .
'" name="' . $htmlNameInvoiceLine .
'">';
920 $num = $this->db->num_rows($resql);
922 while ($obj = $this->db->fetch_object($resql)) {
923 $labeltoshow .= $obj->description;
925 $out .=
'<option value="' . $obj->rowid .
'" ';
926 if (!empty($selectedLineId) && $selectedLineId == $obj->rowid) {
927 $out .=
' selected ';
929 $out .=
'>' . $labeltoshow .
'</option>';
932 if (empty($lineOnly)) {
955 public function formOpportunityStatus($page, $selected =
'', $percent_value = 0, $htmlname_status =
'none', $htmlname_percent =
'none', $filter =
'', $nooutput = 0)
958 global
$conf, $langs;
961 if ($htmlname_status !=
"none" && $htmlname_percent !=
'none') {
962 $out .=
'<form method="post" action="' . $page .
'">';
963 $out .=
'<input type="hidden" name="action" value="set_opp_status">';
964 $out .=
'<input type="hidden" name="token" value="' .
newToken() .
'">';
965 $out .= $this->
selectOpportunityStatus($htmlname_status, $selected, 1, 0, 0, 0,
'minwidth150 inline-block valignmiddle', 1, 1);
966 $out .=
' / <span title="'.$langs->trans(
"OpportunityProbability").
'"> ';
967 $out .=
'<input class="width50 right" type="text" id="'.$htmlname_percent.
'" name="'.$htmlname_percent.
'" title="'.
dol_escape_htmltag($langs->trans(
"OpportunityProbability")).
'" value="'.$percent_value.
'"> %';
969 $out .=
'<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans(
"Modify") .
'">';
973 $code =
dol_getIdFromCode($this->db, $selected,
'c_lead_status',
'rowid',
'code');
974 $out .= $langs->trans(
"OppStatus".$code);
977 $out .=
' / <span title="'.$langs->trans(
"OpportunityProbability").
'"> ';
978 $out .=
price($percent_value, 0, $langs, 1, 0).
' %';
ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array(), $moreparams='')
Generic function that return javascript to add to transform a common input text or select field into ...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Class to manage projects.
const STATUS_CLOSED
Closed status.
const STATUS_DRAFT
Draft status.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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...