2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

New feature: Allow restricting appointment to just yourself

This commit is contained in:
Adam Zammit
2013-03-07 15:32:09 +11:00
parent 33b3091ad3
commit e311c1df7b
5 changed files with 44 additions and 10 deletions

View File

@@ -77,18 +77,22 @@ function add_contact_phone($case_id,$phone)
* @param int $y the year (4 digit)
* @param string $start The time in the format HH:MM:SS
* @param string $end The time in the format HH:MM:SS
* @param string|int $require_operator_id False if for any operator otherwise restrict this appointment to a particular operator
* @return bool Result false if failed to add else true
*/
function make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$d,$m,$y,$start,$end)
function make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$d,$m,$y,$start,$end,$require_operator_id = false)
{
global $db;
$start = "$y-$m-$d $start";
$end= "$y-$m-$d $end";
if ($require_operator_id == false)
$require_operator_id = "NULL";
$sql = "INSERT INTO `appointment`
(appointment_id,case_id,contact_phone_id,call_attempt_id,start,end,require_operator_id,respondent_id,completed_call_id)
SELECT NULL,'$case_id','$contact_phone_id','$call_attempt_id',CONVERT_TZ('$start',r.Time_zone_name,'UTC'),CONVERT_TZ('$end',r.Time_zone_name,'UTC'),NULL,$respondent_id,NULL
SELECT NULL,'$case_id','$contact_phone_id','$call_attempt_id',CONVERT_TZ('$start',r.Time_zone_name,'UTC'),CONVERT_TZ('$end',r.Time_zone_name,'UTC'),$require_operator_id,$respondent_id,NULL
FROM respondent as r
WHERE r.respondent_id = '$respondent_id'";