From 559b75c49bbec28d9141310c9ec4d2d9cb0944bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Oct 2013 12:14:14 +0200 Subject: [PATCH] New: Add hidden option MAIN_FORCE_DEFAULT_STATE_ID. --- ChangeLog | 3 ++- htdocs/core/class/html.formcompany.class.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22b71858b4c75..bbea29ab68ba8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,7 +61,8 @@ For users: - New: Can send an email from thirdparty card. - New: Can cancel holidays that were previously validated. - Fix: [bug #1022] correct margin calculation for credit notes. -- New: Can choose contact on event (action com) creation, and filtred by thirdparty +- New: Can choose contact on event (action com) creation, and filtred by thirdparty. +- New: Add hidden option MAIN_FORCE_DEFAULT_STATE_ID. For translators: - Qual: Normalized sort order of all languages files with english reference files. diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a6210be79c662..cc295197119a9 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -203,7 +203,7 @@ function select_departement($selected='',$country_codeid=0, $htmlname='state_id' * un code donnee mais dans ce cas, le champ pays differe). * Ainsi les liens avec les departements se font sur un departement independemment de son nom. * - * @param string $selected Code state preselected + * @param string $selected Code state preselected (mus be state id) * @param string $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 * @return string String with HTML select @@ -257,7 +257,8 @@ function select_state($selected='',$country_codeid=0, $htmlname='state_id') } } - if ($selected > 0 && $selected == $obj->rowid) + if ((! empty($selected) && $selected == $obj->rowid) + || (empty($selected) && ! empty($conf->global->MAIN_FORCE_DEFAULT_STATE_ID) && $conf->global->MAIN_FORCE_DEFAULT_STATE_ID == $obj->rowid)) { $out.= '