Skip to content

Commit

Permalink
Merge pull request #12656 from eileenmcnaughton/dev_tab
Browse files Browse the repository at this point in the history
Add SQL modes to developer tab
  • Loading branch information
colemanw authored Aug 14, 2018
2 parents f3baf55 + fe77ced commit 3422e9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1403,14 +1403,16 @@ public function addToDeveloperTab($sql) {
$this->sqlArray[] = $sql;
foreach ($this->sqlArray as $sql) {
foreach (array('LEFT JOIN') as $term) {
$sql = str_replace($term, '<br>&nbsp&nbsp' . $term, $sql);
$sql = str_replace($term, '<br> ' . $term, $sql);
}
foreach (array('FROM', 'WHERE', 'GROUP BY', 'ORDER BY', 'LIMIT', ';') as $term) {
$sql = str_replace($term, '<br><br>' . $term, $sql);
}
$this->sqlFormattedArray[] = $sql;
$this->assign('sql', implode(';<br><br><br><br>', $this->sqlFormattedArray));
}
$this->assign('sqlModes', $sqlModes = CRM_Utils_SQL::getSqlModes());

}

/**
Expand Down
7 changes: 6 additions & 1 deletion templates/CRM/Report/Form/Tabs/Developer.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div id="report-tab-set-developer" class="civireport-criteria">
<p><b>{ts}Class used{/ts}: {$report_class}</b></p>
<p><b>{ts}Class used{/ts}: {$report_class|escape}</b></p>
<p>{ts}SQL Modes{/ts}:
{foreach from=$sqlModes item=sqlMode}
{$sqlMode|escape}
{/foreach}
</p>
<pre>{$sql|purify}</pre>
</div>

0 comments on commit 3422e9b

Please sign in to comment.