client filter

This commit is contained in:
CHIEFSOFT\ameye
2023-06-03 09:53:00 -04:00
parent 7539df3d3a
commit 871c42bb4a
+4 -2
View File
@@ -292,6 +292,8 @@ long WrenchJobManagerActiveTasksList(CVars in, CVars &out) {
map<const char*, const char*>f1 = pgsql_fetch_assoc(res0, 0);
CVars res0;
map_to_cvars(f1, res0);
snprintf(extra_filter, sizeof (extra_filter), " AND mc.client_id = %lu ",res0["client_id"].Long());
}
}
@@ -303,8 +305,8 @@ long WrenchJobManagerActiveTasksList(CVars in, CVars &out) {
" WHEN mc.status = 1 AND mc.delivery_date <now() THEN 'Past Due' "
" ELSE 'Others' END) AS status_description,mc.delivery_date "
" FROM members_jobs_contract mc LEFT JOIN members_jobs mj ON mj.id = mc.job_id LEFT JOIN members m ON m.id=mc.client_id "
" WHERE mc.member_id =%lu AND mc.status IN (1,2,4) AND mc.delivery_date > now() "
" ORDER BY mc.id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(), limit, offset);
" WHERE mc.member_id =%lu %s AND mc.status IN (1,2,4) AND mc.delivery_date > now() "
" ORDER BY mc.id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(),extra_filter, limit, offset);
//ORDER BY id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(), limit, offset);
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);