- // Prepare sql query part for inner joins.
- $inner_joins = null;
- if ($user->isPluginEnabled('ts')) {
- $timesheet_option = $options['timesheet'];
- if ($timesheet_option == TIMESHEET_PENDING)
- $inner_joins .= " inner join tt_timesheets ts on (ei.timesheet_id = ts.id and ts.submit_status = 1 and ts.approve_status is null)";
- else if ($timesheet_option == TIMESHEET_APPROVED)
- $inner_joins .= " inner join tt_timesheets ts on (ei.timesheet_id = ts.id and ts.approve_status = 1)";
- else if ($timesheet_option == TIMESHEET_NOT_APPROVED)
- $inner_joins .= " inner join tt_timesheets ts on (ei.timesheet_id = ts.id and ts.approve_status = 0)";
- else if ($options['show_timesheet'])
- $inner_joins .= " left join tt_timesheets ts on (ei.timesheet_id = ts.id)"; // Left join for timesheet name.
- }
-