notification on interest

This commit is contained in:
CHIEFSOFT\ameye
2025-08-01 18:57:47 -04:00
parent e665f189a9
commit 8d1a22cfa4
+13 -2
View File
@@ -1007,7 +1007,9 @@ long WrenchJobsOfferInterest(CVars in, CVars &out) {
REQ_LONG(in, "member_id", 1, -1);
REQ_STRING(in, "offer_code", 1, 15, "(.*)"); //offer_code
const PGresult *res = pgsql_query("SELECT *,id as offer_id FROM members_jobs_offer WHERE offer_code ='%s' AND expire>= now() AND status = 1 AND public_view > 0", in["offer_code"].c_str());
const PGresult *res = pgsql_query("SELECT *,id as offer_id, member_id AS job_owner_member_id FROM members_jobs_offer WHERE offer_code ='%s' "
" AND expire>= now() AND status = 1 "
" AND public_view > 0", in["offer_code"].c_str());
if (res != NULL && pgsql_num_rows(res) > 0) {
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
if (!f.empty()) {
@@ -1020,7 +1022,8 @@ long WrenchJobsOfferInterest(CVars in, CVars &out) {
return ret;
}
const PGresult *res1 = pgsql_query("SELECT * FROM members_offer_interest WHERE offer_id =%lu AND member_id = %lu AND status IN(1,5)", rec["offer_id"].Long(), in["member_id"].Long());
const PGresult *res1 = pgsql_query("SELECT * FROM members_offer_interest WHERE offer_id =%lu AND member_id = %lu "
" AND status IN(1,5)", rec["offer_id"].Long(), in["member_id"].Long());
if (res1 != NULL && pgsql_num_rows(res1) > 0) {
out["status"] = "You have sent or completed a request for this task already.";
return ret;
@@ -1039,6 +1042,14 @@ long WrenchJobsOfferInterest(CVars in, CVars &out) {
x["interest_id"] = interest_id;
x["interest_id"].set_valid(true);
job_email(JOBS_OFFER_INTEREST_MAIL, x, out); // note I need interest_id to
CVars xy;
if ( load_db_record(xy, "SELECT id AS member_id, uid AS member_uid, 'message.svg' AS icon "
" FROM members WHERE id = %lu ",rec["job_owner_member_id"].Long()) > 0 ){
xy["msg"] = "You have received an interest in your task !!!";
xy["msg"].set_valid(true);
plan_notification(xy, out);
}
}
}
}