66 public function select_type_socialcontrib($selected = 0, $htmlname =
'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss =
'minwidth300', $noerrorifempty = 0)
69 global
$conf, $db, $langs, $user, $mysoc;
71 if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
72 print $langs->trans(
"ErrorSetupOfCountryMustBeDone");
76 if (!empty($mysoc->country_id)) {
77 $sql =
"SELECT c.id, c.libelle as type";
78 $sql .=
" FROM ".$this->db->prefix().
"c_chargesociales as c";
79 $sql .=
" WHERE c.active = 1";
80 $sql .=
" AND c.fk_pays = ".((int) $mysoc->country_id);
81 $sql .=
" ORDER BY c.libelle ASC";
83 $sql =
"SELECT c.id, c.libelle as type";
84 $sql .=
" FROM ".$this->db->prefix().
"c_chargesociales as c, ".$this->db->prefix().
"c_country as co";
85 $sql .=
" WHERE c.active = 1 AND c.fk_pays = co.rowid";
86 $sql .=
" AND co.code = '".$this->db->escape($mysoc->country_code).
"'";
87 $sql .=
" ORDER BY c.libelle ASC";
90 dol_syslog(
"Form::select_type_socialcontrib", LOG_DEBUG);
91 $resql = $this->db->query($sql);
93 $num = $this->db->num_rows($resql);
95 print
'<select class="'.($morecss ? $morecss :
'').
'" id="'.$htmlname.
'" name="'.$htmlname.
'">';
99 print
'<option value="0"> </option>';
102 $obj = $this->db->fetch_object($resql);
103 print
'<option value="'.$obj->id.
'"';
104 if ($obj->id == $selected) {
107 print
'>'.dol_trunc($obj->type, $maxlen);
111 if ($user->admin && $help) {
112 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
114 if (!empty(
$conf->use_javascript_ajax)) {
118 if (empty($noerrorifempty)) {
119 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=null, $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='', $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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...