Preselect model if there is only one. This save 2 clicks.

This commit is contained in:
Laurent Destailleur 2011-06-15 20:21:25 +00:00
parent e540dd5aef
commit ccf0f96c76
3 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,8 @@ For users:
- When creating a contract, sales representative are preset to user. This save
4 clicks.
- Can edit several fields in bank transaction line page into one update.
- Creation of contacts from third party page go back to third party.
- Creation of contacts from third party page go back to third party.
- Preselect model if there is only one. This save 2 clicks.
- New: Enhance donation module. Add a status "canceled".
- New: Add filters on statistics page reports.
- New: Usage of Jquery Notify to show result or error messages on action.

View File

@ -3141,7 +3141,7 @@ class Form
if (is_array($array))
{
while (list($key, $value) = each ($array))
foreach($array as $key => $value)
{
$out.='<option value="'.($value_as_key?$value:$key).'"';
// Si il faut pre-selectionner une valeur

View File

@ -363,6 +363,11 @@ class FormFile
{
print '<td align="center" class="formdoc">';
print $langs->trans('Model').' ';
if (is_array($modellist) && sizeof($modellist) == 1) // If there is only one element
{
$arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0];
}
print $html->selectarray('model',$modellist,$modelselected,$showempty,0,0);
if (sizeof($cgvlist) > 0)
{