fix
This commit is contained in:
@@ -210,7 +210,11 @@ long cron_email(long mailtype, CVars in, CVars &out) {
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case WRB_CRONJOB_PENDOFFER_ALERT:
|
||||
vars2form(x, form);
|
||||
form.LetStr("email", in["email"].c_str());
|
||||
form.Email("REMINDER/offer_pending_reminder.mailfile");
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
return PastDueOffersRefund(in, out);
|
||||
break;
|
||||
|
||||
case WRB_CRONJOB_PENDOFFER_ALERT:
|
||||
return OfferPending(in, out);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
logfmt(logINFO, "/sitecrons_calls()");
|
||||
@@ -65,9 +69,31 @@ long ReviewReminder(CVars in, CVars &out) {
|
||||
}
|
||||
|
||||
long OfferPending(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "ENTER OfferPending()");
|
||||
|
||||
const PGresult *res = pgsql_query("SELECT jo.id AS offer_id,jo.added,j.title,jo.expire,jo.email, jo.client_id, "
|
||||
"jo.job_id,jo.reminder_count,jo.reminder_date "
|
||||
"FROM members_jobs_offer jo "
|
||||
"LEFT JOIN members_jobs j ON j.id = jo.job_id "
|
||||
"WHERE now() > jo.added +'6 hrs' "
|
||||
"AND jo.expire > now() AND jo.status = 1 AND jo.public_view =0 "
|
||||
"AND jo.reminder_count =0 AND jo.reminder_date IS NULL LIMIT 1 ");
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, i);
|
||||
if (f.empty()) continue;
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
|
||||
cron_email(WRB_CRONJOB_PENDOFFER_ALERT, rec, out); // send the cron email
|
||||
|
||||
pgsql_exec("UPDATE members_jobs_offer SET reminder_count=reminder_count+1, reminder_date=now() "\
|
||||
"WHERE id=%lu AND job_id=%lu ", rec["offer_id"].Long(),rec["job_id"].Long());
|
||||
}
|
||||
}
|
||||
logfmt(logINFO, "/OfferPending()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
long InterestPending(CVars in, CVars &out) {
|
||||
|
||||
Reference in New Issue
Block a user