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

Fixed: lp:1620421 SQL not compatible with ONLY_FULL_GROUP_BY mode

This commit is contained in:
Adam Zammit
2016-09-08 12:23:21 +10:00
parent f91d51c19b
commit d3dfaa7124
7 changed files with 41 additions and 42 deletions

View File

@@ -319,8 +319,8 @@ if ($case_id != false)
// view sample details
print "<div class='panel-body'><h4 class=''><i class='fa fa-book'></i>&emsp;" . T_("Sample details")."</h4>";
$sql = "SELECT sv.sample_id, c.case_id , s.Time_zone_name,
TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'". TIME_FORMAT ."') as time
$sql = "SELECT sv.sample_id, MIN(c.case_id) as case_id , MIN(s.Time_zone_name) as Time_zone_name,
MIN(TIME_FORMAT(CONVERT_TZ(NOW(),@@session.time_zone,s.Time_zone_name),'". TIME_FORMAT ."')) as time
FROM sample_var AS sv
LEFT JOIN (`case` AS c , sample as s) ON ( c.sample_id = sv.sample_id AND s.sample_id = c.sample_id ) WHERE c.case_id = '$case_id'
GROUP BY sv.sample_id";
@@ -363,15 +363,15 @@ if ($case_id != false)
print "<div class='panel-body'><h4 class=''><i class='fa fa-clock-o'></i>&emsp;" . T_("Appointments")."</h4>";
$sql = "SELECT
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,'" . T_("Not yet called") . "') as outcome,
CONCAT (oo.firstName,' ', oo.lastName) as makerName,
CONCAT (ooo.firstName,' ', ooo.lastName) as callerName,
CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>') as case_id,
CONCAT('&emsp;<a href=\'\' data-toggle=\'confirmation\' data-title=\'" . TQ_("ARE YOU SURE?") . "\' data-btnOkLabel=\'" . TQ_("Yes") . "\' data-btnCancelLabel=\'" . TQ_("No") . "\' data-placement=\'left\' data-href=\'displayappointments.php?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id,'&amp;delete=delete\'><i class=\'fa fa-trash fa-lg text-danger\' data-toggle=\'tooltip\' title=\'" . TQ_("Delete") . "\'></i></a>&emsp;') as link,
CONCAT('&emsp;<a href=\'displayappointments.php?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\'><i class=\'fa fa-edit fa-lg\'></i></a>&emsp;') as edit
MIN(CONVERT_TZ(a.start,'UTC',@@session.time_zone)) as start,
MIN(CONVERT_TZ(a.end,'UTC',@@session.time_zone)) as end,
MIN(CONCAT(r.firstName,' ', r.lastName)) as resp,
MIN(IFNULL(ou.description,'" . T_("Not yet called") . "')) as outcome,
MIN(CONCAT (oo.firstName,' ', oo.lastName)) as makerName,
MIN(CONCAT (ooo.firstName,' ', ooo.lastName)) as callerName,
MIN(CONCAT('<a href=\'supervisor.php?case_id=', c.case_id, '\'>', c.case_id, '</a>')) as case_id,
MIN(CONCAT('&emsp;<a href=\'\' data-toggle=\'confirmation\' data-title=\'" . TQ_("ARE YOU SURE?") . "\' data-btnOkLabel=\'" . TQ_("Yes") . "\' data-btnCancelLabel=\'" . TQ_("No") . "\' data-placement=\'left\' data-href=\'displayappointments.php?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id,'&amp;delete=delete\'><i class=\'fa fa-trash fa-lg text-danger\' data-toggle=\'tooltip\' title=\'" . TQ_("Delete") . "\'></i></a>&emsp;')) as link,
MIN(CONCAT('&emsp;<a href=\'displayappointments.php?case_id=', c.case_id, '&amp;appointment_id=', a.appointment_id, '\' data-toggle=\'tooltip\' title=\'" . TQ_("Edit") . "\'><i class=\'fa fa-edit fa-lg\'></i></a>&emsp;')) as edit
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)
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)