From 45cd615bf5dfadaed80809cd49904bb127494861 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 6 Dec 2010 19:05:45 +0000 Subject: [PATCH] Fix: use curent year if selected by default is not defined --- htdocs/core/class/html.form.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 69f25043fdd..0181a09dcbc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3095,12 +3095,12 @@ class Form * \param $max_year Valeur maximum de l'annee dans la liste (par defaut annee courante + 5) * TODO Move into html.formother */ - function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year='', $max_year='') + function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5) { - if($max_year == '') - $max_year = date("Y") +5; - if($min_year == '') - $min_year = date("Y") - 10; + $currentyear = date("Y"); + $max_year = $currentyear+$max_year; + $min_year = $currentyear-$min_year; + if(empty($selected)) $selected = $currentyear; print '