Debug v18

This commit is contained in:
Laurent Destailleur 2023-02-23 21:40:56 +01:00
parent 4068b1db87
commit ed60d4fe22
2 changed files with 16 additions and 14 deletions

View File

@ -7009,8 +7009,8 @@ class Form
$retstring = '<span class="nowraponall">'; $retstring = '<span class="nowraponall">';
$hourSelected = 0; $hourSelected = '';
$minSelected = 0; $minSelected = '';
// Hours // Hours
if ($iSecond != '') { if ($iSecond != '') {
@ -7024,14 +7024,14 @@ class Form
$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours
$retstring .= '<option value="'.$hour.'"'; $retstring .= '<option value="'.$hour.'"';
if ($hourSelected == $hour) { if (is_numeric($hourSelected) && $hourSelected == $hour) {
$retstring .= " selected"; $retstring .= " selected";
} }
$retstring .= ">".$hour."</option>"; $retstring .= ">".$hour."</option>";
} }
$retstring .= "</select>"; $retstring .= "</select>";
} elseif ($typehour == 'text' || $typehour == 'textselect') { } elseif ($typehour == 'text' || $typehour == 'textselect') {
$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
} else { } else {
return 'BadValueForParameterTypeHour'; return 'BadValueForParameterTypeHour';
} }
@ -7046,21 +7046,23 @@ class Form
if ($minunderhours) { if ($minunderhours) {
$retstring .= '<br>'; $retstring .= '<br>';
} else { } else {
$retstring .= '<span class="hideonsmartphone">&nbsp;</span>'; if ($typehour != 'text') {
$retstring .= '<span class="hideonsmartphone">&nbsp;</span>';
}
} }
if ($typehour == 'select' || $typehour == 'textselect') { if ($typehour == 'select' || $typehour == 'textselect') {
$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
for ($min = 0; $min <= 55; $min = $min + 5) { for ($min = 0; $min <= 55; $min = $min + 5) {
$retstring .= '<option value="'.$min.'"'; $retstring .= '<option value="'.$min.'"';
if ($minSelected == $min) { if (is_numeric($minSelected) && $minSelected == $min) {
$retstring .= ' selected'; $retstring .= ' selected';
} }
$retstring .= '>'.$min.'</option>'; $retstring .= '>'.$min.'</option>';
} }
$retstring .= "</select>"; $retstring .= "</select>";
} elseif ($typehour == 'text') { } elseif ($typehour == 'text') {
$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
} }
if ($typehour != 'text') { if ($typehour != 'text') {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
@ -1921,20 +1921,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Duration - Time spent // Duration - Time spent
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
$durationtouse_start = 0; $durationtouse_start = '';
if ($search_timespent_starthour || $search_timespent_startmin) { if ($search_timespent_starthour || $search_timespent_startmin) {
$durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60);
} }
print '<div class="nowraponall">'.$langs->trans('from').'&nbsp;'; print '<div class="nowraponall">'.$langs->trans('from').' ';
$form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text'); print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1);
print '</div>'; print '</div>';
$durationtouse_end = 0; $durationtouse_end = '';
if ($search_timespent_endhour || $search_timespent_endmin) { if ($search_timespent_endhour || $search_timespent_endmin) {
$durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60);
} }
print '<div class="nowraponall">'.$langs->trans('at').'&nbsp;'; print '<div class="nowraponall">'.$langs->trans('at').' ';
$form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text'); print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1);
print '</div>'; print '</div>';
print '</td>'; print '</td>';