This commit is contained in:
Ryan Prather 2018-09-27 14:27:57 -04:00
parent dda64e1239
commit dca07e06f5
2 changed files with 10 additions and 4 deletions

View File

@ -353,10 +353,16 @@ $conditions['not_reviewed_count']->getStyle()
->setEndColor($yellow); ->setEndColor($yellow);
$validation['host_status']->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST); $validation['host_status']->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation['host_status']->setFormula1("=ValidStatus"); $validation['host_status']->setAllowBlank(false);
$validation['host_status']->setFormula1('"Not Reviewed,Not a Finding,Open,Not Applicable,No Data,Exception,False Positive"');
$validation['host_status']->setShowDropDown(true); $validation['host_status']->setShowDropDown(true);
$validation['host_status']->setShowErrorMessage(true);
$validation['host_status']->setError("Selected value not valid");
$validation['host_status']->setErrorTitle("Invalid selection");
$validation['host_status']->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP);
$validation['true_false']->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST); $validation['true_false']->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation['true_false']->setAllowBlank(false);
$validation['true_false']->setFormula1("=TRUE,FALSE"); $validation['true_false']->setFormula1("=TRUE,FALSE");
$validation['true_false']->setShowDropDown(true); $validation['true_false']->setShowDropDown(true);

View File

@ -239,8 +239,6 @@ foreach ($findings as $worksheet_name => $data) {
$col = Coordinate::stringFromColumnIndex($col_id); $col = Coordinate::stringFromColumnIndex($col_id);
$sheet->setCellValue("{$col}{$row}", $status); $sheet->setCellValue("{$col}{$row}", $status);
$sheet->getCell("{$col}{$row}")->setDataValidation(clone $validation['host_status']);
$log->debug("Set data validation for target $host_name");
} }
$overall_str = "=IF(" . $overall_str = "=IF(" .
@ -252,7 +250,6 @@ foreach ($findings as $worksheet_name => $data) {
"COLUMNS(F{$row}:{$last_tgt_col}{$row}), TRUE, FALSE)"; "COLUMNS(F{$row}:{$last_tgt_col}{$row}), TRUE, FALSE)";
$sheet->setCellValue($overall_col . $row, $overall_str); $sheet->setCellValue($overall_col . $row, $overall_str);
$sheet->getCell("{$col}{$row}")->setDataValidation(clone $validation['host_status']);
$sheet->setCellValue($same_col . $row, $same_str, true) $sheet->setCellValue($same_col . $row, $same_str, true)
->getStyle("{$same_col}11:{$same_col}{$sheet->getHighestDataRow()}") ->getStyle("{$same_col}11:{$same_col}{$sheet->getHighestDataRow()}")
@ -266,6 +263,9 @@ foreach ($findings as $worksheet_name => $data) {
$row++; $row++;
} }
$sheet->setDataValidation("{$col}11:{$col}{$row}", clone $validation['host_status']);
$log->debug("Set data validation for target $host_name");
$log->debug("Completed STIG parsing"); $log->debug("Completed STIG parsing");
$sheet->getStyle("F11:" . Coordinate::stringFromColumnIndex(count($data['target_list']) + 6) . $row) $sheet->getStyle("F11:" . Coordinate::stringFromColumnIndex(count($data['target_list']) + 6) . $row)
->setConditionalStyles($host_status); ->setConditionalStyles($host_status);