delcroip/dolibarr_project_timesheet

box_time.php with PostgreSQL returns a syntax error

caprageon opened this issue · 1 comments

Hello,

There is an issue causing a syntax error when displaying the box_time.php with postgresql version.

The query i'm refering to is here.

Below is my fix, althought i'm not sure if it is the expected result :

$sqlweek = "SELECT SUM(pt.task_duration)/3600 as duration, TO_CHAR(generate_series, 'YYYYWW') as week, u.weeklyhours FROM generate_series(DATE_TRUNC('week', (now() - INTERVAL '".$conf->global->TIMESHEET_OVERTIME_CHECK_WEEKS." week'))::timestamp, DATE_TRUNC('week', (now() - INTERVAL '1 WEEK' ))::timestamp, interval '1 week') LEFT JOIN llx_projet_task_time pt ON (generate_series = DATE_TRUNC('week',pt.task_date)) LEFT JOIN llx_user u on (pt.fk_user = ".$userid.") WHERE pt.fk_user = ".$userid." OR pt.fk_user is null GROUP BY generate_series, u.weeklyhours;";

thank you for the contrib