From e5feb27daa8b67ce6bace8943db5fe63f2dbc97a Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Wed, 27 Nov 2013 12:03:07 +1100 Subject: [PATCH] Fixes lp:1255359 Translation strings with single quotes break some SQL queries --- admin/assignsample.php | 12 ++++++------ admin/availabilitygroup.php | 2 +- admin/casestatus.php | 8 ++++---- admin/displayappointments.php | 4 ++-- admin/extensionstatus.php | 2 +- admin/operatorlist.php | 14 +++++++------- admin/operatorperformance.php | 2 +- admin/outcomes.php | 6 +++--- admin/questionnairelist.php | 10 +++++----- admin/quotareport.php | 2 +- admin/quotarow.php | 4 ++-- admin/samplelist.php | 10 +++++----- admin/samplesearch.php | 2 +- admin/shiftreport.php | 6 +++--- admin/supervisor.php | 6 +++--- admin/systemsortprocess.php | 4 ++-- appointmentlist.php | 2 +- call.php | 8 ++++---- call_interface2.php | 2 +- email.php | 6 +++--- lang.inc.php | 13 +++++++++++++ nocallavailable.php | 10 +++++----- nocaseavailable.php | 2 +- respondent.php | 2 +- supervisorchat.php | 8 ++++---- 25 files changed, 80 insertions(+), 67 deletions(-) diff --git a/admin/assignsample.php b/admin/assignsample.php index 679039bd..1e84d2a4 100644 --- a/admin/assignsample.php +++ b/admin/assignsample.php @@ -177,12 +177,12 @@ if ($questionnaire_id != false) print "

" . T_("Samples selected for this questionnaire") . "

"; $sql = "SELECT si.description as description, - CASE WHEN q.call_max = 0 THEN '" . T_("Unlimited") . "' ELSE q.call_max END as call_max, - CASE WHEN q.call_attempt_max = 0 THEN '" . T_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max, - CASE WHEN q.random_select = 0 THEN '" . T_("Sequential") . "' ELSE '". T_("Random") . "' END as random_select, - CASE WHEN q.answering_machine_messages = 0 THEN '" . T_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages, - CONCAT('" . T_("Edit") ."') as edit, - CONCAT('" . T_("Click to unassign") ."') as unassign + CASE WHEN q.call_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_max END as call_max, + CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max, + CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select, + CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages, + CONCAT('" . TQ_("Edit") ."') as edit, + CONCAT('" . TQ_("Click to unassign") ."') as unassign FROM questionnaire_sample as q, sample_import as si WHERE q.sample_import_id = si.sample_import_id AND q.questionnaire_id = '$questionnaire_id'"; diff --git a/admin/availabilitygroup.php b/admin/availabilitygroup.php index 6415ce60..d5c44b30 100644 --- a/admin/availabilitygroup.php +++ b/admin/availabilitygroup.php @@ -104,7 +104,7 @@ else if (isset($_POST['availability_group'])) //view groups $sql = "SELECT description, - CONCAT('". T_("Modify") . "') as link + CONCAT('". TQ_("Modify") . "') as link FROM availability_group"; $rs = $db->GetAll($sql); diff --git a/admin/casestatus.php b/admin/casestatus.php index 15443513..29fff0bb 100644 --- a/admin/casestatus.php +++ b/admin/casestatus.php @@ -85,12 +85,12 @@ function case_status_report($questionnaire_id = false, $sample_id = false, $outc $sql = "SELECT CONCAT('', c.case_id, '') as case_id, o.description as outcomes, si.description as samples, - CASE WHEN ca.end IS NULL THEN '" . T_("Now") . "' - WHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . T_("Now") . "' + CASE WHEN ca.end IS NULL THEN '" . TQ_("Now") . "' + WHEN TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) < 0 THEN '" . TQ_("Now") . "' ELSE ROUND(TIME_TO_SEC(TIMEDIFF(ca.end,CONVERT_TZ(DATE_SUB(NOW(), INTERVAL co.default_delay_minutes MINUTE),'System','UTC'))) / 60) END AS availableinmin, - CASE WHEN oq.operator_id IS NULL THEN CONCAT('". T_("Not assigned, select to assign") ." ','') - ELSE CONCAT('". T_("Assigned to") . ": ', oq.firstName, ' " . T_("Order") . ":', cq.sortorder , ' (". T_("Click to unassign") .")') + CASE WHEN oq.operator_id IS NULL THEN CONCAT('". TQ_("Not assigned, select to assign") ." ','') + ELSE CONCAT('". TQ_("Assigned to") . ": ', oq.firstName, ' " . TQ_("Order") . ":', cq.sortorder , ' (". TQ_("Click to unassign") .")') END AS assignedoperator FROM `case` as c JOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1) diff --git a/admin/displayappointments.php b/admin/displayappointments.php index b1419501..38b26d47 100644 --- a/admin/displayappointments.php +++ b/admin/displayappointments.php @@ -209,7 +209,7 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id'])) array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected)); display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,false); print ""; - print "
"; + print "
"; print "

