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 ".$this->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).
")";
64 $sql .=
" ORDER by position, id";
65 dol_syslog(get_class($this).
'::typent_array', LOG_DEBUG);
72 $objp = $this->
db->fetch_object(
$resql);
78 if ($langs->trans($objp->code) != $objp->code) {
79 $effs[$key] = $langs->trans($objp->code);
81 $effs[$key] = $objp->libelle;
83 if ($effs[$key] ==
'-') {
107 $sql =
"SELECT id, code, libelle";
108 $sql .=
" FROM ".$this->db->prefix().
"c_effectif";
109 $sql .=
" WHERE active = 1";
113 $sql .=
" ORDER BY id ASC";
114 dol_syslog(get_class($this).
'::effectif_array', LOG_DEBUG);
121 $objp = $this->
db->fetch_object(
$resql);
128 $effs[$key] = $objp->libelle !=
'-' ? $objp->libelle :
'';
150 global $user, $langs;
152 print
'<form method="post" action="'.$page.
'">';
153 print
'<input type="hidden" name="action" value="setprospectlevel">';
154 print
'<input type="hidden" name="token" value="'.newToken().
'">';
156 dol_syslog(get_class($this).
'::form_prospect_level', LOG_DEBUG);
157 $sql =
"SELECT code, label";
158 $sql .=
" FROM ".$this->db->prefix().
"c_prospectlevel";
159 $sql .=
" WHERE active > 0";
160 $sql .=
" ORDER BY sortorder";
169 while ($obj = $this->
db->fetch_object(
$resql)) {
170 $level = $langs->trans($obj->code);
172 if ($level == $obj->code) {
173 $level = $langs->trans($obj->label);
176 $options[$obj->code] = $level;
183 if (!empty($htmlname) && $user->admin) {
184 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
186 print
'<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans(
"Modify").
'">';
201 global $user, $langs;
203 print
'<form method="post" action="'.$page.
'">';
204 print
'<input type="hidden" name="action" value="setprospectcontactlevel">';
205 print
'<input type="hidden" name="token" value="'.newToken().
'">';
208 $sql =
"SELECT code, label";
209 $sql .=
" FROM ".$this->db->prefix().
"c_prospectcontactlevel";
210 $sql .=
" WHERE active > 0";
211 $sql .=
" ORDER BY sortorder";
220 while ($obj = $this->
db->fetch_object(
$resql)) {
221 $level = $langs->trans($obj->code);
223 if ($level == $obj->code) {
224 $level = $langs->trans($obj->label);
227 $options[$obj->code] = $level;
234 if (!empty($htmlname) && $user->admin) {
235 print
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
237 print
'<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans(
"Modify").
'">';
256 print $this->
select_state($selected, $country_codeid, $htmlname);
273 public function select_state($selected = 0, $country_codeid = 0, $htmlname =
'state_id', $morecss =
'maxwidth200onsmartphone minwidth300')
276 global $conf, $langs, $user;
278 dol_syslog(get_class($this).
"::select_departement selected=".$selected.
", country_codeid=".$country_codeid, LOG_DEBUG);
280 $langs->load(
"dict");
285 $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";
286 $sql .=
" ".$this->db->prefix().
"c_departements as d, ".$this->
db->prefix().
"c_regions as r,".$this->
db->prefix().
"c_country as c";
287 $sql .=
" WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
288 $sql .=
" AND d.active = 1 AND r.active = 1 AND c.active = 1";
289 if ($country_codeid && is_numeric($country_codeid)) {
290 $sql .=
" AND c.rowid = '".$this->db->escape($country_codeid).
"'";
292 if ($country_codeid && !is_numeric($country_codeid)) {
293 $sql .=
" AND c.code = '".$this->db->escape($country_codeid).
"'";
295 $sql .=
" ORDER BY c.code, d.code_departement";
297 $result = $this->
db->query($sql);
299 if (!empty($htmlname)) {
300 $out .=
'<select id="'.$htmlname.
'" class="flat'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'">';
302 if ($country_codeid) {
303 $out .=
'<option value="0"> </option>';
305 $num = $this->
db->num_rows($result);
307 dol_syslog(get_class($this).
"::select_departement num=".$num, LOG_DEBUG);
311 $obj = $this->
db->fetch_object($result);
312 if ($obj->code ==
'0') {
313 $out .=
'<option value="0"> </option>';
315 if (!$country || $country != $obj->country) {
317 if (!$country_codeid && $obj->country_code) {
318 $out .=
'<option value="-1" disabled data-html="----- '.$obj->country.
' -----">----- '.$obj->country.
" -----</option>\n";
319 $country = $obj->country;
323 if (!empty($selected) && $selected == $obj->rowid) {
324 $out .=
'<option value="'.$obj->rowid.
'" selected>';
326 $out .=
'<option value="'.$obj->rowid.
'">';
330 if (!empty($conf->global->MAIN_SHOW_STATE_CODE) &&
331 ($conf->global->MAIN_SHOW_STATE_CODE == 1 || $conf->global->MAIN_SHOW_STATE_CODE == 2 || $conf->global->MAIN_SHOW_STATE_CODE ===
'all')) {
332 if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
333 $out .= $obj->region_name.
' - '.$obj->code.
' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
335 $out .= $obj->code.
' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
338 if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
339 $out .= $obj->region_name.
' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
341 $out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name !=
'-' ? $obj->name :
''));
350 if (!empty($htmlname)) {
353 if (!empty($htmlname) && $user->admin) {
354 $out .=
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
361 if (!empty($htmlname)) {
362 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
384 global $conf, $langs;
385 $langs->load(
"dict");
387 $sql =
"SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
388 $sql .=
" FROM ".$this->db->prefix().
"c_regions as r, ".$this->
db->prefix().
"c_country as c";
389 $sql .=
" WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
390 $sql .=
" ORDER BY c.code, c.label ASC";
392 dol_syslog(get_class($this).
"::select_region", LOG_DEBUG);
395 print
'<select class="flat" id="'.$htmlname.
'" name="'.$htmlname.
'">';
401 $obj = $this->
db->fetch_object(
$resql);
402 if ($obj->code == 0) {
403 print
'<option value="0"> </option>';
405 if ($country ==
'' || $country != $obj->country) {
407 $key = $langs->trans(
"Country".strtoupper($obj->country_code));
408 $valuetoshow = ($key !=
"Country".strtoupper($obj->country_code)) ? $obj->country_code.
" - ".$key : $obj->country;
409 print
'<option value="-2" disabled>----- '.$valuetoshow.
" -----</option>\n";
410 $country = $obj->country;
413 if ($selected > 0 && $selected == $obj->code) {
414 print
'<option value="'.$obj->code.
'" selected>'.$obj->label.
'</option>';
416 print
'<option value="'.$obj->code.
'">'.$obj->label.
'</option>';
439 public function select_civility($selected =
'', $htmlname =
'civility_id', $morecss =
'maxwidth150', $addjscombo = 1)
442 global $conf, $langs, $user;
443 $langs->load(
"dict");
447 $sql =
"SELECT rowid, code, label, active FROM ".$this->db->prefix().
"c_civility";
448 $sql .=
" WHERE active = 1";
450 dol_syslog(
"Form::select_civility", LOG_DEBUG);
453 $out .=
'<select class="flat'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'" id="'.$htmlname.
'">';
454 $out .=
'<option value=""> </option>';
455 $num = $this->db->num_rows(
$resql);
459 $obj = $this->
db->fetch_object(
$resql);
460 if ($selected == $obj->code) {
461 $out .=
'<option value="'.$obj->code.
'" selected>';
463 $out .=
'<option value="'.$obj->code.
'">';
466 $out .= ($langs->trans(
"Civility".$obj->code) !=
"Civility".$obj->code ? $langs->trans(
"Civility".$obj->code) : ($obj->label !=
'-' ? $obj->label :
''));
473 $out .=
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
478 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
518 public function select_juridicalstatus($selected =
'', $country_codeid = 0, $filter =
'', $htmlname =
'forme_juridique_code', $morecss =
'')
521 global $conf, $langs, $user;
522 $langs->load(
"dict");
527 $sql =
"SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
528 $sql .=
" FROM ".$this->db->prefix().
"c_forme_juridique as f, ".$this->
db->prefix().
"c_country as c";
529 $sql .=
" WHERE f.fk_pays=c.rowid";
530 $sql .=
" AND f.active = 1 AND c.active = 1";
531 if ($country_codeid) {
532 $sql .=
" AND c.code = '".$this->db->escape($country_codeid).
"'";
537 $sql .=
" ORDER BY c.code";
539 dol_syslog(get_class($this).
"::select_juridicalstatus", LOG_DEBUG);
542 $out .=
'<div id="particulier2" class="visible">';
543 $out .=
'<select class="flat minwidth200'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'" id="'.$htmlname.
'">';
544 if ($country_codeid) {
545 $out .=
'<option value="0"> </option>';
552 $arraydata = array();
554 $obj = $this->
db->fetch_object(
$resql);
557 $labelcountry = (($langs->trans(
"Country".$obj->country_code) !=
"Country".$obj->country_code) ? $langs->trans(
"Country".$obj->country_code) : $obj->country);
558 $labeljs = (($langs->trans(
"JuridicalStatus".$obj->code) !=
"JuridicalStatus".$obj->code) ? $langs->trans(
"JuridicalStatus".$obj->code) : ($obj->label !=
'-' ? $obj->label :
''));
559 $arraydata[$obj->code] = array(
'code'=>$obj->code,
'label'=>$labeljs,
'label_sort'=>$labelcountry.
'_'.$labeljs,
'country_code'=>$obj->country_code,
'country'=>$labelcountry);
565 if (empty($country_codeid)) {
566 $arraydata[0] = array(
'code'=>0,
'label'=>
'',
'label_sort'=>
'_',
'country_code'=>
'',
'country'=>
'');
569 foreach ($arraydata as $key => $val) {
570 if (!$country || $country != $val[
'country']) {
572 if (empty($country_codeid) && $val[
'country_code']) {
573 $out .=
'<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val[
'country'].
" -----</option>\n";
574 $country = $val[
'country'];
578 if ($selected > 0 && $selected == $val[
'code']) {
579 $out .=
'<option value="'.$val[
'code'].
'" selected>';
581 $out .=
'<option value="'.$val[
'code'].
'">';
584 $out .= $val[
'label'];
590 $out .=
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
594 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
619 public function selectCompaniesForNewContact($object, $var_id, $selected =
'', $htmlname =
'newcompany', $limitto =
'', $forceid = 0, $moreparam =
'', $morecss =
'')
621 global $conf, $hookmanager;
623 if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
625 $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2);
631 $result = $tmpthirdparty->fetch($selected);
634 $name = $tmpthirdparty->name;
645 $events[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php', 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
647 if (count($events)) {
648 print
'<script type="text/javascript">
649 jQuery(document).ready(function() {
650 $("#search_'.$htmlname.
'").change(function() {
651 var obj = '.json_encode($events).
';
652 $.each(obj, function(key,values) {
653 if (values.method.length) {
654 runJsCodeForEvent'.$htmlname.
'(values);
658 $(this).trigger("blur");
661 // Function used to execute events when search_htmlname change
662 function runJsCodeForEvent'.$htmlname.
'(obj) {
663 var id = $("#'.$htmlname.
'").val();
664 var method = obj.method;
666 var htmlname = obj.htmlname;
667 var showempty = obj.showempty;
668 console.log("Run runJsCodeForEvent-'.$htmlname.
' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
676 if (response != null)
678 console.log("Change select#"+htmlname+" with content "+response.value)
679 $.each(obj.params, function(key,action) {
681 var num = response.num;
683 $("#" + key).removeAttr(action);
685 $("#" + key).attr(action, action);
689 $("select#" + htmlname).html(response.value);
698 print
"\n".
'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'.
"\n";
699 print
'<input type="text" size="30" id="search_'.$htmlname.
'" name="search_'.$htmlname.
'" value="'.$name.
'" />';
700 print
ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.
'/societe/ajax/ajaxcompanies.php',
'', $minLength, 0);
704 $sql =
"SELECT s.rowid, s.nom as name ";
705 if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
706 $sql .=
", s.code_client, s.code_fournisseur";
708 if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
709 $sql .=
", s.address, s.zip, s.town";
710 $sql .=
", dictp.code as country_code";
712 $sql .=
" FROM ".$this->db->prefix().
"societe as s";
713 if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
714 $sql .=
" LEFT JOIN ".$this->db->prefix().
"c_country as dictp ON dictp.rowid = s.fk_pays";
716 $sql .=
" WHERE s.entity IN (".getEntity(
'societe').
")";
718 if (is_array($limitto) && count($limitto)) {
719 $sql .=
" AND s.rowid IN (".$this->db->sanitize(join(
',', $limitto)).
")";
722 $parameters = array();
723 $reshook = $hookmanager->executeHooks(
'selectCompaniesForNewContactListWhere', $parameters);
724 $sql .= $hookmanager->resPrint;
725 $sql .=
" ORDER BY s.nom ASC";
729 print
'<select class="flat'.($morecss ?
' '.$morecss :
'').
'" id="'.$htmlname.
'" name="'.$htmlname.
'"';
730 if ($conf->use_javascript_ajax) {
731 $javaScript =
"window.location='".dol_escape_js($_SERVER[
'PHP_SELF']).
"?".$var_id.
"=".($forceid > 0 ? $forceid : $object->id).$moreparam.
"&".$htmlname.
"=' + form.".$htmlname.
".options[form.".$htmlname.
".selectedIndex].value;";
732 print
' onChange="'.$javaScript.
'"';
735 print
'<option value="-1"> </option>';
741 $obj = $this->
db->fetch_object(
$resql);
743 $firstCompany = $obj->rowid;
746 if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) {
749 if ($selected > 0 && $selected == $obj->rowid) {
750 print
'<option value="'.$obj->rowid.
'"';
754 print
' selected>'.dol_trunc($obj->name, 24).
'</option>';
755 $firstCompany = $obj->rowid;
757 print
'<option value="'.$obj->rowid.
'"';
761 print
'>'.dol_trunc($obj->name, 24).
'</option>';
768 return $firstCompany;
790 public function selectTypeContact($object, $selected, $htmlname =
'type', $source =
'internal', $sortorder =
'position', $showempty = 0, $morecss =
'', $output = 1, $forcehidetooltip = 0)
792 global $user, $langs;
795 if (is_object($object) && method_exists($object,
'liste_type_contact')) {
796 $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
798 $out .=
'<select class="flat valignmiddle'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'" id="'.$htmlname.
'">';
800 $out .=
'<option value="0"> </option>';
802 foreach ($lesTypes as $key => $value) {
803 $out .=
'<option value="'.$key.
'"';
804 if ($key == $selected) {
807 $out .=
'>'.$value.
'</option>';
810 if ($user->admin && empty($forcehidetooltip)) {
811 $out .=
' '.info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
818 if (empty($output)) {
835 public function showRoles($htmlname,
Contact $contact, $rendermode =
'view', $selected = array(), $morecss =
'minwidth500')
837 if ($rendermode ===
'view') {
839 foreach ($contact->roles as $key => $val) {
840 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val[
'label'].
'</li>';
842 return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.
'"><ul class="select2-choices-dolibarr">'.implode(
' ', $toprint).
'</ul></div>';
845 if ($rendermode ===
'edit') {
846 $contactType = $contact->listeTypeContacts(
'external',
'', 1,
'',
'',
'agenda');
847 if (count($selected) > 0) {
848 $newselected = array();
849 foreach ($selected as $key => $val) {
850 if (is_array($val) && array_key_exists(
'id', $val) && in_array($val[
'id'], array_keys($contactType))) {
851 $newselected[] = $val[
'id'];
856 if (count($newselected) > 0) {
857 $selected = $newselected;
860 return $this->
multiselectarray($htmlname, $contactType, $selected, 0, 0, $morecss);
863 return 'ErrorBadValueForParameterRenderMode';
879 public function select_ziptown($selected =
'', $htmlname =
'zipcode', $fields =
'', $fieldsize = 0, $disableautocomplete = 0, $moreattrib =
'', $morecss =
'')
887 if (!empty($fieldsize)) {
888 $size =
'size="'.$fieldsize.
'"';
891 if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
893 $moreattrib .=
' autocomplete="off"';
895 $out .=
'<input id="'.$htmlname.
'" class="maxwidthonsmartphone'.($morecss ?
' '.$morecss :
'').
'" type="text"'.($moreattrib ?
' '.$moreattrib :
'').
' name="'.$htmlname.
'" '.$size.
' value="'.$selected.
'">'.
"\n";
911 public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss =
'maxwidth100onsmartphone quatrevingtpercent')
914 global $conf, $langs, $hookmanager;
917 if (empty($conf->global->MAIN_DISABLEPROFIDRULES)) {
918 if ($country_code ==
'FR') {
919 if (isset($idprof)) {
922 } elseif ($idprof == 2) {
924 } elseif ($idprof == 3) {
926 } elseif ($idprof == 4) {
930 } elseif ($country_code ==
'ES') {
946 $selected = $preselected;
947 if (!$selected && isset($idprof)) {
948 if ($idprof == 1 && !empty($this->idprof1)) {
949 $selected = $this->idprof1;
950 } elseif ($idprof == 2 && !empty($this->idprof2)) {
951 $selected = $this->idprof2;
952 } elseif ($idprof == 3 && !empty($this->idprof3)) {
953 $selected = $this->idprof3;
954 } elseif ($idprof == 4 && !empty($this->idprof4)) {
955 $selected = $this->idprof4;
959 $maxlength = $formlength;
960 if (empty($formlength)) {
968 $parameters = array(
'formlength'=>$formlength,
'selected'=>$preselected,
'idprof'=>$idprof,
'htmlname'=>$htmlname,
'country_code'=>$country_code);
969 $reshook = $hookmanager->executeHooks(
'getInputIdProf', $parameters);
970 if (empty($reshook)) {
971 $out .=
'<input type="text" '.($morecss ?
'class="'.$morecss.
'" ' :
'').
'name="'.$htmlname.
'" id="'.$htmlname.
'" maxlength="'.$maxlength.
'" value="'.$selected.
'">';
973 $out .= $hookmanager->resPrint;
992 $num = $this->
db->num_rows($tax);
995 $valors = explode(
":", $tax);
997 if (count($valors) > 1) {
999 print
'<select class="flat" name="'.$htmlname.
'" id="'.$htmlname.
'">';
1000 while ($i <= (count($valors)) - 1) {
1001 if ($selected == $valors[$i]) {
1002 print
'<option value="'.$valors[$i].
'" selected>';
1004 print
'<option value="'.$valors[$i].
'">';
1026 public function selectProspectCustomerType($selected, $htmlname =
'client', $htmlidname =
'customerprospect', $typeinput =
'form', $morecss =
'', $allowempty =
'')
1028 global $conf, $langs;
1029 if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && !
isModEnabled(
'fournisseur')) {
1033 $out =
'<select class="flat '.$morecss.
'" name="'.$htmlname.
'" id="'.$htmlidname.
'">';
1034 if ($typeinput ==
'form') {
1035 if ($allowempty || ($selected ==
'' || $selected ==
'-1')) {
1036 $out .=
'<option value="-1">';
1037 if (is_numeric($allowempty)) {
1040 $out .= $langs->trans($allowempty);
1042 $out .=
'</option>';
1044 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
1045 $out .=
'<option value="2"'.($selected == 2 ?
' selected' :
'').
'>'.$langs->trans(
'Prospect').
'</option>';
1047 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
1048 $out .=
'<option value="3"'.($selected == 3 ?
' selected' :
'').
'>'.$langs->trans(
'ProspectCustomer').
'</option>';
1050 if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1051 $out .=
'<option value="1"'.($selected == 1 ?
' selected' :
'').
'>'.$langs->trans(
'Customer').
'</option>';
1053 $out .=
'<option value="0"'.((string) $selected ==
'0' ?
' selected' :
'').
'>'.$langs->trans(
'NorProspectNorCustomer').
'</option>';
1054 } elseif ($typeinput ==
'list') {
1055 $out .=
'<option value="-1"'.(($selected ==
'' || $selected ==
'-1') ?
' selected' :
'').
'> </option>';
1056 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
1057 $out .=
'<option value="2,3"'.($selected ==
'2,3' ?
' selected' :
'').
'>'.$langs->trans(
'Prospect').
'</option>';
1059 if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1060 $out .=
'<option value="1,3"'.($selected ==
'1,3' ?
' selected' :
'').
'>'.$langs->trans(
'Customer').
'</option>';
1063 $out .=
'<option value="4"'.($selected ==
'4' ?
' selected' :
'').
'>'.$langs->trans(
'Supplier').
'</option>';
1065 $out .=
'<option value="0"'.($selected ==
'0' ?
' selected' :
'').
'>'.$langs->trans(
'Other').
'</option>';
1066 } elseif ($typeinput ==
'admin') {
1067 if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
1068 $out .=
'<option value="3"'.($selected == 3 ?
' selected' :
'').
'>'.$langs->trans(
'ProspectCustomer').
'</option>';
1070 if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
1071 $out .=
'<option value="1"'.($selected == 1 ?
' selected' :
'').
'>'.$langs->trans(
'Customer').
'</option>';
1074 $out .=
'</select>';
1090 public function formThirdpartyType($page, $selected =
'', $htmlname =
'socid', $filter =
'', $nooutput = 0)
1093 global $conf, $langs;
1096 if ($htmlname !=
"none") {
1097 $out .=
'<form method="post" action="'.$page.
'">';
1098 $out .=
'<input type="hidden" name="action" value="set_thirdpartytype">';
1099 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1100 $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
1101 $out .= $this->
selectarray($htmlname, $this->
typent_array(0, $filter), $selected, 1, 0, 0,
'', 0, 0, 0, $sortparam,
'', 1);
1102 $out .=
'<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans(
"Modify").
'">';
1105 if ($selected > 0) {
1107 $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_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
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...
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $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.
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...
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$conf db
API class for accounts.