From 41d6a899422e5e131339f30477be8199474e71b0 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Jul 2015 15:00:51 +0300 Subject: [PATCH] fix differences between working installation and tree nocaseavailable.php: enabled call restrictions and outside times calculation, modified querry to count samples waitnextcase_interface2.php: added quota filter for sample search , display "End work" button if no case aailable --- functions/functions.xhtml.php | 8 ++++---- nocaseavailable.php | 31 ++++++++++++++----------------- waitnextcase_interface2.php | 11 +++++++---- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/functions/functions.xhtml.php b/functions/functions.xhtml.php index ce663398..f679c69f 100644 --- a/functions/functions.xhtml.php +++ b/functions/functions.xhtml.php @@ -111,19 +111,19 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight { $tot = array(); if ($class == "tclass") $class = "table-hover table-bordered table-condensed tclass"; - print ""; + print "
"; if ($head) { - print ""; // ! added to table formatting + print ""; foreach ($head as $e) - print""; + print""; print ""; } print ""; foreach($content as $row) { if ($highlight && isset($row[key($highlight)]) && $row[key($highlight)] == current($highlight)) - print ""; + print ""; else print ""; diff --git a/nocaseavailable.php b/nocaseavailable.php index aeed624c..2dfdbec8 100644 --- a/nocaseavailable.php +++ b/nocaseavailable.php @@ -141,43 +141,40 @@ else ?>

= cr.start - and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end) + JOIN (questionnaire_sample as qs, sample_import as si, sample as s) on (qs.questionnaire_id = oq.questionnaire_id and si.sample_import_id = qs.sample_import_id and 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 || c.case_id IS NULL)) + 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 operator_id = '$operator_id' - AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)"; + AND si.enabled = 1 + 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) "; $rs = $db->GetRow($sql); ?>

" . T_("There are ") . $rs['c'] . T_(" unassigned case(s) available within the specified call restrictions") . "

"; + print "

" . T_("There are ") . $rs['count_samples'] . T_(" unassigned case(s) available within the specified call restrictions") . "

"; } - */ -?> -

-" . T_("Limesurvey links:") . "

"; + $sql = "SELECT q.lime_sid, q.description FROM questionnaire as q, operator_questionnaire as oq WHERE oq.operator_id = '$operator_id' diff --git a/waitnextcase_interface2.php b/waitnextcase_interface2.php index 719bb72e..a7d490c1 100644 --- a/waitnextcase_interface2.php +++ b/waitnextcase_interface2.php @@ -101,11 +101,13 @@ else //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 + FROM questionnaire as q, sample_import as si LEFT JOIN questionnaire_sample_quota AS qsq ON (qsq.sample_import_id = si.sample_import_id), questionnaire_sample as qs WHERE q.questionnaire_id IN ($oqid) AND si.enabled = 1 + AND (qsq.quota_reached = 0 OR qsq.quota_reached IS NULL) AND qs.questionnaire_id = q.questionnaire_id - AND si.sample_import_id = qs.sample_import_id"; + AND si.sample_import_id = qs.sample_import_id + GROUP BY si.sample_import_id"; $rs = $db->GetAll($sql); @@ -182,16 +184,17 @@ else print ""; } - if ($cases_count['count_samples'] != 0 or $new_samples['count_samples'] != 0){ ?>
\ No newline at end of file
$e$e