Filter active jobs
This commit is contained in:
@@ -474,6 +474,7 @@ long WrenchJobManagerActiveTasksList(CVars in, CVars &out) {
|
||||
|
||||
long WrenchUsersActiveTasksList(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "WrenchJobManagerActiveTasksList()");
|
||||
char extraq[60];
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
@@ -481,12 +482,18 @@ long WrenchUsersActiveTasksList(CVars in, CVars &out) {
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
long offset = REQ_LONG(in, "offset", 1, -1);
|
||||
long limit = REQ_LONG(in, "limit", 1, -1);
|
||||
long allstatus = REQ_LONG(in, "allstatus", 1, -1);
|
||||
|
||||
if ( allstatus == 100 ){
|
||||
snprintf(extraq, sizeof (extraq), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(extraq, sizeof (extraq), " AND mc.delivery_date > now() ");
|
||||
}
|
||||
|
||||
out["total_record"] = "0";
|
||||
|
||||
const PGresult *res;
|
||||
|
||||
|
||||
res = pgsql_query("SELECT mc.id AS contract_id, mc.job_id AS job_id, mc.price, mc.timeline_days,mc.contract, "
|
||||
" mj.title, mj.description AS description,mc.job_detail AS job_description,mc.uid AS contract_uid, "
|
||||
" mj.banner AS banner, c.code AS currency_code, c.description AS currency_description, "
|
||||
@@ -499,8 +506,8 @@ long WrenchUsersActiveTasksList(CVars in, CVars &out) {
|
||||
" LEFT JOIN members_jobs mj ON mj.id = mc.job_id "
|
||||
" LEFT JOIN members m ON m.id=mc.client_id "
|
||||
" LEFT JOIN currency c ON c.country=mj.country "
|
||||
" WHERE mc.client_id =%lu AND mc.status IN (1,2,4) AND mc.delivery_date > now() "
|
||||
" ORDER BY mc.id DESC LIMIT %lu OFFSET %lu",member_id, member_id, limit, offset);
|
||||
" WHERE mc.client_id =%lu AND mc.status IN (1,2,4) %s "
|
||||
" ORDER BY mc.id DESC LIMIT %lu OFFSET %lu",member_id, member_id,extraq, 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);
|
||||
|
||||
Reference in New Issue
Block a user