diff --git a/ajax_actions/ajax_schedule_reservations.php b/ajax_actions/ajax_schedule_reservations.php index effe8fb..8195079 100755 --- a/ajax_actions/ajax_schedule_reservations.php +++ b/ajax_actions/ajax_schedule_reservations.php @@ -123,26 +123,6 @@ } - //kills all tests -// $intSchedDur = util_durToInt($strScheduleDuration); -//util_prePrintR($intSchedDur); -//util_prePrintR(($reservRestrictionMax)); -//util_prePrintR($reservRestrictionMin); -// -// # check if duration time matches reservation restrictions -// # check this with a test? -// if (!($intSchedDur >= $reservRestrictionMin && $intSchedDur <= $reservRestrictionMax)) { -// $results['note'] = 'not within reservation restrictions'; -// echo json_encode($results); -// exit; -// } -// -// # check if duration interval matches reservation restrictions -// if (!($intSchedDur % $reservRestrictionDur == 0)) { -// $results['note'] = 'does not follow duration restriction'; -// echo json_encode($results); -// exit; -// } # TODO: NOTE this is obsolete as the EqGroup::getOneFromDb above returns false if eq_group.flag_delete = true # check that eq_group is active diff --git a/calendar_util.php b/calendar_util.php index 9d1cedd..efa19f4 100755 --- a/calendar_util.php +++ b/calendar_util.php @@ -161,11 +161,12 @@ function renderItemRows($items,$headings,$scheds,$month,$day,$year) //******** to find rounded start time: //******** round the timeblock_start_time minutes to the nearest quarter hour using the formula and convert to date ## else if start time % 15 == 0 then use regular start time (not rounded) and have start percentage = 100 - if ($start_minute == 'x') { + if ($start_minute === 'x') { $sched_tb_round = '00:00:00'; $start_percent[timetoInt($sched_tb_round)] = 100; //the duration should only go until the end time block } elseif ($start_minute % 15 != 0) { + while ($start_minute > 15) { $start_minute -= 15; } @@ -192,17 +193,15 @@ function renderItemRows($items,$headings,$scheds,$month,$day,$year) } ## finds the start box based upon the start time given (rounded or unrounded) and relates it to the duration - $starts[timetoInt($sched_tb_round)] = durationToInt($duration); - + $starts[timetoInt($sched_tb_round)] = array(durationToInt($duration), $sched->reservations[0]->user); } elseif (strtotime(substr($start_tb, 0, 10)) < strtotime($year . '-' . $month . '-' . $day) && strtotime($year . '-' . $month . '-' . $day) < strtotime(substr($end_tb, 0, 10))) { $sched_tb_round = '00:00:00'; $start_percent[timetoInt($sched_tb_round)] = 100; $end_percent[timetoInt($sched_tb_round)] = 100; - ## finds the start box based upon the start time given (rounded or unrounded) and relates it to the duration - $starts[timetoInt($sched_tb_round)] = array(durationToInt($sched->timeblock_duration),$sched->reservations[0]->user); - + ## finds the start box based upon the start time given (rounded or unrounded) and relates it to the duration + $starts[timetoInt($sched_tb_round)] = array(durationToInt($sched->timeblock_duration),$sched->reservations[0]->user); } } } @@ -234,10 +233,7 @@ function renderItemRows($items,$headings,$scheds,$month,$day,$year) ## If the start percent is 100 (or the reservation starts on a quarter marker) then just fill in the box ## Else have to fill in according to the percentages if ($start_percent[$x] == 100) { - $rows .= '
Schedule conflicts or failure to follow the reservation restrictions will result in a reservation error.