From 36616cdd5047788b6b7d9a05ca0eec49cd1c9639 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Apr 2018 10:07:27 +0200 Subject: [PATCH] FIX When time is entered without hour, edit keeps this --- htdocs/core/class/html.form.class.php | 6 ++++-- htdocs/projet/tasks.php | 6 +++--- htdocs/projet/tasks/time.php | 14 +++++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e143def17ee..ccd873ece8a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4776,8 +4776,8 @@ class Form * * @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date (emptydate must be 0). * @param string $prefix Prefix for fields name - * @param int $h 1=Show also hours (-1 has same effect, but hour and minutes are prefilled with 23:59 if $set_time = -1) - * @param int $m 1=Show also minutes + * @param int $h 1 or 2=Show also hours (2=hours on a new line), -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show hour always empty + * @param int $m 1=Show also minutes, -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show minutes always empty * @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only * @param string $form_name Not used * @param int $d 1=Show days, month, years @@ -4850,6 +4850,8 @@ class Form $smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? ($h == -1 ? '59' : '') : $conf->global->MAIN_DEFAULT_DATE_MIN; $ssec = !isset($conf->global->MAIN_DEFAULT_DATE_SEC) ? ($h == -1 ? '59' : '') : $conf->global->MAIN_DEFAULT_DATE_SEC; } + if ($h == 3) $shour = ''; + if ($m == 3) $smin = ''; // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' $usecalendar='combo'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index e29a1d6826e..67dd84a1572 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -464,16 +464,16 @@ else if ($id > 0 || ! empty($ref)) { if ($object->public || $userWrite > 0) { - $linktocreatetask = ''.$langs->trans('AddTask').''; + $linktocreatetask = ''.$langs->trans('AddTask').''; } else { - $linktocreatetask = ''.$langs->trans('AddTask').''; + $linktocreatetask = ''.$langs->trans('AddTask').''; } } else { - $linktocreatetask = ''.$langs->trans('AddTask').''; + $linktocreatetask = ''.$langs->trans('AddTask').''; } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 701a74760dd..0f2ec5f9fcd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -420,16 +420,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) { if ($projectstatic->public || $userWrite > 0) { - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; } else { - $linktocreatetime = ''.$langs->trans('AddTime').''; + $linktocreatetime = ''.$langs->trans('AddTime').''; } } else { - $linktocreatetime = ''.$langs->trans('AddTime').''; + $linktocreatetime = ''.$langs->trans('AddTime').''; } //} } @@ -949,7 +949,11 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { - print $form->select_date(($date2?$date2:$date1),'timeline',1,1,2,"timespent_date",1,0,1); + if (empty($task_time->task_date_withhour)) + { + print $form->select_date(($date2?$date2:$date1),'timeline',3,3,2,"timespent_date",1,0,1); + } + else print $form->select_date(($date2?$date2:$date1),'timeline',1,1,2,"timespent_date",1,0,1); } else { @@ -1086,7 +1090,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print '';