Skip to content
Snippets Groups Projects
Commit c0bf5e2e authored by Mike Feranda's avatar Mike Feranda Committed by Mike Feranda
Browse files

Issue #3162186 by mferanda: PHP Warnings with new suppression code

parent c6cdbecc
No related branches found
No related tags found
No related merge requests found
......@@ -100,7 +100,9 @@ class HtmlFormatterType extends FormatterBase {
$roles = $current_user->getRoles();
$settings = $this->getSettings();
$suppOverride = false;
// Get suppression override setting
if (!empty($settings['suppression_override'])) {
$suppOverride = $settings['suppression_override'];
......@@ -123,21 +125,26 @@ class HtmlFormatterType extends FormatterBase {
if (is_array($rowData)) {
for ($i = 0; $i < count($rowData); $i++) {
// Each row... then each cell in each row.
// Add row to suppCell if doesn't exist
if (!isset($suppCell[$i])) {
$suppCell[$i] = [];
}
foreach ($headers as $field) {
// Check if suppression is enabled for cell or if the cell is already marked for suppression
$suppCellProcess = (isset($rowData[$i]->$field)
&& is_numeric($rowData[$i]->$field)
&& isset($rowSettings[$i][$field]['valueSuppression'])
&& ((isset($rowSettings[$i][$field]['valueSuppression']['min']) && $rowData[$i]->$field >= $rowSettings[$i][$field]['valueSuppression']['min']
&& isset($rowSettings[$i][$field]['valueSuppression']['max']) && $rowData[$i]->$field <= $rowSettings[$i][$field]['valueSuppression']['max']
|| isset($rowSettings[$i][$field]['valueSuppression']['any']) && $rowSettings[$i][$field]['valueSuppression']['any']))
&& (isset($rowSettings[$i][$field]['valueSuppression']['role']) && !empty(array_intersect($rowSettings[$i][$field]['valueSuppression']['role'], $roles))
|| !isset($rowSettings[$i][$field]['valueSuppression']['role']))
|| in_array($suppCell[$i], $field));
|| in_array($field, $suppCell[$i]));
// Check if suppression and for role. If suppressed, add it to suppression list.
if ($suppCellProcess) {
// Add the current cell to the suppression
if (!in_array($suppCell[$i], $field)) {
if (!in_array($field, $suppCell[$i])) {
array_push($suppCell, [$i => $field]);
}
// Additional Suppression
......@@ -147,7 +154,7 @@ class HtmlFormatterType extends FormatterBase {
// Loop through other Row/Column and set
foreach($otherRowCol as $otherRow => $value) {
foreach($value as $key => $otherField) {
if (!in_array($suppCell[$otherRow], $otherField)) {
if (!in_array($otherField, $suppCell[$otherRow])) {
array_push($suppCell, [$otherRow => $otherField]);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment