From dce0c385333e39cd678aaa1f07873863e9ae3c2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Jun 2014 16:06:59 +0200 Subject: [PATCH] Fix: Add hidden option so we can restore old behaviour (duration is free) for people that can't work with new one. --- htdocs/core/class/html.form.class.php | 17 +++++++++++------ htdocs/fichinter/fiche.php | 20 +++++++++----------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e2e3727bddb27..1f5d14b75296e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3733,13 +3733,14 @@ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_nam /** * 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 @@ function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select') { print ''; } - print $langs->trans('Hours'). " "; + print $langs->trans('Hours'); + + if ($minunderhours) print '
'; + else print " "; + print ''; } - /* - * 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 @@ print ''; } - // 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 ''; @@ -1452,9 +1450,7 @@ $db->free($resql); - /* - * Add line - */ + // Add new line if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline') { if (! $num) print '
'; @@ -1483,14 +1479,16 @@ print ''; // Duration print ''; print ''; @@ -1513,8 +1511,8 @@ /* - * Barre d'actions - */ + * Actions buttons + */ print '
'; if ($user->societe_id == 0)
'; $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 ''; - $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 '