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

Issue #3161356 by mferanda: Suppression - Add ability to automatically suppress other cells

parent cb891e04
No related branches found
No related tags found
No related merge requests found
...@@ -124,11 +124,6 @@ class HtmlFormatterType extends FormatterBase { ...@@ -124,11 +124,6 @@ class HtmlFormatterType extends FormatterBase {
if (is_array($rowData)) { if (is_array($rowData)) {
for ($i = 0; $i < count($rowData); $i++) { 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) { foreach ($headers as $field) {
// Check if suppression is enabled for cell or if the cell is already marked for suppression // Check if suppression is enabled for cell or if the cell is already marked for suppression
$suppCellProcess = (isset($rowData[$i]->$field) $suppCellProcess = (isset($rowData[$i]->$field)
...@@ -139,14 +134,13 @@ class HtmlFormatterType extends FormatterBase { ...@@ -139,14 +134,13 @@ class HtmlFormatterType extends FormatterBase {
|| isset($rowSettings[$i][$field]['valueSuppression']['any']) && $rowSettings[$i][$field]['valueSuppression']['any'])) || 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']) && !empty(array_intersect($rowSettings[$i][$field]['valueSuppression']['role'], $roles))
|| !isset($rowSettings[$i][$field]['valueSuppression']['role'])) || !isset($rowSettings[$i][$field]['valueSuppression']['role']))
|| in_array($field, $suppCell[$i])); || isset($suppCell[$i]) && in_array($field, $suppCell[$i]));
// Check if suppression and for role. If suppressed, add it to suppression list. // Check if suppression and for role. If suppressed, add it to suppression list.
if ($suppCellProcess) { if ($suppCellProcess) {
// Add the current cell to the suppression // Add the current cell to the suppression
if (!in_array($field, $suppCell[$i])) { $suppCell[$i][] = $field;
array_push($suppCell, [$i => $field]);
}
// Additional Suppression // Additional Suppression
if (isset($rowSettings[$i][$field]['valueSuppression']['otherRowCol'])) { if (isset($rowSettings[$i][$field]['valueSuppression']['otherRowCol'])) {
// Set the other Row/Col from setting // Set the other Row/Col from setting
...@@ -154,13 +148,16 @@ class HtmlFormatterType extends FormatterBase { ...@@ -154,13 +148,16 @@ class HtmlFormatterType extends FormatterBase {
// Loop through other Row/Column and set // Loop through other Row/Column and set
foreach($otherRowCol as $otherRow => $value) { foreach($otherRowCol as $otherRow => $value) {
foreach($value as $key => $otherField) { foreach($value as $key => $otherField) {
if (!in_array($otherField, $suppCell[$otherRow])) { if (is_numeric($otherRow) && !in_array($otherField, $suppCell[$otherRow])) {
array_push($suppCell, [$otherRow => $otherField]); // Add for other row/column
$suppCell[$otherRow][] = $otherField;
} elseif ($otherRow == 'current' && !in_array($i, $suppCell[$i])) {
// Add for other columns in current row
$suppCell[$i][] = $otherField;
} }
} }
} }
} }
} }
} }
} }
...@@ -168,8 +165,8 @@ class HtmlFormatterType extends FormatterBase { ...@@ -168,8 +165,8 @@ class HtmlFormatterType extends FormatterBase {
// Process actual suppressions // Process actual suppressions
if (!$suppOverride) { if (!$suppOverride) {
foreach($suppCell as $key => $value) { foreach($suppCell as $row => $value) {
foreach($value as $row => $field) { foreach($value as $key => $field) {
$rowData[$row]->$field = '+'; $rowData[$row]->$field = '+';
} }
} }
......
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