This commit is contained in:
Laurent Destailleur 2021-12-10 15:57:10 +01:00
parent dcd8c0f53d
commit 5bca7cf5f1
2 changed files with 5 additions and 4 deletions

View File

@ -425,14 +425,14 @@ if ($user->admin) {
}
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td>';
$state_id = 0;
if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE)) {
$tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
$state_id = $tmp[0];
}
print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id');
print $formcompany->select_state($state_id, $mysoc->country_code, 'state_id', 'maxwidth200onsmartphone minwidth300');
print '</td></tr>'."\n";
// Currency

View File

@ -266,10 +266,11 @@ class FormCompany extends Form
* @param int $selected Code state preselected (mus be state id)
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department. If '', we want only the string with <option>
* @param string $morecss Add more css
* @return string String with HTML select
* @see select_country()
*/
public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'state_id')
public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300')
{
// phpcs:enable
global $conf, $langs, $user;
@ -296,7 +297,7 @@ class FormCompany extends Form
$result = $this->db->query($sql);
if ($result) {
if (!empty($htmlname)) {
$out .= '<select id="'.$htmlname.'" class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'">';
$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
}
if ($country_codeid) {
$out .= '<option value="0">&nbsp;</option>';