#40367·dolibarr

[BUG] SQL syntax error in projet/tasks/time.php - Missing comma after pt.billable

Author: stefanomiorCreated Sep 12, 2026Updated Sep 21, 2026
LabelsBug

Bug

Description

A DB_ERROR_SYNTAX is thrown when accessing the task time list (projet/tasks/time.php). The SQL query string builder lacks a separating comma between pt.billable and u.lastname, causing MariaDB/MySQL query validation to fail.

Affected Code

File: projet/tasks/time.php

php
$sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet, pt.billable";
$sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,";

### Proposed Fix

In `projet/tasks/time.php`, add a missing comma after `pt.billable`:

```diff
- $sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet, pt.billable";
+ $sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet, pt.billable,";
  $sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,";

### Dolibarr Version

23.0.4

### Environment PHP

8.2.33

### Environment Database

10.11.19-MariaDB-cll-lve

### Steps to reproduce the behavior and expected behavior

### Steps to reproduce
1. Navigate to `/projet/tasks/time.php?withproject=1&projectid=1&mainmenu=home` (or open the task time spent list for any project).
2. Observe the `DB_ERROR_SYNTAX` error.

### Attached files

<details>
<summary>Full Error Log</summary>

```text
Dolibarr: 23.0.4
PHP: 8.2.33
Server: Apache
OS: Linux
Database type: mysqli

Requested URL: /projet/tasks/time.php?withproject=1&projectid=1&mainmenu=home
Referer: [https://mrwork.mgengineeringsarl.com/projet/tasks/time.php?withproject=1&projectid=1](https://mrwork.mgengineeringsarl.com/projet/tasks/time.php?withproject=1&projectid=1)

Last database access query:
SELECT t.rowid, t.fk_element, t.element_date, t.element_datehour, t.element_date_withhour, t.element_duration, t.fk_user, t.note, t.thm, t.fk_product, t.invoice_line_id, pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet, pt.billable u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status, il.fk_facture as invoice_id, inv.fk_statut, p.fk_soc,s.name_alias FROM llxa7_element_time as t LEFT JOIN llxa7_facturedet as il ON il.rowid = t.invoice_line_id LEFT JOIN llxa7_facture as inv ON inv.rowid = il.fk_facture LEFT JOIN llxa7_product as prod ON prod.rowid = t.fk_product INNER JOIN llxa7_projet_task as pt ON pt.rowid = t.fk_element LEFT JOIN llxa7_projet_task_extrafields as efpt ON pt.rowid = efpt.fk_object INNER JOIN llxa7_projet as p ON p.rowid = pt.fk_projet INNER JOIN llxa7_user as u ON t.fk_user = u.rowid LEFT JOIN llxa7_societe as s ON s.rowid = p.fk_soc WHERE elementtype = 'task' AND p.entity IN (1) AND pt.fk_projet IN (1) ORDER BY t.element_date DESC, t.element_datehour DESC, t.rowid DESC LIMIT 21

Return code: DB_ERROR_SYNTAX
Last error info: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status, ...' at line 1