mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Properly handle the case where a questionnaire is not shift restricted
This commit is contained in:
@@ -141,7 +141,7 @@ else if(isset($_GET['respondent_id']))
|
||||
|
||||
display_calendar($respondent_id,$questionnaire_id,$year,$month,$day);
|
||||
|
||||
display_time($respondent_id,$day,$month,$year,isset($_GET['start'])?$_GET['start']:false,isset($_GET['end'])?$_GET['end']:false);
|
||||
display_time($questionnaire_id,$respondent_id,$day,$month,$year,isset($_GET['start'])?$_GET['start']:false,isset($_GET['end'])?$_GET['end']:false);
|
||||
|
||||
if (isset($_GET['end']) && isset($_GET['start']))
|
||||
{
|
||||
|
||||
@@ -255,6 +255,7 @@ function display_respondent_form($respondent_id = false,$case_id = false)
|
||||
*
|
||||
* @see make_appointment()
|
||||
*
|
||||
* @param int $questionnaire_id The questionnaire id
|
||||
* @param int $respondent_id The respondent id
|
||||
* @param int $day the day of the month
|
||||
* @param int $month the month of the year
|
||||
@@ -264,10 +265,16 @@ function display_respondent_form($respondent_id = false,$case_id = false)
|
||||
*
|
||||
* @todo Handle questionnaires without shift restrictions
|
||||
*/
|
||||
function display_time($respondent_id, $day, $month, $year, $time = false, $timeend = false)
|
||||
function display_time($questionnaire_id,$respondent_id, $day, $month, $year, $time = false, $timeend = false)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$restricted = is_shift_restricted($questionnaire_id);
|
||||
|
||||
|
||||
if ($restricted)
|
||||
{
|
||||
/**
|
||||
* Select shift start and end times for this day
|
||||
*/
|
||||
@@ -281,6 +288,13 @@ function display_time($respondent_id, $day, $month, $year, $time = false, $timee
|
||||
AND YEAR(CONVERT_TZ(s.start,'UTC', r.Time_zone_name)) = '$year'
|
||||
ORDER BY s.start ASC";
|
||||
|
||||
}
|
||||
else
|
||||
$sql = "SELECT 0 as sh, 0 as sm, !(DATE(CONVERT_TZ(NOW(),'System',r.Time_zone_name)) = DATE(CONVERT_TZ('$year-$month-$day 00:00:00','UTC',r.Time_zone_name))) as today, HOUR(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as eh, MINUTE(TIME(CONVERT_TZ(NOW(),'System',r.Time_zone_name))) as em, (TIME_TO_SEC( TIMEDIFF( TIME( CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ) , 'System', r.Time_zone_name ) ) , TIME( CONVERT_TZ( CURDATE(), 'System', r.Time_zone_name ) ) ) ) /300) as intervals, TIME(CONVERT_TZ(CURDATE(),'System',r.Time_zone_name)) as start, TIME(CONVERT_TZ(DATE_ADD( CURDATE( ) , INTERVAL '23:59:59' HOUR_SECOND ),'System',r.Time_zone_name)) as end
|
||||
FROM respondent as r
|
||||
WHERE r.respondent_id = '$respondent_id'";
|
||||
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "<div class=\"shifts\">";
|
||||
|
||||
Reference in New Issue
Block a user