From 934a4cf348069fd2cbaf3b3fd3e39644e469b432 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 22 Aug 2024 07:01:21 -0400 Subject: [PATCH] dened job --- wrenchboard/src/shared_tool/jobs.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index 8b5f27b4..a4d9e7d6 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -1806,11 +1806,6 @@ long WrenchSendJobsOfferPublic(CVars in, CVars &out) { logfmt(logINFO, "Price = %lu Balance = %lu", y["price"].Long(), z["amount"].Long()); try { - // if ( load_db_record( out, "SELECT count(id) AS duplicate_name FROM members_jobs_offer WHERE LOWER(group_name)=LOWER('%s') AND member_id =%lu AND status = 1",in["group_name"].c_str(), in["member_id"].Long() )) - // { - // if ( out["duplicate_name"].Long() > 0 ) { return PHP_API_BAD_PARAM; } // return no duplicate on any active name - // } // this action blocks out duplicate - x["member_id"] = in["member_id"]; x["member_id"].set_valid(true); x["job_id"] = in["job_id"]; @@ -1827,6 +1822,22 @@ long WrenchSendJobsOfferPublic(CVars in, CVars &out) { x["depend_uid"] = in["depend_uid"]; x["depend_uid"].set_valid(true); + if ( x["depend_uid"] != ""){ + logfmt(logINFO, "****** Let us confirm this job is in the market === > %s", x["depend_uid"].c_str()); + + const PGresult *resF = pgsql_query(" SELECT c.public_view,c.expire,c.job_id " + " FROM members_jobs_offer c " + " LEFT JOIN members_jobs j ON j.id = c.job_id " + " WHERE c.public_view = 1 and c.expire> now() AND j.uid::text ='%s' ", x["depend_uid"].c_str()); + if (resF != NULL && pgsql_num_rows(resF) > 0) { + logfmt(logINFO, "ALL Good ****** Let us confirm this job is in the market === > %s", x["depend_uid"].c_str()); + } + else{ + out["status"] = "Depended task must be active in the market"; + return ret; + } + } + const char * loc = getenv("REMOTE_ADDR"); x["loc"] = loc;