diff --git a/wrenchboard/email/JOB/job_interest_member.mailfile b/wrenchboard/email/JOB/job_interest_member.mailfile
index 6e552edc..a65b19c9 100644
--- a/wrenchboard/email/JOB/job_interest_member.mailfile
+++ b/wrenchboard/email/JOB/job_interest_member.mailfile
@@ -23,10 +23,7 @@ img {height: auto;}
.footercopy {font-family: sans-serif; font-size: 14px; color: #ffffff;}
.footercopy a {color: #ffffff; text-decoration: underline;}
-+6666666666666666
-
-
diff --git a/wrenchboard/src/include/bko.h b/wrenchboard/src/include/bko.h
index 16960242..aff63fe0 100644
--- a/wrenchboard/src/include/bko.h
+++ b/wrenchboard/src/include/bko.h
@@ -5,7 +5,7 @@
long bko_calls(CVars in, CVars &out);
long LoginBkoAdmin(CVars in, CVars &out);
-
+long BkoSendPush(CVars in, CVars &out);
#endif
diff --git a/wrenchboard/src/include/wrenchboard_api.h b/wrenchboard/src/include/wrenchboard_api.h
index 18de58dd..baef5cd3 100644
--- a/wrenchboard/src/include/wrenchboard_api.h
+++ b/wrenchboard/src/include/wrenchboard_api.h
@@ -154,6 +154,7 @@ enum { PARTNER_STRIPE };
#define WRB_CRONJOB_PASTDUE_ALERT 774
#define WRB_CRONJOB_OFFER_REFUND_ALERT 775
#define WRB_CRONJOB_PENDOFFER_ALERT 776
+#define WRB_CRONJOB_NOTIFICATIONS 777
//**************************************************************
#define WRENCHBOARD_BKO_START 10000
diff --git a/wrenchboard/src/shared_tool/bko.cc b/wrenchboard/src/shared_tool/bko.cc
index 1be18e3e..c1a57dd8 100644
--- a/wrenchboard/src/shared_tool/bko.cc
+++ b/wrenchboard/src/shared_tool/bko.cc
@@ -19,7 +19,7 @@
long BkoCommonSessionCheck(long backoffice_id,long shop,long acc, const char *sessionid, int create );
long BkoResendOffer(CVars in, CVars &out);
-long BkoSendPush(CVars in, CVars &out);
+
long BkoResendMarketing(CVars in, CVars &out);
struct MemoryStruct {
diff --git a/wrenchboard/src/shared_tool/site_crons.cc b/wrenchboard/src/shared_tool/site_crons.cc
index 2cf281de..ac2a2303 100644
--- a/wrenchboard/src/shared_tool/site_crons.cc
+++ b/wrenchboard/src/shared_tool/site_crons.cc
@@ -22,7 +22,7 @@ long SignUpPendingReminder(CVars in, CVars &out);
long SignUpStats(CVars in, CVars &out);
long PastDueWarings(CVars in, CVars &out);
long PastDueOffersRefund(CVars in, CVars &out);
-
+long NotificationSystem(CVars in, CVars &out);
long CronTracker(CVars in, CVars &out);
/*
CREATE TABLE cron_jobs (
@@ -90,12 +90,66 @@ long sitecrons_calls(CVars in, CVars &out) {
return OfferPending(in, out);
break;
+ case WRB_CRONJOB_NOTIFICATIONS:
+ ct["job_type"]="WRB_CRONJOB_PENDOFFER_ALERT"; ct["job_type"].set_valid( true );
+ ct["description"]="Offer is pending remind the client to attend to it before it expires "; ct["description"].set_valid( true );
+ CronTracker(ct, co);
+ return NotificationSystem(in, out);
+
+ break;
+
}
logfmt(logINFO, "/sitecrons_calls()");
return ret;
}
+long NotificationSystem(CVars in, CVars &out){
+ long ret = 0;
+ const PGresult *res;
+ long limit = in["one_limit"].Long();
+ logfmt(logINFO, "ENTER NotificationSystem()");
+ long contract_id = 0;
+ const PGresult *res = pgsql_query("SELECT count(member_uid) AS mcount,member_uid "
+ " FROM members_notification WHERE status=1 GROUP BY member_uid LIMIT %lu",limit);
+ if (res != NULL && pgsql_num_rows(res) > 0) {
+ for (int i = 0, n = pgsql_num_rows(res); i < n; i++) {
+ mapf = pgsql_fetch_assoc(res, i);
+ if (f.empty()) continue;
+ CVars rec;
+ map_to_cvars(f, rec);
+/*
+wrenchboard=> SELECT uid,member_uid,msg FROM members_notification WHERE status =1 AND member_uid = '7b66905e-b2c4-4ae3-9b32-83aa50d4d0f5' ORDER BY id DESC LIMIT 1;
+ uid | member_uid | msg
+--------------------------------------+--------------------------------------+---------------------------------------------------------
+ 40a675fc-8073-4fb7-8b81-2fa699779e54 | 7b66905e-b2c4-4ae3-9b32-83aa50d4d0f5 | You have received a new offer waiting for you to start!
+(1 row)
+
+*/
+ if ( load_db_record(out, "SELECT id AS notification_id, uid,member_uid,msg FROM members_notification "
+ " WHERE status =1 AND member_uid = '%s' ORDER BY id DESC LIMIT 1", rec["member_uid"].c_str())> 0){
+
+ CVars xx;
+ xx["member_uid"] = out["member_uid"]; xx["member_uid"].set_valid( true );
+ xx["push_text"] = out["msg"]; xx["push_text"].set_valid( true );
+ long push_ret = BkoSendPush( xx, out);
+
+ if (push_ret == PHP_API_OK){
+ xx["send_result"] = "COMPLETED"; xx["send_result"].set_valid( true );
+ }
+ else
+ {
+ xx["send_result"] = "FAIL"; xx["send_result"].set_valid( true );
+ }
+ pgsql_query("UPDATE members_notification SET send=now(), send_result='%s' WHERE id = %lu", out["notification_id"].Long(),xx["send_result"].c_str());
+ }
+ }
+ }
+
+
+ return ret;
+}
+
long CronTracker(CVars in, CVars &out){
long ret = 0;
const PGresult *res;