Skip to content

Bugfix Issue 743 ExecByDateTime Report Fix

CI Agent edited this page Aug 26, 2026 · 1 revision

Bugfix: Issue #743 — Execution By Date/Time report fails with "Document generation error"

Problem

Clicking Reports → Execution By Date/Time in the sidebar menu triggered a "Document generation error: the test plan is missing, unknown or does not belong to the selected test project."

Root Cause

The sidebar menu's else clause in lib/general/asideMenu.php (lines 184-186) built legacy report URLs without the required format, tproject_id, and tplan_id query parameters. When the user clicked the report link, execTimelineStats.php received no parameters, initArgsForReports() parsed tplan_id = NULL, get_by_id(NULL) returned null, and the error was triggered at displayMgr.php:76-78.

Every modernized report entry (lines 68-183) explicitly appended these parameters. The else fallthrough for non-modernized reports did not.

Fix

File: lib/general/asideMenu.php:184-186

} else {
    $sep = (strpos($rptItem['url'], '?') !== false) ? '&' : '?';
    $hrefR = $baseHrefR . $rptItem['url'] .
             "{$sep}format=0&tproject_id={$tprojectID}&tplan_id={$tplanID}";
}
  • Uses strpos() to choose ? or & as separator (some legacy report URLs already contain ?type=...).
  • format=0 is required because displayMgr.php:87-90 exits if format is NULL.
  • Integer values are safely intval()-cast at lines 28/42, so no XSS/injection risk.

Affected Reports

The fix benefits all non-modernized reports in the else clause:

  • execTimelineStats.php (Execution By Date/Time) — primary bug target
  • freeTestCases.php (Free Test Cases) — params harmlessly ignored
  • resultsReqs.php (Requirements Coverage) — reads from session
  • resultsByStatus.php (Failed/Blocked/Not Run) — these have a pre-existing title-mismatch issue that routes them to the else clause instead of the modernized path (separate issue to track)
  • resultsBugs.php (Bugs reports) — same pre-existing issue

Regression Test

# Step Expected Actual Status
1 Login, navigate to index.php?tproject_id=1&tplan_id=2 Sidebar shows Reports section Reports section visible PASS
2 Click Reports > Execution By Date/Time Report renders with correct context "Execution By Date/Time Statistics" with TestProject/TestPlan1 PASS
3 Verify URL has all params URL: execTimelineStats.php?format=0&tproject_id=1&tplan_id=2 All params present PASS
4 Check Event Viewer No new errors Only pre-existing warnings PASS
5 Verify other legacy report links have params All else-clause URLs have format/tproject_id/tplan_id Confirmed PASS

Commit

b0401e3cc — fix(asideMenu): append format/tproject_id/tplan_id to legacy report URLs

Clone this wiki locally