65 public function select_type_socialcontrib($selected =
'', $htmlname =
'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss =
'minwidth300', $noerrorifempty = 0)
68 global $conf, $db, $langs, $user, $mysoc;
70 if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
71 print $langs->trans(
"ErrorSetupOfCountryMustBeDone");
75 if (!empty($mysoc->country_id)) {
76 $sql =
"SELECT c.id, c.libelle as type";
77 $sql .=
" FROM ".$this->db->prefix().
"c_chargesociales as c";
78 $sql .=
" WHERE c.active = 1";
79 $sql .=
" AND c.fk_pays = ".((int) $mysoc->country_id);
80 $sql .=
" ORDER BY c.libelle ASC";
82 $sql =
"SELECT c.id, c.libelle as type";
83 $sql .=
" FROM ".$this->db->prefix().
"c_chargesociales as c, ".$this->db->prefix().
"c_country as co";
84 $sql .=
" WHERE c.active = 1 AND c.fk_pays = co.rowid";
85 $sql .=
" AND co.code = '".$this->db->escape($mysoc->country_code).
"'";
86 $sql .=
" ORDER BY c.libelle ASC";
89 dol_syslog(
"Form::select_type_socialcontrib", LOG_DEBUG);
90 $resql = $this->db->query($sql);
92 $num = $this->db->num_rows($resql);
94 print
'<select class="'.($morecss ? $morecss :
'').
'" id="'.$htmlname.
'" name="'.$htmlname.
'">';
98 print
'<option value="0"> </option>';
101 $obj = $this->db->fetch_object($resql);
102 print
'<option value="'.$obj->id.
'"';
103 if ($obj->id == $selected) {
106 print
'>'.dol_trunc($obj->type, $maxlen);
110 if ($user->admin && $help) {
111 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
113 if (!empty($conf->use_javascript_ajax)) {
117 if (empty($noerrorifempty)) {
118 print $langs->trans(
"ErrorNoSocialContributionForSellerCountry", $mysoc->country_code);
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.