CRM-19641 Further Fix
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 23 Nov 2016 02:46:33 +0000 (13:46 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 23 Nov 2016 20:38:43 +0000 (07:38 +1100)
CRM/Case/XMLProcessor/Report.php

index 1e3abee48e0fc61585cf949a6e0294af265771ff..96fc0fc1729934ed9acb11d7db11045f7d0a50e6 100644 (file)
@@ -691,10 +691,11 @@ SELECT label, value
 
       foreach ($sql as $tableName => $values) {
         $columnNames = implode(',', $values);
-        $tableName = CRM_Utils_Type::escape($tableName, 'MysqlColumnNameOrAlias');
+        $title = CRM_Core_DAO::escapeString($groupTitle[$tableName]);
+        $mysqlTableName = CRM_Utils_Type::escape($tableName, 'MysqlColumnNameOrAlias');
         $sql[$tableName] = "
-SELECT '" . CRM_Core_DAO::escapeString($groupTitle[$tableName]) . "' as groupTitle, $columnNames
-FROM   $tableName
+SELECT '" . $title . "' as groupTitle, $columnNames
+FROM   $mysqlTableName
 WHERE  entity_id = %1
 ";
       }