diff --git a/appointment.php b/appointment.php
index fe0f3fba..e608c474 100644
--- a/appointment.php
+++ b/appointment.php
@@ -69,6 +69,8 @@ $db->StartTrans();
$operator_id = get_operator_id();
$questionnaire_id = get_questionnaire_id($operator_id);
$case_id = get_case_id($operator_id);
+$call_attempt_id = get_call_attempt($operator_id, false);
+if (isset($_GET['respondent_id']))$respondent_id = bigintval($_GET['respondent_id']); else $respondent_id = get_respondent_id($call_attempt_id);
if (!$case_id){
xhtml_head(T_("Appointment error"));
@@ -127,24 +129,23 @@ xhtml_head(T_("Create appointment"),false,array("include/bootstrap/css/bootstrap
//select a respondent from a list or create a new one
print "
" . T_("Respondent") . ":";
-$sr = display_respondent_list($case_id,isset($_GET['respondent_id'])?bigintval($_GET['respondent_id']):false,true);
+if (isset($_GET['respondent_id'])) $respondent_id = bigintval($_GET['respondent_id']);
+display_respondent_list($case_id,isset($respondent_id)?$respondent_id:false,true);
print " ";
-if ($sr != false) $_GET['respondent_id'] = $sr;
if(isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
//ability to create a new one
?>
-
+
GetRow($sql);
@@ -244,7 +245,7 @@ else if(isset($_GET['respondent_id']))
}
}
- print "
";
+ print "
";
xhtml_foot();
diff --git a/functions/functions.calendar.php b/functions/functions.calendar.php
index cfa942a1..67a0b727 100644
--- a/functions/functions.calendar.php
+++ b/functions/functions.calendar.php
@@ -190,26 +190,20 @@ function display_respondent_list($case_id,$respondent_id = false,$first = false)
$rs = $db->GetAll($sql);
if (count($rs) >1 ){
- print "" . T_("Select a respondent") . ":
- " . T_("None") . " ";
+ print "" . T_("Select a respondent") . " :
+ ";//" . T_("None") . "
if (!empty($rs))
{
foreach($rs as $r)
{
- $rid = $r['respondent_id'];
- if ($respondent_id == false && $first == true)
- {
- $first = false;
- $selected = "selected='selected'";
- $respondent_id = $rid;
- }
- else $selected = "";
-
- if ($rid == $respondent_id) $selected="selected='selected'";
- print "{$r['firstName']} {$r['lastName']} ";
+ if ($respondent_id == $r['respondent_id']) $selected="selected='selected'"; else $selected = "";
+ print "{$r['firstName']} {$r['lastName']} ";
}
+ if($respondent_id ==0) print "" . T_("Add respondent") . " ";
}
- print "" . T_("Add respondent") . "
";
+ if($respondent_id !=0) print "" . T_("Add respondent") . " ";
+
+ print "
";
}
else { echo " ",$rs[0]['firstName']," ",$rs[0]['lastName']," "; $respondent_id =$rs[0]['respondent_id'];}
@@ -258,13 +252,14 @@ function display_respondent_form($respondent_id = false,$case_id = false)
$rs = $db->Execute($sql);
- print "" . T_("First name:") . "
- " . T_("Last name:") . "
";
+
+ print "" . T_("First name:") . "
+ " . T_("Last name:") . "
";
/**
* Display the current respondent zone in a drop down box with other zones from timezone_template
*/
- print "" . T_("Time Zone:") . " ".$rs->GetMenu('Time_zone_name',$rzone,false)."
";
+ print "" . T_("Time Zone:") . " ". $rs->GetMenu('Time_zone_name',$rzone,false,false,0,'class="form-control"'). "
";
}