From 9099e17d6bf5ca3532b78ddf64e32e38d71b0601 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 28 May 2023 19:15:28 -0400 Subject: [PATCH] job id --- wrenchboard/src/shared_tool/jobs.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index 1b237e0c..e693fce5 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -531,6 +531,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { REQ_LONG(in, "member_id", 1, -1); long offer_result = REQ_LONG(in, "offer_result", 1, -1); REQ_STRING(in, "offer_code", 1, 15, "(.*)"); + long job_id = 0; long rc = 0; CVars outx; @@ -540,8 +541,16 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { const PGresult *res = pgsql_query("SELECT * FROM members_jobs_offer WHERE offer_code='%s' AND status = 1", in["offer_code"].c_str()); if (res != NULL && pgsql_num_rows(res) > 0) { - // now job is valid - + + // now job is valid + // good to continue + mapf = pgsql_fetch_assoc(res, 0); + if (!f.empty()) { + CVars rec; + map_to_cvars(f, rec); + job_id = rec["job_id"]; + } + if( offer_result == OFFER_RESEND){ if (load_db_record(outx, "SELECT o.id AS offer_id, o.*,to_char(o.expire, 'Day Mon dd, yyyy HH:MI AM') AS expire2,j.title,j.description,j.timeline_days,j.price FROM members_jobs_offer o LEFT JOIN members_jobs j ON j.id =o.job_id WHERE o.offer_code='%s' AND o.email IS NOT NULL", in["offer_code"].c_str())) { job_email(JOBS_INDIVIDUAL_OFFER_MAIL, outx, out); // make sure job went to individual @@ -579,7 +588,7 @@ long WrenchConcludeJobsOffer(CVars in, CVars &out) { break; case OFFER_ACCEPT: - x["job_id"] = out["job_id"]; + x["job_id"] = job_id; x["job_id"].set_valid(true); x["contract"] = in["offer_code"]; x["contract"].set_valid(true);