67 public function select_type_socialcontrib($selected = 0, $htmlname =
'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss =
'minwidth300', $noerrorifempty = 0, $noout = 0)
72 if (empty(
$mysoc->country_id) && empty(
$mysoc->country_code)) {
73 $out = $langs->trans(
"ErrorSetupOfCountryMustBeDone");
80 if (!empty(
$mysoc->country_id)) {
81 $sql =
"SELECT c.id, c.libelle as type";
82 $sql .=
" FROM ".$this->db->prefix().
"c_chargesociales as c";
83 $sql .=
" WHERE c.active = 1";
84 $sql .=
" AND c.fk_pays = ".((int)
$mysoc->country_id);
85 $sql .=
" ORDER BY c.libelle ASC";
87 $sql =
"SELECT c.id, c.libelle as type";
88 $sql .=
" FROM ".$this->db->prefix().
"c_chargesociales as c, ".$this->db->prefix().
"c_country as co";
89 $sql .=
" WHERE c.active = 1 AND c.fk_pays = co.rowid";
90 $sql .=
" AND co.code = '".$this->db->escape(
$mysoc->country_code).
"'";
91 $sql .=
" ORDER BY c.libelle ASC";
94 dol_syslog(
"Form::select_type_socialcontrib", LOG_DEBUG);
98 $resql = $this->db->query($sql);
100 $num = $this->db->num_rows($resql);
102 $out .=
'<select class="'.($morecss ? $morecss :
'').
'" id="'.$htmlname.
'" name="'.$htmlname.
'">';
106 $out .=
'<option value="-1">';
107 if (!is_numeric($useempty)) {
115 $obj = $this->db->fetch_object($resql);
116 $out .=
'<option value="'.$obj->id.
'"';
117 if ($obj->id == $selected) {
120 $out .=
'>'.dol_trunc($obj->type, $maxlen);
124 if ($user->admin && $help) {
125 $out .=
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
127 if (!empty(
$conf->use_javascript_ajax)) {
131 if (empty($noerrorifempty)) {
132 $out .= $langs->trans(
"ErrorNoSocialContributionForSellerCountry",
$mysoc->country_code);
136 dol_print_error($this->db);
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
Convert a html select field into an ajax combobox.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.