34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
54 global $langs, $mysoc;
58 $sql =
"SELECT id, code, libelle";
59 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_typent";
60 $sql .=
" WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ?
'0' : $mysoc->country_id).
")";
61 if ($filter) $sql .=
" ".$filter;
62 $sql .=
" ORDER by position, id";
63 dol_syslog(get_class($this).
'::typent_array', LOG_DEBUG);
72 $objp = $this->
db->fetch_object(
$resql);
73 if (!$mode) $key = $objp->id;
74 else $key = $objp->code;
75 if ($langs->trans($objp->code) != $objp->code) $effs[$key] = $langs->trans($objp->code);
76 else $effs[$key] = $objp->libelle;
77 if ($effs[$key] ==
'-') $effs[$key] =
'';
99 $sql =
"SELECT id, code, libelle";
100 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_effectif";
101 $sql .=
" WHERE active = 1";
102 if ($filter) $sql .=
" ".$filter;
103 $sql .=
" ORDER BY id ASC";
104 dol_syslog(get_class($this).
'::effectif_array', LOG_DEBUG);
113 $objp = $this->
db->fetch_object(
$resql);
114 if (!$mode) $key = $objp->id;
115 else $key = $objp->code;
117 $effs[$key] = $objp->libelle !=
'-' ? $objp->libelle :
'';
139 global $user, $langs;
141 print '<form method="post" action="'.$page.
'">';
142 print '<input type="hidden" name="action" value="setprospectlevel">';
143 print '<input type="hidden" name="token" value="'.newToken().
'">';
145 dol_syslog(get_class($this).
'::form_prospect_level', LOG_DEBUG);
146 $sql =
"SELECT code, label";
147 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectlevel";
148 $sql .=
" WHERE active > 0";
149 $sql .=
" ORDER BY sortorder";
159 while ($obj = $this->
db->fetch_object(
$resql)) {
160 $level = $langs->trans($obj->code);
162 if ($level == $obj->code) {
163 $level = $langs->trans($obj->label);
166 $options[$obj->code] = $level;
171 if (!empty($htmlname) && $user->admin)
print ' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
172 print '<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
187 global $user, $langs;
189 print '<form method="post" action="'.$page.
'">';
190 print '<input type="hidden" name="action" value="setprospectcontactlevel">';
191 print '<input type="hidden" name="token" value="'.newToken().
'">';
194 $sql =
"SELECT code, label";
195 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_prospectcontactlevel";
196 $sql .=
" WHERE active > 0";
197 $sql .=
" ORDER BY sortorder";
208 while ($obj = $this->
db->fetch_object(
$resql))
210 $level = $langs->trans($obj->code);
212 if ($level == $obj->code)
214 $level = $langs->trans($obj->label);
217 $options[$obj->code] = $level;
223 if (!empty($htmlname) && $user->admin)
print ' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
224 print '<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
259 public function select_state($selected = 0, $country_codeid = 0, $htmlname =
'state_id')
262 global $conf, $langs, $user;
264 dol_syslog(get_class($this).
"::select_departement selected=".$selected.
", country_codeid=".$country_codeid, LOG_DEBUG);
266 $langs->load(
"dict");
271 $sql =
"SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
272 $sql .=
" ".MAIN_DB_PREFIX.
"c_departements as d, ".MAIN_DB_PREFIX.
"c_regions as r,".MAIN_DB_PREFIX.
"c_country as c";
273 $sql .=
" WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
274 $sql .=
" AND d.active = 1 AND r.active = 1 AND c.active = 1";
275 if ($country_codeid && is_numeric($country_codeid)) $sql .=
" AND c.rowid = '".$this->db->escape($country_codeid).
"'";
276 if ($country_codeid && !is_numeric($country_codeid)) $sql .=
" AND c.code = '".$this->db->escape($country_codeid).
"'";
277 $sql .=
" ORDER BY c.code, d.code_departement";
279 $result = $this->
db->query($sql);
282 if (!empty($htmlname)) $out .=
'<select id="'.$htmlname.
'" class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.
'">';
283 if ($country_codeid) $out .=
'<option value="0"> </option>';
284 $num = $this->
db->num_rows($result);
286 dol_syslog(get_class($this).
"::select_departement num=".$num, LOG_DEBUG);
292 $obj = $this->
db->fetch_object($result);
293 if ($obj->code ==
'0')
295 $out .=
'<option value="0"> </option>';
297 if (!$country || $country != $obj->country)
300 if (!$country_codeid && $obj->country_code)
302 $out .=
'<option value="-1" disabled>----- '.$obj->country.
" -----</option>\n";
303 $country = $obj->country;
307 if (!empty($selected) && $selected == $obj->rowid)
309 $out .=
'<option value="'.$obj->rowid.
'" selected>';
311 $out .=
'<option value="'.$obj->rowid.
'">';
315 if (!empty($conf->global->MAIN_SHOW_STATE_CODE) &&
316 ($conf->global->MAIN_SHOW_STATE_CODE == 1 || $conf->global->MAIN_SHOW_STATE_CODE == 2 || $conf->global->MAIN_SHOW_STATE_CODE ===
'all')) {
317 if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
318 $out .= $obj->region_name.
' - '.$obj->code.
' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
320 $out .= $obj->code.
' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
323 if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
324 $out .= $obj->region_name.
' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
326 $out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
335 if (!empty($htmlname)) $out .=
'</select>';
336 if (!empty($htmlname) && $user->admin) $out .=
' '.
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
342 if (!empty($htmlname))
344 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
366 global $conf, $langs;
367 $langs->load(
"dict");
369 $sql =
"SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
370 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_regions as r, ".MAIN_DB_PREFIX.
"c_country as c";
371 $sql .=
" WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
372 $sql .=
" ORDER BY c.code, c.label ASC";
374 dol_syslog(get_class($this).
"::select_region", LOG_DEBUG);
378 print '<select class="flat" id="'.$htmlname.
'" name="'.$htmlname.
'">';
386 $obj = $this->
db->fetch_object(
$resql);
387 if ($obj->code == 0) {
388 print '<option value="0"> </option>';
390 if ($country ==
'' || $country != $obj->country)
393 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
394 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code)) ? $obj->country_code.
" - ".$key : $obj->country;
395 print '<option value="-1" disabled>----- '.$valuetoshow.
" -----</option>\n";
396 $country = $obj->country;
399 if ($selected > 0 && $selected == $obj->code)
401 print '<option value="'.$obj->code.
'" selected>'.$obj->label.
'</option>';
403 print '<option value="'.$obj->code.
'">'.$obj->label.
'</option>';
426 public function select_civility($selected =
'', $htmlname =
'civility_id', $morecss =
'maxwidth150', $addjscombo = 0)
429 global $conf, $langs, $user;
430 $langs->load(
"dict");
434 $sql =
"SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX.
"c_civility";
435 $sql .=
" WHERE active = 1";
437 dol_syslog(
"Form::select_civility", LOG_DEBUG);
441 $out .=
'<select class="flat'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'" id="'.$htmlname.
'">';
442 $out .=
'<option value=""> </option>';
443 $num = $this->db->num_rows(
$resql);
449 $obj = $this->
db->fetch_object(
$resql);
450 if ($selected == $obj->code)
452 $out .=
'<option value="'.$obj->code.
'" selected>';
454 $out .=
'<option value="'.$obj->code.
'">';
457 $out .= ($langs->trans(
"Civility".$obj->code) !=
"Civility".$obj->code ? $langs->trans(
"Civility".$obj->code) : ($obj->label !=
'-' ? $obj->label :
''));
463 if ($user->admin) $out .=
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
467 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
507 public function select_juridicalstatus($selected =
'', $country_codeid = 0, $filter =
'', $htmlname =
'forme_juridique_code', $morecss =
'')
510 global $conf, $langs, $user;
511 $langs->load(
"dict");
516 $sql =
"SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
517 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_forme_juridique as f, ".MAIN_DB_PREFIX.
"c_country as c";
518 $sql .=
" WHERE f.fk_pays=c.rowid";
519 $sql .=
" AND f.active = 1 AND c.active = 1";
520 if ($country_codeid) $sql .=
" AND c.code = '".$this->db->escape($country_codeid).
"'";
521 if ($filter) $sql .=
" ".$filter;
522 $sql .=
" ORDER BY c.code";
524 dol_syslog(get_class($this).
"::select_juridicalstatus", LOG_DEBUG);
528 $out .=
'<div id="particulier2" class="visible">';
529 $out .=
'<select class="flat minwidth200'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'" id="'.$htmlname.
'">';
530 if ($country_codeid) $out .=
'<option value="0"> </option>';
536 $country =
''; $arraydata = array();
539 $obj = $this->
db->fetch_object(
$resql);
543 $labelcountry = (($langs->trans(
"Country".$obj->country_code) !=
"Country".$obj->country_code) ? $langs->trans(
"Country".$obj->country_code) : $obj->country);
544 $labeljs = (($langs->trans(
"JuridicalStatus".$obj->code) !=
"JuridicalStatus".$obj->code) ? $langs->trans(
"JuridicalStatus".$obj->code) : ($obj->label !=
'-' ? $obj->label :
''));
545 $arraydata[$obj->code] = array(
'code'=>$obj->code,
'label'=>$labeljs,
'label_sort'=>$labelcountry.
'_'.$labeljs,
'country_code'=>$obj->country_code,
'country'=>$labelcountry);
551 if (empty($country_codeid))
553 $arraydata[0] = array(
'code'=>0,
'label'=>
'',
'label_sort'=>
'_',
'country_code'=>
'',
'country'=>
'');
556 foreach ($arraydata as $key => $val)
558 if (!$country || $country != $val[
'country'])
561 if (empty($country_codeid) && $val[
'country_code'])
563 $out .=
'<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val[
'country'].
" -----</option>\n";
564 $country = $val[
'country'];
568 if ($selected > 0 && $selected == $val[
'code'])
570 $out .=
'<option value="'.$val[
'code'].
'" selected>';
572 $out .=
'<option value="'.$val[
'code'].
'">';
575 $out .= $val[
'label'];
580 if ($user->admin) $out .=
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
583 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
608 public function selectCompaniesForNewContact($object, $var_id, $selected =
'', $htmlname =
'newcompany', $limitto =
'', $forceid = 0, $moreparam =
'', $morecss =
'')
610 global $conf, $langs;
612 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT))
615 $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2);
617 $socid = 0; $name =
'';
621 $result = $tmpthirdparty->fetch($selected);
625 $name = $tmpthirdparty->name;
636 $events[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php', 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
640 print '<script type="text/javascript">
641 jQuery(document).ready(function() {
642 $("#search_'.$htmlname.
'").change(function() {
643 var obj = '.json_encode($events).
';
644 $.each(obj, function(key,values) {
645 if (values.method.length) {
646 runJsCodeForEvent'.$htmlname.
'(values);
650 $(this).trigger("blur");
653 // Function used to execute events when search_htmlname change
654 function runJsCodeForEvent'.$htmlname.
'(obj) {
655 var id = $("#'.$htmlname.
'").val();
656 var method = obj.method;
658 var htmlname = obj.htmlname;
659 var showempty = obj.showempty;
660 console.log("Run runJsCodeForEvent-'.$htmlname.
' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
668 if (response != null)
670 console.log("Change select#"+htmlname+" with content "+response.value)
671 $.each(obj.params, function(key,action) {
673 var num = response.num;
675 $("#" + key).removeAttr(action);
677 $("#" + key).attr(action, action);
681 $("select#" + htmlname).html(response.value);
690 print "\n".
'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'.
"\n";
691 print '<input type="text" size="30" id="search_'.$htmlname.
'" name="search_'.$htmlname.
'" value="'.$name.
'" />';
692 print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.
'/societe/ajaxcompanies.php',
'', $minLength, 0);
696 $sql =
"SELECT s.rowid, s.nom as name FROM";
697 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s";
698 $sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
700 if (is_array($limitto) && count($limitto))
702 $sql .=
" AND s.rowid IN (".join(
',', $limitto).
")";
704 $sql .=
" ORDER BY s.nom ASC";
709 print '<select class="flat'.($morecss ?
' '.$morecss :
'').
'" id="'.$htmlname.
'" name="'.$htmlname.
'"';
710 if ($conf->use_javascript_ajax)
712 $javaScript =
"window.location='".$_SERVER[
'PHP_SELF'].
"?".$var_id.
"=".($forceid > 0 ? $forceid : $object->id).$moreparam.
"&".$htmlname.
"=' + form.".$htmlname.
".options[form.".$htmlname.
".selectedIndex].value;";
713 print ' onChange="'.$javaScript.
'"';
722 $obj = $this->
db->fetch_object(
$resql);
723 if ($i == 0) $firstCompany = $obj->rowid;
725 if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) $disabled = 1;
726 if ($selected > 0 && $selected == $obj->rowid)
728 print '<option value="'.$obj->rowid.
'"';
729 if ($disabled)
print ' disabled';
730 print ' selected>'.dol_trunc($obj->name, 24).
'</option>';
731 $firstCompany = $obj->rowid;
733 print '<option value="'.$obj->rowid.
'"';
734 if ($disabled)
print ' disabled';
735 print '>'.dol_trunc($obj->name, 24).
'</option>';
742 return $firstCompany;
762 public function selectTypeContact($object, $selected, $htmlname =
'type', $source =
'internal', $sortorder =
'position', $showempty = 0, $morecss =
'')
764 global $user, $langs;
766 if (is_object($object) && method_exists($object,
'liste_type_contact'))
768 $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
770 print '<select class="flat valignmiddle'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'" id="'.$htmlname.
'">';
771 if ($showempty)
print '<option value="0"></option>';
772 foreach ($lesTypes as $key=>$value)
774 print '<option value="'.$key.
'"';
775 if ($key == $selected)
print ' selected';
776 print '>'.$value.
'</option>';
779 if ($user->admin)
print ' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
796 public function showRoles($htmlname,
Contact $contact, $rendermode =
'view', $selected = array())
798 if ($rendermode ===
'view') {
800 foreach ($contact->roles as $key => $val) {
801 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val[
'label'].
'</li>';
803 return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.
'"><ul class="select2-choices-dolibarr">'.implode(
' ', $toprint).
'</ul></div>';
806 if ($rendermode ===
'edit')
809 if (count($selected) > 0) {
810 $newselected = array();
811 foreach ($selected as $key=>$val) {
812 if (is_array($val) && array_key_exists(
'id', $val) && in_array($val[
'id'], array_keys($contactType))) {
813 $newselected[] = $val[
'id'];
818 if (count($newselected) > 0) $selected = $newselected;
823 return 'ErrorBadValueForParameterRenderMode';
839 public function select_ziptown($selected =
'', $htmlname =
'zipcode', $fields =
'', $fieldsize = 0, $disableautocomplete = 0, $moreattrib =
'', $morecss =
'')
847 if (!empty($fieldsize)) $size =
'size="'.$fieldsize.
'"';
849 if ($conf->use_javascript_ajax && empty($disableautocomplete))
852 $moreattrib .=
' autocomplete="off"';
854 $out .=
'<input id="'.$htmlname.
'" class="maxwidthonsmartphone'.($morecss ?
' '.$morecss :
'').
'" type="text"'.($moreattrib ?
' '.$moreattrib :
'').
' name="'.$htmlname.
'" '.$size.
' value="'.$selected.
'">'.
"\n";
870 public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss =
'maxwidth100onsmartphone quatrevingtpercent')
873 global $conf, $langs, $hookmanager;
876 if (empty($conf->global->MAIN_DISABLEPROFIDRULES)) {
877 if ($country_code ==
'FR')
879 if (isset($idprof)) {
880 if ($idprof == 1) $formlength = 9;
881 elseif ($idprof == 2) $formlength = 14;
882 elseif ($idprof == 3) $formlength = 5;
883 elseif ($idprof == 4) $formlength = 32;
885 } elseif ($country_code ==
'ES')
887 if ($idprof == 1) $formlength = 9;
888 if ($idprof == 2) $formlength = 12;
889 if ($idprof == 3) $formlength = 5;
890 if ($idprof == 4) $formlength = 32;
894 $selected = $preselected;
895 if (!$selected && isset($idprof)) {
896 if ($idprof == 1 && !empty($this->idprof1)) $selected = $this->idprof1;
897 elseif ($idprof == 2 && !empty($this->idprof2)) $selected = $this->idprof2;
898 elseif ($idprof == 3 && !empty($this->idprof3)) $selected = $this->idprof3;
899 elseif ($idprof == 4 && !empty($this->idprof4)) $selected = $this->idprof4;
902 $maxlength = $formlength;
903 if (empty($formlength)) { $formlength = 24; $maxlength = 128; }
908 $parameters = array(
'formlength'=>$formlength,
'selected'=>$preselected,
'idprof'=>$idprof,
'htmlname'=>$htmlname,
'country_code'=>$country_code);
909 $reshook = $hookmanager->executeHooks(
'getInputIdProf', $parameters);
912 $out .=
'<input type="text" '.($morecss ?
'class="'.$morecss.
'" ' :
'').
'name="'.$htmlname.
'" id="'.$htmlname.
'" maxlength="'.$maxlength.
'" value="'.$selected.
'">';
914 $out .= $hookmanager->resPrint;
933 $num = $this->
db->num_rows($tax);
937 $valors = explode(
":", $tax);
939 if (count($valors) > 1)
942 print '<select class="flat" name="'.$htmlname.
'" id="'.$htmlname.
'">';
943 while ($i <= (count($valors)) - 1)
945 if ($selected == $valors[$i])
947 print '<option value="'.$valors[$i].
'" selected>';
949 print '<option value="'.$valors[$i].
'">';
970 public function selectProspectCustomerType($selected, $htmlname =
'client', $htmlidname =
'customerprospect', $typeinput =
'form', $morecss =
'')
973 global $conf, $langs;
975 $out =
'<select class="flat '.$morecss.
'" name="'.$htmlname.
'" id="'.$htmlidname.
'">';
976 if ($typeinput ==
'form') {
977 if ($selected ==
'' || $selected ==
'-1') $out .=
'<option value="-1"> </option>';
978 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
979 $out .=
'<option value="2"'.($selected == 2 ?
' selected' :
'').
'>'.$langs->trans(
'Prospect').
'</option>';
981 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
982 $out .=
'<option value="3"'.($selected == 3 ?
' selected' :
'').
'>'.$langs->trans(
'ProspectCustomer').
'</option>';
984 if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
985 $out .=
'<option value="1"'.($selected == 1 ?
' selected' :
'').
'>'.$langs->trans(
'Customer').
'</option>';
987 $out .=
'<option value="0"'.((string) $selected ==
'0' ?
' selected' :
'').
'>'.$langs->trans(
'NorProspectNorCustomer').
'</option>';
988 } elseif ($typeinput ==
'list') {
989 $out .=
'<option value="-1"'.(($selected ==
'' || $selected ==
'-1') ?
' selected' :
'').
'> </option>';
990 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
991 $out .=
'<option value="2,3"'.($selected ==
'2,3' ?
' selected' :
'').
'>'.$langs->trans(
'Prospect').
'</option>';
993 if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
994 $out .=
'<option value="1,3"'.($selected ==
'1,3' ?
' selected' :
'').
'>'.$langs->trans(
'Customer').
'</option>';
996 $out .=
'<option value="4"'.($selected ==
'4' ?
' selected' :
'').
'>'.$langs->trans(
'Supplier').
'</option>';
997 $out .=
'<option value="0"'.($selected ==
'0' ?
' selected' :
'').
'>'.$langs->trans(
'Other').
'</option>';
998 } elseif ($typeinput ==
'admin') {
999 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
1000 $out .=
'<option value="3"'.($selected == 3 ?
' selected' :
'').
'>'.$langs->trans(
'ProspectCustomer').
'</option>';
1002 if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1003 $out .=
'<option value="1"'.($selected == 1 ?
' selected' :
'').
'>'.$langs->trans(
'Customer').
'</option>';
1006 $out .=
'</select>';
1022 public function formThirdpartyType($page, $selected =
'', $htmlname =
'socid', $filter =
'', $nooutput = 0)
1025 global $conf, $langs;
1028 if ($htmlname !=
"none") {
1029 $out .=
'<form method="post" action="'.$page.
'">';
1030 $out .=
'<input type="hidden" name="action" value="set_thirdpartytype">';
1031 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1032 $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
1033 $out .= $this->
selectarray($htmlname, $this->
typent_array(0, $filter), $selected, 0, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1034 $out .=
'<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1039 $typent = $arr[$selected];
ajax_autocompleter($selected, $htmlname, $url, $urloption= '', $minLength=2, $autoselect=0, $ajaxoptions=array(), $moreparams= '')
Generic function that return javascript to add to a page to transform a common input field into an au...
ajax_multiautocompleter($htmlname, $fields, $url, $option= '', $minLength=2, $autoselect=0)
Generic function that return javascript to add to a page to transform a common input field into an au...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
$conf db
API class for accounts.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print
Draft customers invoices.
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...
get_localtax_by_third($local)
Get values of localtaxes (1 or 2) for company country for the common vat with the highest value...
listeTypeContacts($source= 'internal', $option=0, $activeonly=0, $code= '', $element= '', $excludeelement= '')
Return array with list of possible values for type of contacts.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.