Job edit errors

This commit is contained in:
CHIEFSOFT\ameye
2023-05-19 06:24:36 -04:00
parent 7d361efb3d
commit a2bbef8a1e
2 changed files with 10 additions and 2 deletions
@@ -8,6 +8,8 @@ enum { PARTNER_STRIPE };
#define PHP_API_OK 0
#define PHP_CREATED_OK 10
#define PHP_UPDATED_OK 15
#define PHP_LOGIN_OK 100
#define PHP_API_BAD_PARAM -1
+8 -2
View File
@@ -1227,6 +1227,12 @@ long WrenchEditJobs(CVars in, CVars &out) {
const PGresult *res = pgsql_query("SELECT *,id AS job_id FROM members_jobs WHERE id = %lu AND member_id = %lu AND uid='%s'", job_id, member_id,in["job_uid"].c_str());
if (res != NULL && pgsql_num_rows(res) > 0) {
// good to continue
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
if (!f.empty()) {
CVars rec;
map_to_cvars(f, rec);
job_id = rec["job_id"];
}
} else {
out["status"] = "Valid Job/Task Not Found";
return ret;
@@ -1246,12 +1252,12 @@ long WrenchEditJobs(CVars in, CVars &out) {
x["loc"].set_valid(true);
x["job_detail"] = in["job_detail"];
x["job_detail"].set_valid(true);
job_id = insert_db_record(DBS_VALID, "members_jobs", "members_jobs_id_seq", x);
// job_id = insert_db_record(DBS_VALID, "members_jobs", "members_jobs_id_seq", x);
if (job_id> 0) {
update_db_record(DBS_VALID, "members_jobs", x, job_id) ;
load_db_record(out, "SELECT *,id AS job_id FROM members_jobs WHERE id = %lu ", job_id);
ret = PHP_CREATED_OK;
ret = PHP_UPDATED_OK;
} else {
out["status"] = "Unable to create job";
}