"; print "

" . T_("Cancel edit") . "

"; @@ -226,7 +226,7 @@ else print "

" . T_("Appointments") . "

" . T_("All appointments (with times displayed in your time zone)") . "

"; - $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('', c.case_id, '') as case_id, CONCAT('". T_("Delete") . "') as link, CONCAT('". T_("Edit") . "') as edit,IFNULL(ao.firstName,'" . T_("Any operator") . "') as witho + $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, 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('". TQ_("Delete") . "') as link, CONCAT('". TQ_("Edit") . "') 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 o, 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 o.operator_id = '$operator_id' and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id) diff --git a/admin/extensionstatus.php b/admin/extensionstatus.php index d0c7a297..9ab85baf 100644 --- a/admin/extensionstatus.php +++ b/admin/extensionstatus.php @@ -45,7 +45,7 @@ include ("../functions/functions.xhtml.php"); xhtml_head(T_("Display extension status"),true,array("../css/table.css")); -$sql= "SELECT o.firstName, o.extension, CASE o.voip_status WHEN 0 THEN '" . T_("VoIP Offline") . "' ELSE '" . T_("VoIP Online") . "' END as voip_status, CASE ca.state WHEN 0 THEN '" . T_("Not called") . "' WHEN 1 THEN '" . T_("Requesting call") . "' WHEN 2 THEN '" . T_("Ringing") . "' WHEN 3 THEN '" . T_("Answered") . "' WHEN 4 THEN '" . T_("Requires coding") . "' ELSE '" . T_("Done") . "' END as state, CONCAT('' , c.case_id, '') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime, voip_status as vs +$sql= "SELECT o.firstName, o.extension, CASE o.voip_status WHEN 0 THEN '" . TQ_("VoIP Offline") . "' ELSE '" . TQ_("VoIP Online") . "' END as voip_status, CASE ca.state WHEN 0 THEN '" . TQ_("Not called") . "' WHEN 1 THEN '" . TQ_("Requesting call") . "' WHEN 2 THEN '" . TQ_("Ringing") . "' WHEN 3 THEN '" . TQ_("Answered") . "' WHEN 4 THEN '" . TQ_("Requires coding") . "' ELSE '" . TQ_("Done") . "' END as state, CONCAT('' , c.case_id, '') as case_id, SEC_TO_TIME(TIMESTAMPDIFF(SECOND,cal.start,CONVERT_TZ(NOW(),'SYSTEM','UTC'))) as calltime, voip_status as vs FROM operator as o LEFT JOIN `case` as c ON (c.current_operator_id = o.operator_id) LEFT JOIN `call_attempt` as cal ON (cal.operator_id = o.operator_id AND cal.end IS NULL and cal.case_id = c.case_id) diff --git a/admin/operatorlist.php b/admin/operatorlist.php index 8b3c195d..fa5048a2 100644 --- a/admin/operatorlist.php +++ b/admin/operatorlist.php @@ -233,20 +233,20 @@ if ($display) { $sql = "SELECT CONCAT(firstName, ' ', lastName) as name, - CONCAT('" . T_("Windows bat file") . "') as winbat, - CONCAT('" . T_("*nix script file") . "') as sh, + CONCAT('" . TQ_("Windows bat file") . "') as winbat, + CONCAT('" . TQ_("*nix script file") . "') as sh, CASE WHEN enabled = 0 THEN - CONCAT('" . T_("Enable") . "') + CONCAT('" . TQ_("Enable") . "') ELSE - CONCAT('" . T_("Disable") . "') + CONCAT('" . TQ_("Disable") . "') END as enabledisable, CASE WHEN voip = 0 THEN - CONCAT('" . T_("Enable VoIP") . "') + CONCAT('" . TQ_("Enable VoIP") . "') ELSE - CONCAT('" . T_("Disable VoIP") . "') + CONCAT('" . TQ_("Disable VoIP") . "') END as voipenabledisable, - CONCAT('" . T_("Edit") . "') as edit, + CONCAT('" . TQ_("Edit") . "') as edit, username FROM operator"; diff --git a/admin/operatorperformance.php b/admin/operatorperformance.php index a0549554..c87ad105 100644 --- a/admin/operatorperformance.php +++ b/admin/operatorperformance.php @@ -85,7 +85,7 @@ if ($questionnaire_id) $shift_id = false; if (isset($_GET['shift_id'])) $shift_id = bigintval($_GET['shift_id']); - $sql = "SELECT s.shift_id as value,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT . "'),' " . T_("till") . " ',DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as description,CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected + $sql = "SELECT s.shift_id as value,CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT . "'),' " . TQ_("till") . " ',DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . TIME_FORMAT . "')) as description,CASE WHEN s.shift_id = '$shift_id' THEN 'selected=\'selected\'' ELSE '' END AS selected FROM shift as s LEFT JOIN (operator as o) on (o.operator_id = '$operator_id') WHERE s.questionnaire_id = '$questionnaire_id' diff --git a/admin/outcomes.php b/admin/outcomes.php index 247d7108..b857662b 100644 --- a/admin/outcomes.php +++ b/admin/outcomes.php @@ -87,7 +87,7 @@ if ($questionnaire_id != false) print "

