Update time_condition_edit.php

Time condition time-of-day use 1 minute increments this solves multiple problems and more flexible for minutes 0 - 59.
This commit is contained in:
FusionPBX
2016-09-13 19:43:02 -06:00
committed by GitHub
parent 89a5f06bb7
commit 53b701c398

View File

@@ -296,10 +296,10 @@
if ($cond_var == 'time-of-day') {
$cond_var = 'minute-of-day';
$array_cond_start = explode(':', $cond_start);
$cond_start = ($array_cond_start[0] * 60) + $array_cond_start[1] + 1;
$cond_start = ($array_cond_start[0] * 60) + $array_cond_start[1];
if ($cond_stop != '') {
$array_cond_stop = explode(':', $cond_stop);
$cond_stop = ($array_cond_stop[0] * 60) + $array_cond_stop[1] + 1;
$cond_stop = ($array_cond_stop[0] * 60) + $array_cond_stop[1];
}
}
@@ -758,7 +758,7 @@
case 'time-of-day': //time of day
for (h = 0; h <= 23; h++) {
for (m = 0; m <= 55; m += 5) {
for (m = 0; m <= 59; m += 1) {
sel_start.options[sel_start.options.length] = new Option(((h != 0) ? ((h >= 12) ? ((h == 12) ? h : (h - 12)) + ':' + pad(m, 2) + ' PM' : h + ':' + pad(m, 2) + ' AM') : '12:' + pad(m, 2) + ' AM'), pad(h, 2) + ':' + pad(m, 2));
sel_stop.options[sel_stop.options.length] = new Option(((h != 0) ? ((h >= 12) ? ((h == 12) ? h : (h - 12)) + ':' + pad(m, 2) + ' PM' : h + ':' + pad(m, 2) + ' AM') : '12:' + pad(m, 2) + ' AM'), pad(h, 2) + ':' + pad(m, 2));
}
@@ -960,8 +960,6 @@ if ($action == 'update') {
//convert minute-of-day to time-of-day values
if ($cond_var == 'minute-of-day') {
$cond_var = 'time-of-day';
--$cond_val_start;
--$cond_val_stop;
$cond_val_start = number_pad(floor($cond_val_start / 60),2).":".number_pad(fmod($cond_val_start, 60),2);
if ($cond_val_stop != '') {
$cond_val_stop = number_pad(floor($cond_val_stop / 60),2).":".number_pad(fmod($cond_val_stop, 60),2);