diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e2e3727bddb27c9d9c7980838bc07b781cf16521..1f5d14b75296e64c4e8921ce116e15fa1259f13e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3733,13 +3733,14 @@ class Form /** * Function to show a form to select a duration on a page * - * @param string $prefix prefix - * @param int $iSecond Default preselected duration (number of seconds) - * @param int $disabled Disable the combo box - * @param string $typehour if 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo + * @param string $prefix Prefix + * @param int $iSecond Default preselected duration (number of seconds) + * @param int $disabled Disable the combo box + * @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo + * @param string $minunderhours If 1, show minutes selection under the hours * @return void */ - function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select') + function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0) { global $langs; @@ -3770,7 +3771,11 @@ class Form { print '<input type="text" size="3" name="'.$prefix.'hour" class="flat" value="'.((int) $hourSelected).'">'; } - print $langs->trans('Hours'). " "; + print $langs->trans('Hours'); + + if ($minunderhours) print '<br>'; + else print " "; + print '<select class="flat" name="'.$prefix.'min"'.($disabled?' disabled="disabled"':'').'>'; for ($min = 0; $min <= 55; $min=$min+5) { diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 7dae4a359ee9d0f0286f59214c3761a89c502001..551aa7b94a5beefadc6028fcea571894cff1ab9a 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1332,9 +1332,7 @@ else if ($id > 0 || ! empty($ref)) print '<input type="hidden" name="action" value="addline">'; } - /* - * Lignes d'intervention - */ + // Intervention lines $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; $sql.= ' ft.date as date_intervention'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; @@ -1419,7 +1417,7 @@ else if ($id > 0 || ! empty($ref)) print '</tr>'; } - // Ligne en mode update + // Line in update mode if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid) { print '<tr '.$bc[$var].'>'; @@ -1452,9 +1450,7 @@ else if ($id > 0 || ! empty($ref)) $db->free($resql); - /* - * Add line - */ + // Add new line if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') { if (! $num) print '<br><table class="noborder" width="100%">'; @@ -1483,14 +1479,16 @@ else if ($id > 0 || ! empty($ref)) print '<td align="center" class="nowrap">'; $now=dol_now(); $timearray=dol_getdate($now); - if (!GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); + if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']); else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int')); $form->select_date($timewithnohour,'di',1,1,0,"addinter"); print '</td>'; // Duration print '<td align="right">'; - $form->select_duration('duration',(!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int'))); + $selectmode='select'; + if (! empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) $selectmode='text'; + $form->select_duration('duration', (!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int')), 0, $selectmode, 1); print '</td>'; print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>'; @@ -1513,8 +1511,8 @@ else if ($id > 0 || ! empty($ref)) /* - * Barre d'actions - */ + * Actions buttons + */ print '<div class="tabsAction">'; if ($user->societe_id == 0)