diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index c4aaab27a84..12cf8893005 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5234,10 +5234,12 @@ class Form
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
+ * @param string $openinghours Specify hour strat and hour end for the select ex 8,20
+ * @param int $stepminutes Specify step for minutes between 1 and 30
* @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
- public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '')
+ public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1)
{
global $conf,$langs;
@@ -5248,6 +5250,7 @@ class Form
if ($m == '') $m=0;
$emptydate=0;
$emptyhours=0;
+ if ($stepminutes<=0 || $stepminutes>30) $stepminutes = 1;
if ($empty == 1) { $emptydate=1; $emptyhours=1; }
if ($empty == 2) { $emptydate=0; $emptyhours=1; }
$orig_set_time=$set_time;
@@ -5468,10 +5471,18 @@ class Form
if ($h)
{
+ $hourstart = 0;
+ $hourend = 24;
+ if ($openinghours != '') {
+ $openinghours = explode(',', $openinghours);
+ $hourstart = $openinghours[0];
+ $hourend = $openinghours[1];
+ if ($hourend<$hourstart) $hourend = $hourstart;
+ }
// Show hour
$retstring.='