Active job list
This commit is contained in:
@@ -29,7 +29,10 @@ long contract_calls(CVars in, CVars &out)
|
||||
case WRENCHBOARD_CONTRACT_STATUS:
|
||||
return WrenchContractStatus( in, out);
|
||||
break;
|
||||
|
||||
|
||||
case WRENCHBOARD_CONTRACT_MSGLIST:
|
||||
return WrenchContractMessageList( in, out);
|
||||
break;
|
||||
}
|
||||
logfmt( logINFO, "/contract_calls()" );
|
||||
return 0;
|
||||
@@ -261,28 +264,66 @@ long WrenchContractMessage( CVars in, CVars &out )
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long WrenchEditJobs33( CVars in, CVars &out )
|
||||
long WrenchContractMessageList( CVars in, CVars &out )
|
||||
{
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt( logINFO, "LoginWrenchBoardAccount()" );
|
||||
REQ_STRING (in, "username", 5, 49, "(.*)");
|
||||
REQ_STRING (in, "password", 5, 49, "(.*)");
|
||||
REQ_STRING (in, "sessionid", 4, 40, "(.*)");
|
||||
OPTIONAL( in, "loc" ) REQ_STRING (in, "loc", 3, 15, "(.*)");
|
||||
logfmt( logINFO, "WrenchContractMessageList()" );
|
||||
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
in["loc"] = loc; in["loc"].set_valid(true);
|
||||
|
||||
ret = load_db_record( out, "SELECT *,id AS member_id FROM members WHERE status=1 AND LOWER(username)=LOWER('%s') AND password= md5('%s')", in["username"].c_str(), in["password"].c_str() );
|
||||
if (ret) {
|
||||
|
||||
} else {
|
||||
out["status"] = "Invalid username and/or password";
|
||||
}
|
||||
|
||||
try {
|
||||
long member_id = REQ_LONG(in, "member_id", 1, -1);
|
||||
REQ_STRING (in, "contract", 10, 25, "(.*)");
|
||||
out["total_record"] = "0";
|
||||
|
||||
const PGresult *res;
|
||||
|
||||
|
||||
res = pgsql_query(" SELECT to_char(jc.created, 'YYYY-MM-DD HH24:MI') AS msg_date,"
|
||||
" m.firstname AS msg_firstname,jc.id as msg_id,jc.message AS msg,"
|
||||
" jc.msg_type, jc.message "
|
||||
" FROM jobs_contract_message jc "
|
||||
" LEFT JOIN members m ON m.id=jc.member_id "
|
||||
" WHERE jc.contract='%s' ORDER by jc.id DESC", in["contract"].c_str());
|
||||
|
||||
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), "msg_date_%05d", i);
|
||||
out[vname] = rec["msg_date"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "msg_firstname_%05d", i);
|
||||
out[vname] = rec["msg_firstname"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "msg_id_%05d", i);
|
||||
out[vname] = rec["msg_id"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "msg_%05d", i);
|
||||
out[vname] = rec["msg"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "msg_type_%05d", i);
|
||||
out[vname] = rec["msg_type"];
|
||||
|
||||
snprintf(vname, sizeof (vname), "message_%05d", i);
|
||||
out[vname] = rec["message"];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long WrenchContractMessageList(CVars in, CVars &out)");
|
||||
}
|
||||
|
||||
logfmt( logINFO, "/LoginWrenchBoardAccount()" );
|
||||
logfmt( logINFO, "/WrenchContractMessageList()" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user