" . T_("Sample status") . "

"; - $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . T_("Drawn from sample") . "' ELSE '" . T_("Remain in sample") . "' END as drawn, + $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn, count(*) as count FROM sample as s JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) @@ -230,7 +230,7 @@ group by s.import_id"; { print "

" . T_("Sample status") . "

"; - $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . T_("Drawn from sample") . "' ELSE '" . T_("Remain in sample") . "' END as drawn, + $sql = "SELECT CASE WHEN (c.sample_id is not null) = 1 THEN '" . TQ_("Drawn from sample") . "' ELSE '" . TQ_("Remain in sample") . "' END as drawn, count(*) as count FROM sample as s JOIN questionnaire_sample as qs ON (qs.questionnaire_id = '$questionnaire_id' and qs.sample_import_id = s.import_id) @@ -273,7 +273,7 @@ group by s.import_id"; print "

" . T_("Shifts") . "

"; $sql = "SELECT s.shift_id, CONCAT(DATE_FORMAT(CONVERT_TZ(s.start,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."'), ' - ', DATE_FORMAT(CONVERT_TZ(s.end,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."')) as description, - CASE WHEN sr.shift_id IS NULL THEN CONCAT('" . T_("No shift reports: Add report") . "') ELSE CONCAT('" . T_("View shift reports") . "') END AS link, c.completions as completions, CONCAT('" . T_("View operator performance") . "') as operform + CASE WHEN sr.shift_id IS NULL THEN CONCAT('" . TQ_("No shift reports: Add report") . "') ELSE CONCAT('" . TQ_("View shift reports") . "') END AS link, c.completions as completions, CONCAT('" . TQ_("View operator performance") . "') as operform FROM `shift` as s JOIN operator as o on (o.operator_id = '$admin_operator_id') LEFT JOIN shift_report as sr on (sr.shift_id = s.shift_id) diff --git a/admin/questionnairelist.php b/admin/questionnairelist.php index 33a8e7c7..cc67fefe 100644 --- a/admin/questionnairelist.php +++ b/admin/questionnairelist.php @@ -382,7 +382,7 @@ else if (isset($_GET['delete'])) print "

" . T_("Please confirm you wish to delete the questionnaire") . "

"; print "
"; - print "

"; + print "

"; print "

"; print "
"; } @@ -394,13 +394,13 @@ else $sql = "SELECT description, CASE WHEN enabled = 0 THEN - CONCAT('" . T_("Enable") . "') + CONCAT('" . TQ_("Enable") . "') ELSE - CONCAT('" . T_("Disable") . "') + CONCAT('" . TQ_("Disable") . "') END as enabledisable, - CONCAT('" . T_("Modify"). "') as modify, - CONCAT('" . T_("Delete"). "') as deletee + CONCAT('" . TQ_("Modify"). "') as modify, + CONCAT('" . TQ_("Delete"). "') as deletee FROM questionnaire"; $rs = $db->GetAll($sql); diff --git a/admin/quotareport.php b/admin/quotareport.php index 2b87b3e9..3004ccc3 100644 --- a/admin/quotareport.php +++ b/admin/quotareport.php @@ -282,7 +282,7 @@ if ($questionnaire_id) print "
"; xhtml_table($report,array("strata","status","quota","sample","sampleused","sampleremain","completions","perc","priority","autoprioritise"),array(T_("Strata"),T_("Status"),T_("Quota"),T_("Sample"),T_("Sample Used"),T_("Sample Remaining"),T_("Completions"),T_("% Complete"),T_("Set priority"),T_("Auto prioritise")),"tclass",false,false); - print "

"; + print "

"; } } diff --git a/admin/quotarow.php b/admin/quotarow.php index 93f056b7..32e837f2 100755 --- a/admin/quotarow.php +++ b/admin/quotarow.php @@ -211,11 +211,11 @@ if ($questionnaire_id != false) { print "

" . T_("Copy quotas for this sample to (No error/duplicate checking): "); display_chooser($ss,"copy_sample_import_id","copy_sample_import_id",false,false,false,false); - print "

"; + print "

"; print "

" . T_("Copy quotas for this sample to (No error/duplicate checking) with adjusting: "); display_chooser($ss,"copy_sample_import_id_with_adjustment","copy_sample_import_id_with_adjustment",false,false,false,false); - print "

"; + print "

"; } } diff --git a/admin/samplelist.php b/admin/samplelist.php index da8d7153..1e63e2af 100644 --- a/admin/samplelist.php +++ b/admin/samplelist.php @@ -260,14 +260,14 @@ if (isset($_GET['sampleenable'])) $sql = "SELECT CASE WHEN enabled = 0 THEN - CONCAT('" . T_("Enable") . "') + CONCAT('" . TQ_("Enable") . "') ELSE - CONCAT('" . T_("Disable") . "') + CONCAT('" . TQ_("Disable") . "') END as enabledisable, - CONCAT('" . T_("Deidentify") . "') as did, - CONCAT('" . T_("Operator viewing permissions") . "') as vp, - CONCAT('" . T_("Rename") . "') as rname, + CONCAT('" . TQ_("Deidentify") . "') as did, + CONCAT('" . TQ_("Operator viewing permissions") . "') as vp, + CONCAT('" . TQ_("Rename") . "') as rname, description FROM sample_import"; diff --git a/admin/samplesearch.php b/admin/samplesearch.php index 37e9fddb..4e2fedd0 100644 --- a/admin/samplesearch.php +++ b/admin/samplesearch.php @@ -97,7 +97,7 @@ if ($sample_import_id != false) { $search = $db->qstr($_GET['search']); - $sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN CONCAT('" . T_("No cases yet assigned: Delete this sample record") . "') ELSE CONCAT('" . T_("Assigned to questionnaire: ") . "', q.description, '') END as link + $sql = "SELECT sv.sample_id, CASE WHEN c.case_id IS NULL THEN CONCAT('" . TQ_("No cases yet assigned: Delete this sample record") . "') ELSE CONCAT('" . TQ_("Assigned to questionnaire: ") . "', q.description, '') END as link FROM sample_var AS sv JOIN (sample as s) ON (s.import_id = '$sample_import_id' and sv.sample_id = s.sample_id) LEFT JOIN (`case` AS c, questionnaire AS q) ON ( c.sample_id = sv.sample_id AND q.questionnaire_id = c.questionnaire_id ) diff --git a/admin/shiftreport.php b/admin/shiftreport.php index 2146cabb..6994c868 100644 --- a/admin/shiftreport.php +++ b/admin/shiftreport.php @@ -93,7 +93,7 @@ if ($questionnaire_id) //list current reports with a link to edit $sql = "SELECT s.report,o.firstName,DATE_FORMAT(CONVERT_TZ(s.datetime,'UTC',o.Time_zone_name),'" . DATE_TIME_FORMAT ."') as d, - CONCAT('". T_("Edit") . "') as link + CONCAT('". TQ_("Edit") . "') as link FROM shift_report as s, operator as o WHERE s.operator_id = o.operator_id AND s.shift_id = '$shift_id'"; @@ -114,7 +114,7 @@ if ($questionnaire_id) print "

"; print "

"; print ""; - print ""; + print ""; print "

"; } else if (isset($_GET['report'])) @@ -160,7 +160,7 @@ if ($questionnaire_id) print "

"; print ""; print ""; - print ""; + print ""; print "

"; } } diff --git a/admin/supervisor.php b/admin/supervisor.php index 43ce1692..51817e63 100644 --- a/admin/supervisor.php +++ b/admin/supervisor.php @@ -237,7 +237,7 @@ if ($case_id != false) print "

" . T_("Appointments")."

"; //View appointments - $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('', c.case_id, '') as case_id, CONCAT('". T_("Delete") . "') as link, CONCAT('". T_("Edit") . "') as edit + $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, 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('". TQ_("Delete") . "') as link, CONCAT('". TQ_("Edit") . "') as edit FROM appointment as a JOIN (`case` as c, respondent as r, questionnaire as q, operator as o, 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) @@ -259,7 +259,7 @@ if ($case_id != false) //view calls and outcomes - $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',r.Time_zone_name) as end, op.firstName, op.lastName, o.description as des, CONCAT('". T_("Edit") . "') as link, cp.phone as phone + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,CONVERT_TZ(c.end,'UTC',r.Time_zone_name) as end, op.firstName, op.lastName, o.description as des, CONCAT('". TQ_("Edit") . "') as link, cp.phone as phone FROM `call` as c JOIN (operator as op, outcome as o, respondent as r, contact_phone as cp) on (c.operator_id = op.operator_id and c.outcome_id = o.outcome_id and r.respondent_id = c.respondent_id and cp.contact_phone_id = c.contact_phone_id) WHERE c.case_id = '$case_id' @@ -277,7 +277,7 @@ if ($case_id != false) } //view notes - $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, op.firstName, op.lastName, c.note as note, CONCAT('". T_("Delete") . "') as link + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, op.firstName, op.lastName, c.note as note, CONCAT('". TQ_("Delete") . "') as link FROM `case_note` as c JOIN (operator as op) on (c.operator_id = op.operator_id) WHERE c.case_id = '$case_id' diff --git a/admin/systemsortprocess.php b/admin/systemsortprocess.php index a10fa36d..f7047f5a 100644 --- a/admin/systemsortprocess.php +++ b/admin/systemsortprocess.php @@ -127,7 +127,7 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin //add note $sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`) - VALUES ('{$r['case_id']}',1,'" . T_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))"; + VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))"; $db->Execute($sql); @@ -165,7 +165,7 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin //add note $sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`) - VALUES ('{$r['case_id']}',1,'" . T_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))"; + VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))"; $db->Execute($sql); diff --git a/appointmentlist.php b/appointmentlist.php index c75044ae..7fd10c97 100644 --- a/appointmentlist.php +++ b/appointmentlist.php @@ -67,7 +67,7 @@ $rs = ""; if ($case_id) { - $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',r.Time_zone_name),'".TIME_FORMAT."') as end, c.completed_call_id, IFNULL(ou.firstName,'" . T_("Not yet called") . "') as firstName, CONCAT(r.firstName, ' ', r.lastName) as respname, IFNULL(o.description,'" . T_("Not yet called") . "') as des, IFNULL(ao.firstName,'" . T_("Any operator") . "') as witho + $sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.start,'UTC',r.Time_zone_name),'".DATE_TIME_FORMAT."') as start,DATE_FORMAT(CONVERT_TZ(c.end,'UTC',r.Time_zone_name),'".TIME_FORMAT."') as end, c.completed_call_id, IFNULL(ou.firstName,'" . TQ_("Not yet called") . "') as firstName, CONCAT(r.firstName, ' ', r.lastName) as respname, IFNULL(o.description,'" . TQ_("Not yet called") . "') as des, IFNULL(ao.firstName,'" . TQ_("Any operator") . "') as witho FROM `appointment` as c JOIN respondent as r on (r.respondent_id = c.respondent_id) LEFT JOIN (`call` as ca, outcome as o, operator as ou) on (ca.call_id = c.completed_call_id and ca.outcome_id = o.outcome_id and ou.operator_id = ca.operator_id) diff --git a/call.php b/call.php index 8b1827be..4536e610 100644 --- a/call.php +++ b/call.php @@ -428,27 +428,27 @@ switch($state) print "
" . T_("Call Answered") . "
"; print "
"; display_outcomes(0,$call_attempt_id,$case_id); - print "
"; + print "
"; break; case 2: //ringing print "
" . T_("Ringing") . "
"; print "
" . T_("Call Answered") . "
"; print "
"; display_outcomes(0,$call_attempt_id,$case_id); - print "
"; + print "
"; break; case 3: //answered print "
" . T_("Answered") . "
"; print "
" . T_("Not Answered") . "
"; print "
"; display_outcomes(1,$call_attempt_id,$case_id); - print "
"; + print "
"; break; case 4: //requires coding print "
" . T_("Requires coding") . "
"; print "
"; display_outcomes(false,$call_attempt_id,$case_id); - print "
"; + print "
"; break; case 5: //done -- shouldn't come here as should be coded + done default: diff --git a/call_interface2.php b/call_interface2.php index f31c7866..cbf1d015 100644 --- a/call_interface2.php +++ b/call_interface2.php @@ -467,7 +467,7 @@ switch($state) print "
" . T_("Requires coding") . "
"; print "
"; display_outcomes(false,$call_attempt_id,$case_id); - print "
"; + print "
"; break; case 5: //done -- shouldn't come here as should be coded + done default: diff --git a/email.php b/email.php index 3b6cd20d..d6e74486 100644 --- a/email.php +++ b/email.php @@ -238,7 +238,7 @@ if (isset($_POST['firstname'])) //Add a note that sent $sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime) - VALUES ($case_id,$operator_id,'" . T_("Self completion invitation sent via email to") . ": " . $_POST['email'] . "',CONVERT_TZ(NOW(),'System','UTC'))"; + VALUES ($case_id,$operator_id,'" . TQ_("Self completion invitation sent via email to") . ": " . $_POST['email'] . "',CONVERT_TZ(NOW(),'System','UTC'))"; $db->Execute($sql); @@ -339,9 +339,9 @@ if ($sc == 1) print "
"; if (!isset($_GET['interface2'])) { - print "
"; + print "
"; } - print "
"; + print "
"; } else { diff --git a/lang.inc.php b/lang.inc.php index 5d7b9d26..5644455e 100644 --- a/lang.inc.php +++ b/lang.inc.php @@ -48,6 +48,19 @@ function translate_array(&$a,$b) if (isset($row[$el])) $row[$el] = T_($row[$el]); } +/** + * Translate then quote a string to make it ready + * for database insertion + * + * @param string $msg The message to translate and quote + * @return string The translated message quoted + */ +function TQ_($msg) +{ + $msg = T_($msg); + $msg = str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$msg); + return str_replace("'","\\'",$msg); +} $locale = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); diff --git a/nocallavailable.php b/nocallavailable.php index 0a06c4ae..36ab49fb 100644 --- a/nocallavailable.php +++ b/nocallavailable.php @@ -174,15 +174,15 @@ if (AUTO_DIAL_SECONDS !== false) if ($contact_phone_id !== false) { //got a number to dial so initiate the countdown to begin dialing - $texttodisplay = T_("Will dial in"); - $endtexttodisplay = T_("Dialling now"); + $texttodisplay = TQ_("Will dial in"); + $endtexttodisplay = TQ_("Dialling now"); $jsfunctocall = "document.location.href = 'nocallavailable.php?contact_phone=" . $contact_phone_id . "';"; } else { //no more numbers to dial so initiate the countdown to end the case - $texttodisplay = T_("Will end case in"); - $endtexttodisplay = T_("Ending case now"); + $texttodisplay = TQ_("Will end case in"); + $endtexttodisplay = TQ_("Ending case now"); $jsfunctocall = "openParent('endcase=endcase');"; } print "
"; @@ -200,7 +200,7 @@ if (AUTO_DIAL_SECONDS !== false) " . $jsfunctocall . " return; } - document.getElementById('timer').innerHTML='". $texttodisplay ." ' + count + ' " . T_("seconds") . "'; + document.getElementById('timer').innerHTML='". $texttodisplay ." ' + count + ' " . TQ_("seconds") . "'; } window.onload = function() diff --git a/nocaseavailable.php b/nocaseavailable.php index ed914d6d..ff8315de 100644 --- a/nocaseavailable.php +++ b/nocaseavailable.php @@ -77,7 +77,7 @@ $operator_id = get_operator_id(); //you have not been assigned to a questionnaire -$sql = "SELECT oq.questionnaire_id, q.description, CASE WHEN q.enabled = 1 THEN '" . T_("Enabled") . "' ELSE '" . T_("Disabled") . "' END as enabled +$sql = "SELECT oq.questionnaire_id, q.description, CASE WHEN q.enabled = 1 THEN '" . TQ_("Enabled") . "' ELSE '" . TQ_("Disabled") . "' END as enabled FROM operator_questionnaire as oq, questionnaire as q WHERE oq.operator_id = '$operator_id' AND q.questionnaire_id = oq.questionnaire_id"; diff --git a/respondent.php b/respondent.php index e50da384..48c4e7d1 100644 --- a/respondent.php +++ b/respondent.php @@ -91,7 +91,7 @@ if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0) ?>
-
+
diff --git a/supervisorchat.php b/supervisorchat.php index 98dcb296..f58afede 100644 --- a/supervisorchat.php +++ b/supervisorchat.php @@ -76,10 +76,10 @@ if ($chatenabled && operator_chat_enabled($operator_id)) //javascript to activate connection for this user print ""; @@ -87,7 +87,7 @@ if ($chatenabled && operator_chat_enabled($operator_id)) print ""; print "
" . T_("Supervisor not available") . "
"; - print "
"; + print "
"; //table for chat messages print "
" . T_("From") . "" . T_("Message") . "
";