From 01472ecdff3ef29b41d6d46b60712d15cb0aa62b Mon Sep 17 00:00:00 2001 From: w3houde Date: Tue, 2 Jun 2026 04:00:48 +0700 Subject: [PATCH] Fix #38563 skip task-driven project load when allprojects view fetch returns no row (#38565) * Fix #38563 skip task-driven project load when allprojects view fetch returns no row The updateline handler at htdocs/projet/tasks/time.php line 302 populates $object via Task::fetch($id_temp) where $id_temp is the edited line's task id. After the save, the page falls through to the render block at line 937. In the all-projects view ($id=0, $ref=''), the outer if is entered only because $allprojectforuser is set, then the elseif tests $object->fetch($id, $ref) >= 0. Task::fetch returns 0 for no row but leaves prior properties untouched, so $object->fk_project carries the edited task's project. $projectstatic loads that project, $arrayofmassactions gets filled, and the per-row toselect[] checkbox renders on every row of the all-projects list, including rows for other projects. Tighten the guard to > 0 so the body only runs when fetch actually returned a row. The all-projects list then keeps the same render state it had before the line edit: no projectstatic load, no massactions. Reported by @priojk. Same code path on 23.0 and develop; 22.0 has a different structure for this block and is not affected. Signed-off-by: Dolicraft * Update time.php --------- Signed-off-by: Dolicraft Co-authored-by: Dolicraft Co-authored-by: Laurent Destailleur --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3dcdc60f39a..ab00ad72cd0 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -942,7 +942,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $projectstatic->fetch_thirdparty(); } $res = $projectstatic->fetch_optionals(); - } elseif ($object->fetch($id, $ref) >= 0) { + } elseif ($object->fetch($id, $ref) > 0) { if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && empty($object->comments)) { $object->fetchComments(); }