From b31ba2ff1aeab4d97ea0be00b8ecc27d0bab4327 Mon Sep 17 00:00:00 2001 From: Shaheem Azmal M MD Date: Tue, 18 Feb 2020 18:16:24 +0530 Subject: [PATCH] feat(unifiedReport): include DNU information in assesment summary if DNU files found Signed-off-by: Shaheem Azmal M MD --- src/unifiedreport/agent/reportStatic.php | 6 ++++++ src/unifiedreport/agent/unifiedreport.php | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/unifiedreport/agent/reportStatic.php b/src/unifiedreport/agent/reportStatic.php index 9bb3e36343..e1b109d764 100644 --- a/src/unifiedreport/agent/reportStatic.php +++ b/src/unifiedreport/agent/reportStatic.php @@ -173,6 +173,7 @@ function assessmentSummaryTable(Section $section, $otherStatement) $cellRowContinue = array("vMerge" => "continue"); $cellColSpan = array("gridSpan" => 4); $cellColSpan2 = array("gridSpan" => 3); + $cellColSpan3 = array("gridSpan" => 2, "valign" => "center"); $rowWidth = 200; $rowWidth2 = 300; @@ -243,8 +244,13 @@ function assessmentSummaryTable(Section $section, $otherStatement) $cell = $table->addCell($cellFirstLen)->addText(htmlspecialchars(" General Risks (optional)"), $leftColStyle, "pStyle"); $generalRisks = str_replace("\n", "", htmlspecialchars($otherStatement["ri_ga_risk"], ENT_DISALLOWED)); $cell = $table->addCell($cellLen)->addText($generalRisks, $rightColStyleBlue, "pStyle"); + if ($otherStatement["includeDNU"]) { + $table->addRow($rowWidth); + $cell = $table->addCell($cellFirstLen, $cellColSpan3); + } $section->addTextBreak(); + return $cell; } diff --git a/src/unifiedreport/agent/unifiedreport.php b/src/unifiedreport/agent/unifiedreport.php index a11b03c2fe..0079e1a62c 100644 --- a/src/unifiedreport/agent/unifiedreport.php +++ b/src/unifiedreport/agent/unifiedreport.php @@ -298,6 +298,7 @@ function processUploadId($uploadId) $otherStatement = $this->otherGetter->getReportData($uploadId); $this->heartbeat(empty($otherStatement) ? 0 : count($otherStatement)); + $otherStatement['includeDNU'] = (count($licensesDNU["statements"]) > 0) ? true : false; $contents = array( "licenses" => $licenses, @@ -702,7 +703,7 @@ private function writeReport($contents, $uploadId, $groupId, $userId) $contents['licensesHist']['statements'], $contents['otherStatement'], $timestamp, $groupName, $packageUri); /* Assessment summery table */ - $reportStaticSection->assessmentSummaryTable($section, $contents['otherStatement']); + $bookMarkCell = $reportStaticSection->assessmentSummaryTable($section, $contents['otherStatement']); /* Todoinfo table */ $reportStaticSection->todoTable($section); @@ -791,6 +792,12 @@ private function writeReport($contents, $uploadId, $groupId, $userId) /* Display Do not use license files */ $heading = "Do not use Files"; + if ($contents['otherStatement']['includeDNU']) { + // adding an internal bookmark + $columnStyleWithUnderline = array("size" => 11, "color" => "0000A0", 'underline' => 'single'); + $section->addBookmark('DNUBookmark'); + $bookMarkCell->addLink('DNUBookmark', htmlspecialchars(' NOTE: DO NOT USE files found! Please check Do not use files section', ENT_COMPAT, 'UTF-8'), $columnStyleWithUnderline, "pStyle", true); + } $titleSubHeadingIrre = "(Path, Files, Licenses)"; $this->getRowsAndColumnsForIrre($section, $heading, $contents['licensesDNU']['statements'], $titleSubHeadingIrre);