- and l.billable * upb.rate * time_to_sec(l.duration)/3600 > 0
- and upb.user_id = l.user_id and upb.project_id = l.project_id";
+ and upb.user_id = l.user_id and upb.project_id = l.project_id
+ and l.billable = 1"; // l.billable * upb.rate * time_to_sec(l.duration)/3600 > 0
+ // Users with a lot of clients and projects (Jaro) may forget to set user rates properly.
+ // Specifically, user rate may be set to 0 on a project, by mistake. This leads to error.no_invoiceable_items
+ // and increased support cost. Commenting out allows us to include 0 cost items in invoices so that
+ // the problem becomes obvious.
+
+ // TODO: If the above turns out useful, rework the query to simplify it by removing left join.