Prechádzať zdrojové kódy

#1144 Audit category having no rule -> PHP notices when showing the report + improved the behavior when the OQL of a rule is wrong.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3742 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 rokov pred
rodič
commit
d0823245fb
1 zmenil súbory, kde vykonal 7 pridanie a 4 odobranie
  1. 7 4
      pages/audit.php

+ 7 - 4
pages/audit.php

@@ -310,11 +310,10 @@ try
 						}
 					}
 					$aResults[] = $aRow;
-					$iTotalErrors = count($aObjectsWithErrors);
-					$sOverallPercentOk = ($iCount == 0) ? '100.00' : sprintf('%.2f', 100.0 * (($iCount - $iTotalErrors) / $iCount));
-					$sClass = GetReportColor($iCount, $iTotalErrors);
-		
 				}
+				$iTotalErrors = count($aObjectsWithErrors);
+				$sOverallPercentOk = ($iCount == 0) ? '100.00' : sprintf('%.2f', 100.0 * (($iCount - $iTotalErrors) / $iCount));
+				$sClass = GetReportColor($iCount, $iTotalErrors);
 			}
 			catch(Exception $e)
 			{
@@ -326,6 +325,10 @@ try
 				$sMessage = Dict::Format('UI:Audit:ErrorIn_Category_Reason', $oAuditCategory->GetHyperlink(), $e->getMessage());
 				$oP->p("<img style=\"vertical-align:middle\" src=\"../images/stop-mid.png\"/>&nbsp;".$sMessage);
 				$aResults[] = $aRow;					
+
+				$sClass = 'red';
+				$iTotalErrors = 'n/a';
+				$sOverallPercentOk = '';
 			}
 			$oP->add("<tr>\n");
 			$oP->add("<th><img src=\"../images/minus.gif\"></th><th class=\"alignLeft\">".$oAuditCategory->GetName()."</th><th class=\"alignRight\">$iCount</th><th class=\"alignRight\">$iTotalErrors</th><th class=\"alignRight $sClass\">$sOverallPercentOk %</th>\n");