" . T_("The appointment has been deleted. Now you must modify the case outcome") . "
+ print "
";
}
else
{
- //Display an edit form
+ $lang = DEFAULT_LOCALE ;
+
+ $sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate,
+ CONVERT_TZ(DATE_ADD(NOW(), INTERVAL 10 YEAR),'SYSTEM',r.Time_zone_name) as enddate,
+ r.respondent_id, ca.contact_phone_id
+ FROM `case` as c, `respondent` as r, `call` as ca
+ WHERE c.case_id = '$case_id'
+ AND r.case_id = c.case_id
+ AND c.last_call_id = ca.call_id";
+ $rs = $db->GetRow($sql);
- if ($_GET['new'] == 'new'){$title = T_("Create NEW appointment");} else{$title = T_("Edit appointment"); $subtitle = "ID " . $appointment_id;}
+ $startdate = $rs['startdate'];
+ $enddate = $rs['enddate'];
+ $respondent_id = $rs['respondent_id'];
+ if (!isset($contact_phone_id)) $contact_phone_id = $rs['contact_phone_id'];
+
+ if (isset($_GET['new']) && $_GET['new'] == 'new'){
+ $title = T_("Create NEW appointment");
+ $subtitle ="";
+ $start = $startdate;
+ $end = $enddate;
+ $rtz = $_GET['rtz'];
+ }
+ if (isset($_GET['appointment_id'])) {
+ $title = T_("Edit appointment");
+ $subtitle = "ID " . $appointment_id;
+
+ $sql = "SELECT a.contact_phone_id,a.call_attempt_id, CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as `start`, CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as `end`, a.respondent_id, a.require_operator_id, r.Time_zone_name as rtz
+ FROM `appointment` as a, respondent as r
+ WHERE a.appointment_id = '$appointment_id'
+ AND a.case_id = '$case_id'
+ AND r.respondent_id = a.respondent_id";
+
+ $rs = $db->GetRow($sql);
+
+ if (!empty($rs)){
+ $respondent_id = $rs['respondent_id'];
+ $contact_phone_id = $rs['contact_phone_id'];
+ $require_operator_id = $rs['require_operator_id'];
+ $start = $rs['start'];
+ $end = $rs['end'];
+ $rtz = $rs['rtz'];
+ }
+ else die(T_("ERROR in DB records, Check tables 'appointment' and 'respondent' and Time zone settings"));
+ }
+
+ //Display an edit form
xhtml_head($title,true,$css,$js_head,false,false,false,$subtitle);
- $lang = DEFAULT_LOCALE;
-
- $sql = "SELECT CONVERT_TZ(NOW(),'SYSTEM',r.Time_zone_name) as startdate, CONVERT_TZ(DATE_ADD(NOW(), INTERVAL 10 YEAR),'SYSTEM',r.Time_zone_name) as enddate
- FROM `case` as c, `respondent` as r
- WHERE c.case_id = '$case_id' AND r.case_id = c.case_id";
-
- $rs = $db->GetRow($sql);
- $startdate = $rs['startdate'];
- $enddate = $rs['enddate'];
-
print "";
- if ($_GET['new'] =='new'){
- $start = $startdate;
- $end = $enddate;
- $rtz = $_GET['rtz'];
- }
- if (isset($_GET['appointment_id'])) {
+ print "
";
}
@@ -243,45 +290,53 @@ if ( (isset($_GET['appointment_id']) && isset($_GET['case_id'])) ||(isset($_GET[
else {
$operator_id = get_operator_id();
$subtitle = T_("Appointments");
- xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30); //array("../css/table.css")
+ xhtml_head(T_("Display Appointments"),true,$css,$js_head,false,30);
print "
" . T_("All appointments (with times displayed in your time zone)") . "
";
- $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,CONCAT(r.firstName, ' ', r.lastName) as resp, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName,
+ $sql = "SELECT q.description, si.description as smpl, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end,CONCAT(r.firstName, ' ', r.lastName) as resp, IFNULL(ou.description,'" . TQ_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName,
CONCAT('
', c.case_id, '') as case_id,
CONCAT('
') as link,
CONCAT('
') as edit,IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho
FROM appointment as a
- JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id)
+ JOIN (`case` as c, respondent as r, questionnaire as q, operator as oo, call_attempt as cc, `sample` as s, sample_import as si) on (c.sample_id = s.sample_id and a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id and si.sample_import_id = s.import_id)
LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id)
LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
- WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
+ LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
+ LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
+ WHERE q.enabled=1 AND si.enabled=1 AND a.end >= CONVERT_TZ(NOW(),'System','UTC') AND c.current_outcome_id !=10
+ AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1)
+ AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
ORDER BY a.start ASC";
$rs = $db->GetAll($sql);
if (!empty($rs)) {
translate_array($rs,array("outcome"));
- xhtml_table($rs,array("description","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),"
",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"
"),"tclass",false,false,"bs-table");
+ xhtml_table($rs,array("description","smpl","case_id","start","end","edit","makerName","witho","resp","outcome","callerName","link"),array(T_("Questionnaire"),T_("Sample"),T_("Case ID"),T_("Start"),T_("End"),"
",T_("Created by"),T_("Appointment with"),T_("Respondent"),T_("Current outcome"),T_("Operator who called"),"
"),"tclass",false,false,"bs-table");
} else print "
" . T_("No future appointments") . "
";
print "
" . T_("Missed appointments (with times displayed in your time zone)") . "
";
- $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, CONCAT(r.firstName, ' ', r.lastName) as resp,
+ $sql = "SELECT q.description, si.description as smpl, CONVERT_TZ(a.start,'UTC',@@session.time_zone) as start, CONVERT_TZ(a.end,'UTC',@@session.time_zone) as end, CONCAT(r.firstName, ' ', r.lastName) as resp,
CONCAT('
', c.case_id, '') as case_id,
CONCAT('
') as link,
CONCAT('
') as edit
FROM appointment as a
JOIN (`case` as c, respondent as r, questionnaire as q, `sample` as s, sample_import as si) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and s.sample_id = c.sample_id and s.import_id= si.sample_import_id)
LEFT JOIN (`call` as ca) ON (ca.call_id = a.completed_call_id)
- WHERE q.enabled=1 AND si.enabled = 1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id !=10
+ LEFT JOIN (questionnaire_sample_quota as qsq) on (s.import_id = qsq.sample_import_id and c.questionnaire_id = qsq.questionnaire_id)
+ LEFT JOIN (questionnaire_sample_quota_row as qsqr) on (s.import_id = qsqr.sample_import_id and c.questionnaire_id = qsqr.questionnaire_id)
+ WHERE q.enabled=1 AND si.enabled=1 AND a.end < CONVERT_TZ(NOW(),'System','UTC') AND a.completed_call_id IS NULL AND c.current_outcome_id !=10
+ AND (qsq.quota_reached IS NULL OR qsq.quota_reached != 1 )
+ AND (qsqr.quota_reached IS NULL OR qsqr.quota_reached != 1)
GROUP BY c.case_id
ORDER BY a.start ASC";
$rs = $db->GetAll($sql);
if (!empty($rs)) {
- xhtml_table($rs,array("description","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),"
",T_("Respondent"),"
"),"tclass",false,false,"bs-table");
+ xhtml_table($rs,array("description","smpl","case_id","start","end","edit","resp","link"),array(T_("Questionnaire"),T_("Sample"),T_("Case ID"),T_("Start"),T_("End"),"
",T_("Respondent"),"
"),"tclass",false,false,"bs-table");
- } else print "
" . T_("No appointments missed") . "
";
+ } else print "
" . T_("No missed appointments") . "
";
}
xhtml_foot($js_foot);
diff --git a/admin/extensionstatus.php b/admin/extensionstatus.php
index 97022fba..baf4c0a5 100644
--- a/admin/extensionstatus.php
+++ b/admin/extensionstatus.php
@@ -41,7 +41,7 @@ include ("../db.inc.php");
/**
* Authentication file
*/
-include ("auth-admin.php");
+require ("auth-admin.php");
/**
* XHTML functions
@@ -185,41 +185,43 @@ if (isset($_GET['edit']) || isset($_GET['addext']))
WHERE extension_id = " . intval($_GET['edit']);
$rs = $db->GetRow($sql);
- } else $rs = array();
-
- print "
" . T_("Go back") . "";
+ }
+
?>
";
}
else
{
@@ -241,8 +243,10 @@ else
$rs = $db->GetAll($sql);
+ print "";
+
if ($msg != "")
- print "
$msg
";
+ print "
$msg
";
if (!empty($rs))
{
@@ -258,14 +262,15 @@ else
if ($rs[$i]['assignment'] == "list")
$rs[$i]['assignment'] = display_chooser($ers,"operator_id_" . $rs[$i]["extension_id"],"operator_id_" . $rs[$i]["extension_id"],true,"extension_id=".$rs[$i]["extension_id"],true,false,false,false);
}
- print "
";
+
xhtml_table($rs,array("extension","firstName","assignment","status","case_id","state","calltime"),array(T_("Extension"),T_("Operator"),T_("Assignment"),T_("VoIP Status"),T_("Case ID"),T_("Call state"),T_("Time on call")),"tclass",array("vs" => "1"));
- print "
";
+ print "";
}
else
- print "
" . T_("No extensions") . "
";
+ print "
" . T_("No extensions") . "
";
- print "
";
+ print "
" . T_("Add extension") . "
+
";
}
diff --git a/admin/import.php b/admin/import.php
index 5cbc9581..3af3f959 100644
--- a/admin/import.php
+++ b/admin/import.php
@@ -11,7 +11,7 @@ include ("../config.inc.php");
/**
* Authentication file
*/
-include ("auth-admin.php");
+require ("auth-admin.php");
/**
* XHTML functions
diff --git a/admin/index.php b/admin/index.php
index 47d5c137..d5d318a3 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -41,7 +41,7 @@ include ("../config.inc.php");
/**
* Authentication file
*/
-include ("auth-admin.php");
+require ("auth-admin.php");
/*
* XHTML file
@@ -85,21 +85,21 @@ include ("../functions/functions.operator.php");