#2686 UI does not warn when time begins after preferred work hours

open
Craig Knudsen
5
2013-01-14
2012-07-26
Guru Evi
No

The UI does warn when the time begins before preferred work hours with a JS pop-up box.

One of our users noted this does not happen when the time begins AFTER work hours. Quick & Dirty Fix:

includes/js/edit_entry.php

Line 32:

if ( form.timetype &&
form.timetype.selectedIndex == 1 ) {
h = parseInt (isNumeric( form.entry_hour.value ));
m = parseInt (isNumeric( form.entry_minute.value ));

// Ask for confirmation for time of day if it is before the user's
// preference for work hours.
// Modified by Evi Vanoost (vanooste)
confirm_str = '';
<?php
$before_str = translate ( 'The time you have entered begins before your preferred work hours. Is this correct?' );
$after_str = translate ( 'The time you have entered begins after your preferred work hours. Is this correct?' );
if ($GLOBALS['TIME_FORMAT'] == "24") {
echo "if ( h >= $WORK_DAY_END_HOUR ) {";
echo "confirm_str = '" . $after_str . "' }";
echo "else if ( h < $WORK_DAY_START_HOUR ) {";
echo "confirm_str = '" . $before_str . "' }";
} else {
$ampmS = ($WORK_DAY_START_HOUR - 12 < 0) ? "ampmA" : "ampmP";
$ampmE = ($WORK_DAY_END_HOUR - 12 < 0) ? "ampmA" : "ampmP";
echo "if ( h < $WORK_DAY_START_HOUR && form.entry_".$ampmS.".checked ) {";
echo "confirm_str = '".$before_str."' }";
echo "else if ( h >= ".(($WORK_DAY_END_HOUR - 12 < 0) ? $WORK_DAY_END_HOUR : $WORK_DAY_END_HOUR - 12)." && form.entry_".$ampmE.".checked ) {";
echo "confirm_str = '" . $after_str . "' }";
}
?>
if ( confirm_str && ! confirm ( confirm_str )) {
confirm_str = '';
return false;
}
// End of modification by Evi Vanoost (vanooste)
}

Discussion