Userrs tasks
This commit is contained in:
@@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
long WrenchJobManagerOffers( CVars in, CVars &out);
|
long WrenchJobManagerOffers( CVars in, CVars &out);
|
||||||
long WrenchJobManagerList( CVars in, CVars &out );
|
long WrenchJobManagerList( CVars in, CVars &out );
|
||||||
|
long WrenchUsersTasksList( CVars in, CVars &out);
|
||||||
#endif
|
#endif
|
||||||
@@ -262,3 +262,88 @@ long WrenchJobManagerList( CVars in, CVars &out){
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
long WrenchUsersTasksList(CVars in, CVars &out) {
|
||||||
|
logfmt(logINFO, "WrenchMemberActiveJobs()");
|
||||||
|
char vname[30];
|
||||||
|
long ret = PHP_API_BAD_PARAM;
|
||||||
|
|
||||||
|
try {
|
||||||
|
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);
|
||||||
|
|
||||||
|
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, "
|
||||||
|
" (CASE WHEN mc.status=4 THEN 'Review' "
|
||||||
|
" WHEN mc.status = 1 AND mc.delivery_date > now() THEN 'Active' "
|
||||||
|
" 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.client_id =%lu AND mc.status IN (1,2,4) "
|
||||||
|
" ORDER BY mc.id DESC LIMIT %lu OFFSET %lu", in["member_id"].Long(), 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);
|
||||||
|
|
||||||
|
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
|
||||||
|
map<const char*, const char*>f = pgsql_fetch_assoc(res, i);
|
||||||
|
if (f.empty()) continue;
|
||||||
|
CVars rec;
|
||||||
|
map_to_cvars(f, rec);
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "title_%05d", i);
|
||||||
|
out[vname] = rec["title"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "project_%05d", i);
|
||||||
|
out[vname] = rec["project"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "description_%05d", i);
|
||||||
|
out[vname] = rec["description"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "status_description_%05d", i);
|
||||||
|
out[vname] = rec["status_description"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "delivery_date_%05d", i);
|
||||||
|
out[vname] = rec["delivery_date"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "status_description_%05d", i);
|
||||||
|
out[vname] = rec["status_description"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "timeline_days_%05d", i);
|
||||||
|
out[vname] = rec["timeline_days"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "contract_%05d", i);
|
||||||
|
out[vname] = rec["contract"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "job_description_%05d", i);
|
||||||
|
out[vname] = rec["job_description"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "price_%05d", i);
|
||||||
|
out[vname] = rec["price"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "job_id_%05d", i);
|
||||||
|
out[vname] = rec["job_id"];
|
||||||
|
|
||||||
|
snprintf(vname, sizeof (vname), "contract_id_%05d", i);
|
||||||
|
out[vname] = rec["contract_id"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = PHP_API_OK;
|
||||||
|
out["status"] = "OK";
|
||||||
|
} catch (bad_parameter) {
|
||||||
|
logfmt(logINFO, "ERROR CALL long WrenchMemberActiveJobs(CVars in, CVars &out)");
|
||||||
|
}
|
||||||
|
logfmt(logINFO, "/WrenchMemberActiveJobs()");
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "account.h"
|
#include "account.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
#include "jobs_manager.h"
|
||||||
|
|
||||||
#include "account_mngt.h"
|
#include "account_mngt.h"
|
||||||
#include "contract.h"
|
#include "contract.h"
|
||||||
@@ -306,5 +307,6 @@ long WrenchReturnJobOffersList(CVars in, CVars &out) {
|
|||||||
|
|
||||||
/* This return the list of jobs on the home page of the apps*/
|
/* This return the list of jobs on the home page of the apps*/
|
||||||
long WrenchReturnActiveJobsList(CVars in, CVars &out) {
|
long WrenchReturnActiveJobsList(CVars in, CVars &out) {
|
||||||
return WrenchMemberActiveJobs(in, out);
|
return WrenchUsersTasksList(in, out);
|
||||||
|
// retired return WrenchMemberActiveJobs(in, out);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user