sggested save
This commit is contained in:
@@ -85,7 +85,9 @@ long WrenchSuggestTasks(CVars in, CVars &out){
|
|||||||
REQ_STRING(in, "title", 3, 150, "(.*)");
|
REQ_STRING(in, "title", 3, 150, "(.*)");
|
||||||
REQ_STRING(in, "description", 3, 299, "(.*)");
|
REQ_STRING(in, "description", 3, 299, "(.*)");
|
||||||
|
|
||||||
const PGresult *res = pgsql_query("SELECT * FROM members WHERE id=%lu AND uid='%s'", member_id, in["uid"].c_str());
|
const PGresult *res = pgsql_query("SELECT m.* FROM members m "
|
||||||
|
" LEFT JOIN members_family mf ON mf.family_member_id = m.member_id "
|
||||||
|
" WHERE m.id=%lu AND m.uid='%s'", member_id, in["uid"].c_str());
|
||||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||||
CVars rec;
|
CVars rec;
|
||||||
@@ -93,8 +95,18 @@ long WrenchSuggestTasks(CVars in, CVars &out){
|
|||||||
ret = PHP_API_OK;
|
ret = PHP_API_OK;
|
||||||
out["status"] = "ACCOUNT FOUND";
|
out["status"] = "ACCOUNT FOUND";
|
||||||
out = rec;
|
out = rec;
|
||||||
|
if (rec["family_member_id"] != ""){ // we are sure you are a family now
|
||||||
|
|
||||||
|
CVars xx;
|
||||||
|
xx["member_id"] = member_id;
|
||||||
|
xx["member_id"].set_valid(true);
|
||||||
|
xx["title"] = in["title"];
|
||||||
|
xx["title"].set_valid(true);
|
||||||
|
xx["description"] = in["description"];
|
||||||
|
xx["description"].set_valid(true);
|
||||||
|
|
||||||
|
out["suggested_task_id"] = insert_db_record(DBS_VALID, "members_family_suggesttask", "members_family_suggesttask_id_seq", xx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (bad_parameter) {
|
} catch (bad_parameter) {
|
||||||
logfmt(logINFO, "ERROR CALL long WrenchSuggestTasks");
|
logfmt(logINFO, "ERROR CALL long WrenchSuggestTasks");
|
||||||
|
|||||||
Reference in New Issue
Block a user