From fb3825c3a564c0e71e1b5486c52f92eb7f6166ad Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 20 May 2015 16:13:35 +0300 Subject: [PATCH] rev443 http://bazaar.launchpad.net/~adamzammit/quexs/main/revision/443 gave an idea of another way to select operator cases, here's the first "front " part of it - operator waitnextcase_interface2.php page with information on available questionnaires/samples/cases/contacts for exact operator --- waitnextcase_interface2.php | 146 +++++++++++++++++++++++++++++++++--- 1 file changed, 136 insertions(+), 10 deletions(-) diff --git a/waitnextcase_interface2.php b/waitnextcase_interface2.php index d4db4c8f..719bb72e 100644 --- a/waitnextcase_interface2.php +++ b/waitnextcase_interface2.php @@ -40,7 +40,7 @@ include_once("lang.inc.php"); */ include_once("functions/functions.xhtml.php"); -xhtml_head(T_("queXS"), false, array("css/index_interface2.css","css/tabber_interface2.css"),array("js/tabber_interface2.js")); +xhtml_head(T_("Standby"),false,array("include/bootstrap-3.3.2/css/bootstrap.min.css","css/index_interface2.css"), array(), false, 300); if (isset($_GET['auto'])) { @@ -54,18 +54,144 @@ if (isset($_GET['auto'])) VALUES (NULL,'$case_id','$operator_id','" . TQ_("Operator Automatically logged out after: ") . AUTO_LOGOUT_MINUTES . TQ_(" minutes") . "', CONVERT_TZ(NOW(),'System','UTC'))"; $db->Execute($sql); - print "

" . T_("You have been automatically logged out of work due to inactivity") . "

"; + print "
" . T_("You have been automatically logged out of work due to inactivity") . "
"; } + +/* $sql = "SELECT sample_id FROM `sample` where import_id = 1"; +$rs = $db->GetAll($sql); +for($i=0;$i<=count($rs)-1;$i++){ $ssseedss[] = $rs[$i]['sample_id'] ;} +$ssseedssd = implode(",",$ssseedss); + print $ssseedssd; */ + + +/** + * check if cases available + */ + +//if assigned to a questionnaire + +$sql = "SELECT oq.questionnaire_id, q.description + FROM operator_questionnaire as oq, questionnaire as q + WHERE q.enabled = 1 + AND oq.operator_id = '$operator_id' + AND q.questionnaire_id = oq.questionnaire_id"; + +$rs = $db->GetAll($sql); + +if (empty($rs)) + + print "
" . T_("ERROR: No questionnaires assigned to you") . "
"; + +else +{ + print "
"; + print "

" . T_("Assigned questionnaires:") . ""; + + /* if (isset($_GET['auto'])) { + echo "


"; + xhtml_table($rs,array("questionnaire_id","description"),array(T_("ID"),T_("Description"))); + } + else */ + echo " " . count($rs) . "

"; + print "
"; + + for ($i = 0; $i <= count($rs)-1;$i++){ $oq[] = $rs[$i]['questionnaire_id']; } + $oqid = implode(",",$oq); + + //no sample + $sql = "SELECT q.questionnaire_id, q.description, si.description as sdescription, si.sample_import_id + FROM questionnaire as q, sample_import as si, questionnaire_sample as qs + WHERE q.questionnaire_id IN ($oqid) + AND si.enabled = 1 + AND qs.questionnaire_id = q.questionnaire_id + AND si.sample_import_id = qs.sample_import_id"; + + $rs = $db->GetAll($sql); + + if (empty($rs)) + print "
" . T_("ERROR: No samples assigned to the questionnaires") . "
"; + else { + print "
" . T_("Assigned samples:") . " " . count($rs) . "
"; + //xhtml_table($rs,array("questionnaire_id","description","sdescription"),array(T_("ID"),T_("Description"),T_("Sample"))); + + for ($i = 0; $i <= count($rs)-1;$i++){ $si[] = $rs[$i]['sample_import_id']; } + $siid = implode(",",$si); + + //shift restrictions and no shift + $sql = "SELECT q.description, CONVERT_TZ(sh.start, 'UTC', @@session.time_zone) as st, CONVERT_TZ(sh.end, 'UTC',@@session.time_zone) as en + FROM questionnaire AS q + LEFT JOIN shift AS sh ON (sh.questionnaire_id = q.questionnaire_id AND (CONVERT_TZ( NOW( ) ,@@session.time_zone, 'UTC' ) >= sh.start ) AND (CONVERT_TZ( NOW( ) ,@@session.time_zone, 'UTC' ) <= sh.end )) + WHERE q.questionnaire_id IN ($oqid) + AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)"; + + $rs = $db->GetAll($sql); + + if (empty($rs)) + print "
" . T_("ERROR: No shifts at this time") . "
"; + + else{ + print "
" . T_("Current shifts available:") . " " . T_("Yes") . "
"; + //xhtml_table($rs,array("description","st","en"),array(T_("Questionnaire"),T_("Shift start"),T_("Shift end"))); + + //assigned to operator + + // call restrictions and outside times, operator skill and filter outcomes 10,25,28,33,34,40 + $sql = "SELECT COUNT( DISTINCT sv.sample_id) as count_samples + FROM `sample` as s + JOIN `sample_var` as sv on( s.sample_id = sv.sample_id ) + JOIN sample_import as si on (s.import_id = si.sample_import_id) + LEFT JOIN (`case` as c, `outcome` as ou ) on (s.sample_id = c.sample_id and ou.outcome_id = c.current_outcome_id) + LEFT JOIN call_restrict as cr on ( cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end) + WHERE c.questionnaire_id IN ($oqid) + AND s.import_id IN ($siid) + AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL) + AND ou.outcome_type_id IN( SELECT outcome_type_id FROM operator_skill WHERE operator_id = '$operator_id') + AND ou.outcome_id NOT IN (10,25,28,33,34,40)"; + $cases_count = $db->GetRow($sql); + + if ($cases_count['count_samples'] == 0){ + print "
" . T_("Cases currently available to call") . ": " . $cases_count['count_samples'] . "
"; + } + else { + print "
" . T_("Cases currently available to call") . ": " . $cases_count['count_samples'] . "
"; + } + + //new samples available + $sql = "SELECT COUNT( DISTINCT sv.sample_id) as count_samples + FROM `sample` as s + JOIN `sample_var` as sv on( s.sample_id = sv.sample_id ) + JOIN sample_import as si on (s.import_id = si.sample_import_id) + LEFT JOIN `case` as c on (s.sample_id = c.sample_id ) + LEFT JOIN call_restrict as cr on ( cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end) + WHERE s.import_id IN ($siid) + AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL) + AND c.sample_id IS NULL"; + $new_samples = $db->GetRow($sql); + + if ($new_samples['count_samples'] == 0){ + print "
" . T_("New samples available to call") . ": " . $new_samples['count_samples'] . "
"; + } + else { + print "
" . T_("New samples available to call") . ": " . $new_samples['count_samples'] . "
"; + } + + } + } + + print "
"; +} + + if ($cases_count['count_samples'] != 0 or $new_samples['count_samples'] != 0){ ?> -
- - +
+ +
+?> \ No newline at end of file