Bugfix Issue 743 ExecByDateTime Report Fix - sebiboga/testlink-upgraded GitHub Wiki
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=0is required becausedisplayMgr.php:87-90exits ifformatis 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 targetfreeTestCases.php(Free Test Cases) — params harmlessly ignoredresultsReqs.php(Requirements Coverage) — reads from sessionresultsByStatus.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