fix
This commit is contained in:
@@ -28,7 +28,7 @@ long LoginBkoAdmin(CVars in, CVars &out) {
|
||||
in["sessionid"].set_valid(true);
|
||||
|
||||
|
||||
ret = load_db_record(out, "SELECT *,id AS backoffice_id FROM bko_users WHERE status=1 AND LOWER(username)=LOWER('%s') AND password= md5('%s')", in["username"].c_str(), in["password"].c_str());
|
||||
ret = load_db_record(out, "SELECT *,id AS backoffice_id FROM bko_users WHERE status=1 AND LOWER(username)=LOWER('%s') AND pass= md5('%s')", in["username"].c_str(), in["password"].c_str());
|
||||
if (ret > 0) {
|
||||
if (BkoCommonSessionCheck(out["id"].Long(), 0, 0, in["sessionid"].c_str(), 1) > 0) {
|
||||
out["stauts"] = "OK";
|
||||
|
||||
@@ -29,6 +29,44 @@ long getMemberInvoiceID( long rid ){
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
long test_email_calls(long action, CVars in, CVars &out) {
|
||||
logfmt(logINFO, "test_email_calls()");
|
||||
out["result"] = "ECHO BACKEND";
|
||||
|
||||
CVars x, y, z, x1, x2;
|
||||
long ret = 0;
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
C_CGI_Form form("", "");
|
||||
// form.LetStr("subject", "myFit by MERMS Email Test");
|
||||
form.LetStr("site_name", "myFit by MERMS");
|
||||
form.LetStr("contactus", "https://myFit.mermsemr.com/");
|
||||
|
||||
|
||||
|
||||
if (load_db_record(x, "SELECT *,email as email2,now() AS last_login2 FROM members WHERE id = %lu ", in["member_id"].Long())) {
|
||||
vars2form(x, form);
|
||||
form.LetStr("subject", "Welcome to myFit by MERMS ");
|
||||
form.LetStr("email", x["email2"].c_str());
|
||||
form.Email("test_email.mailfile");
|
||||
|
||||
// alert_email_calls(MERMS_USER_CREATEACCOUNT, in, out);
|
||||
|
||||
}
|
||||
|
||||
if (load_db_record(x, "SELECT *,email as email2,now() AS last_login2 FROM members WHERE id = %lu ", in["member_id"].Long())) {
|
||||
vars2form(x, form);
|
||||
form.LetStr("subject", "Welcome to myFit by MERMS ");
|
||||
form.LetStr("email", x["email2"].c_str());
|
||||
form.Email("USERS/user_welcome.mailfile");
|
||||
|
||||
// alert_email_calls(MERMS_USER_CREATEACCOUNT, in, out);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long member_email_calls(long action, CVars in, CVars &out) {
|
||||
logfmt(logINFO, "member_email_calls()");
|
||||
out["result"] = "ECHO BACKEND";
|
||||
@@ -270,48 +308,19 @@ long provider_email_calls(long action, CVars in, CVars &out) {
|
||||
// form.LetStr("subject", "myFit by MERMS Email Test");
|
||||
char vname[100];
|
||||
|
||||
form.LetStr("site_name", "myFit by MERMS");
|
||||
form.LetStr("agent_site", "https://agent.medtransgo.com/");
|
||||
// form.LetStr("site_name", "myFit by MERMS");
|
||||
// form.LetStr("agent_site", "https://agent.medtransgo.com/");
|
||||
logfmt(logINFO, "@@@@@@->AMEYE-1)");
|
||||
|
||||
switch (action) {
|
||||
|
||||
case MEDTRANS_TRANSP_ASSIGNTRANSPORT:
|
||||
|
||||
if (load_db_record(x, "SELECT m.id AS member_id, a.agent_name,s.provider,s.quantity,"
|
||||
" TO_CHAR(s.service_date :: TIMESTAMP, 'Day Mon dd, yyyy HH:MI AM') AS long_date,"
|
||||
" a.street AS to_street,a.city AS to_city,a.state AS to_state,a.zipcode AS to_zipcode,a.phone AS to_phone,"
|
||||
" m.firstname,m.lastname,m.email AS member_email "
|
||||
" FROM members_service_request s "
|
||||
" LEFT JOIN agents a ON a.id=s.agent_id "
|
||||
" LEFT JOIN members m ON m.id=s.member_id "
|
||||
" WHERE s.id=%lu", in["service_id"].Long()) > 0) {
|
||||
vars2form(x, form);
|
||||
load_db_record(y, "SELECT email AS req_email,firstname AS cus_firstname,lastname AS cus_lastname ,phone as cus_phone FROM members WHERE id = %lu ", x["member_id"].Long());
|
||||
case MERMS_PROVIDERS_STARTPRACTICE:
|
||||
load_db_record(y, "SELECT * FROM practice_pending WHERE id = %lu ", in["practice_pending_id"].Long());
|
||||
vars2form(y, form);
|
||||
|
||||
|
||||
load_db_record(q, "SELECT street1 AS from_street, street2 AS from_street2, city AS from_city, zipcode AS from_zipcode , state AS from_state, country AS from_country "
|
||||
"FROM members_profile WHERE member_id =%lu", x["member_id"].Long());
|
||||
vars2form(q, form);
|
||||
|
||||
if (x["provider"] != "" && x["provider"].Long() > 0) {
|
||||
//
|
||||
load_db_record(z, "SELECT d.firstname AS driver_firstname,d.lastname AS driver_lastname,d.email AS driver_email FROM providers d WHERE d.id = %lu ", x["provider"].Long());
|
||||
vars2form(z, form);
|
||||
logfmt(logINFO, "@@@@@@->AMEYE-101)");
|
||||
form.LetStr("confirm_link", in["service_id"].c_str());
|
||||
logfmt(logINFO, "@@@@@@->AMEYE-102)");
|
||||
form.LetStr("server_link", "https://www.myFit by MERMS.co//provider/processRequest?reqId=");
|
||||
logfmt(logINFO, "@@@@@@->AMEYE-103)");
|
||||
form.LetStr("subject", "Laundry Pickup Assigned");
|
||||
form.LetStr("email", z["driver_email"].c_str());
|
||||
form.Email("PROVIDERS/pickup_assigned.mailfile");
|
||||
logfmt(logINFO, "@@@@@@->AMEYE-104)");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
form.LetStr("subject", "Welcome to MERMS");
|
||||
form.LetStr("email", y["email"].c_str());
|
||||
form.Email("PROVIDERS/start_practice.mailfile");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
General Header
|
||||
ChiefSoft Jan 2019
|
||||
ChiefSoft Jan 2020
|
||||
*/
|
||||
#include "clog.h"
|
||||
#include "cgi.h"
|
||||
@@ -21,6 +21,19 @@ Other Headers
|
||||
#include "function_members.h"
|
||||
#include "creditcards.h"
|
||||
|
||||
|
||||
#define MERMSEMR_BKO_START 100000
|
||||
#define MERMSEMR_BKO_LOGIN 100005
|
||||
#define MERMSEMR_BKO_CREATEUSER 100010
|
||||
#define MERMSEMR_BKO_EDITUSER 100011
|
||||
#define MERMSEMR_BKO_UPDATEMEMBER 100012
|
||||
#define MERMSEMR_BKO_ADDREASON 100020
|
||||
#define MERMSEMR_BKO_DELETEALLCARDS 100022
|
||||
#define MERMSEMR_BKO_ADDCARD 100028
|
||||
#define MERMSEMR_BKO_LANGUAGE_STATUS 100030
|
||||
|
||||
|
||||
|
||||
long backoffice_calls(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "backoffice_calls()");
|
||||
out["result"] = "YES I GET TO BACK END";
|
||||
@@ -31,18 +44,14 @@ long backoffice_calls(CVars in, CVars &out) {
|
||||
|
||||
switch (action) {
|
||||
|
||||
case MEDTRANS_BKO_LOGIN:
|
||||
case MERMSEMR_BKO_LOGIN:
|
||||
return LoginBkoAdmin(in, out);
|
||||
break;
|
||||
|
||||
case MEDTRANS_BKO_CREATEUSER:
|
||||
case MERMSEMR_BKO_CREATEUSER:
|
||||
return createBkoAdmin(in, out);
|
||||
break;
|
||||
|
||||
case MERMSEMR_ACCOUNT_PENDING:
|
||||
|
||||
break;
|
||||
|
||||
case MERMSEMR_BKO_DELETEALLCARDS:
|
||||
return DeletAallCards(in, out);
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
main entry point for API calls Chiefsoft July 2017 */
|
||||
main entry point for API calls Chiefsoft July 2020 */
|
||||
#include "mermsemr_api_main.h"
|
||||
#include "mermsemr_api.h"
|
||||
#include "clog.h"
|
||||
@@ -23,6 +23,12 @@ long mermsemr_api_main(CVars in, CVars &out) {
|
||||
//REQ_LONG( in, "pid", 0, -1); // global implementation - who is calling
|
||||
try {
|
||||
|
||||
if ( action == MERMS_TEST_EMAIL ){
|
||||
logfmt(logINFO, "long MERMSEMR_BKO_START(CVars in, CVars &out)-> JUST A TEST EMAIL *******************************************");
|
||||
return test_email_calls( action, in, out);
|
||||
|
||||
}
|
||||
|
||||
if (action >= MERMS_USER_START && action <= MERMS_USER_END) {
|
||||
return members_call(in, out);
|
||||
}
|
||||
@@ -31,7 +37,11 @@ long mermsemr_api_main(CVars in, CVars &out) {
|
||||
return providers_call(in, out);
|
||||
}
|
||||
|
||||
|
||||
if (action >= MERMSEMR_BKO_START && action <= MERMSEMR_BKO_END) {
|
||||
logfmt(logINFO, "long MERMSEMR_BKO_START(CVars in, CVars &out)*******************************************");
|
||||
return backoffice_calls(in, out);
|
||||
}
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long mermsemr_api_main(CVars in, CVars &out)");
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "providers.h"
|
||||
#include "function_members.h"
|
||||
#include "function_providers_charts.h"
|
||||
#include "medTEmails.h"
|
||||
|
||||
long provider_login(CVars in, CVars &out);
|
||||
long PracticeLogin(CVars in, CVars &out);
|
||||
@@ -23,6 +24,7 @@ long provider_createmember(CVars in, CVars &out);
|
||||
long provider_acceptmember(CVars in, CVars &out);
|
||||
long provider_linkIdemember(CVars in, CVars &out);
|
||||
void GenerateLongID(char * number, int sz, int seed);
|
||||
long provider_startNewPractice(CVars in, CVars &out);
|
||||
|
||||
long providers_call(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
@@ -34,21 +36,26 @@ long providers_call(CVars in, CVars &out) {
|
||||
switch (in["action"].Long()) {
|
||||
|
||||
case MERMS_PROVIDERS_LOGIN:
|
||||
return provider_login(in, out);
|
||||
return provider_login(in, out);
|
||||
break;
|
||||
|
||||
case MERMS_PROVIDERS_CREATEMEMBER:
|
||||
return provider_createmember(in, out);
|
||||
return provider_createmember(in, out);
|
||||
break;
|
||||
case MERMS_PROVIDERS_CREATECHART:
|
||||
// create chart from provider side now
|
||||
return provider_chart(in, out);
|
||||
|
||||
case MERMS_PROVIDERS_STARTPRACTICE:
|
||||
return provider_startNewPractice(in, out);
|
||||
break;
|
||||
|
||||
|
||||
case MERMS_PROVIDERS_CREATECHART:
|
||||
// create chart from provider side now
|
||||
return provider_chart(in, out);
|
||||
break;
|
||||
|
||||
case MERMS_PROVIDERS_LINKMEMBER:
|
||||
return provider_linkIdemember(in, out);
|
||||
return provider_linkIdemember(in, out);
|
||||
break;
|
||||
|
||||
|
||||
case EXISTING_CARD:
|
||||
REQ_LONG(in, "paymentid", 0, -1); // now we have to make sure the payment id is valid for this customer
|
||||
|
||||
@@ -73,22 +80,20 @@ long providers_call(CVars in, CVars &out) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
long provider_login(CVars in, CVars &out) {
|
||||
|
||||
long ret = -1;
|
||||
try{
|
||||
REQ_STRING(in, "username", 2, 49, "(.*)");
|
||||
REQ_STRING(in, "pass", 2, 49, "(.*)");
|
||||
try {
|
||||
REQ_STRING(in, "username", 2, 49, "(.*)");
|
||||
REQ_STRING(in, "pass", 2, 49, "(.*)");
|
||||
|
||||
|
||||
if ( load_db_record(out, "SELECT p.name AS practice_name,u.*,u.id AS user_id FROM practice_users u LEFT JOIN practice p ON p.id = u.practice_id WHERE u.id = 1 ") > 0 ){
|
||||
ret = PracticeLogin( in, out );
|
||||
}
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
|
||||
if (load_db_record(out, "SELECT p.name AS practice_name,u.*,u.id AS user_id FROM practice_users u LEFT JOIN practice p ON p.id = u.practice_id WHERE u.id = 1 ") > 0) {
|
||||
ret = PracticeLogin(in, out);
|
||||
}
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long provider_login(CVars in, CVars &out)");
|
||||
}
|
||||
return ret;
|
||||
@@ -150,124 +155,184 @@ long provider_linkIdemember(CVars in, CVars &out) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
long provider_createmember(CVars in, CVars &out){
|
||||
long provider_startNewPractice(CVars in, CVars &out) {
|
||||
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt(logINFO, "provider_startNewPractice()");
|
||||
|
||||
try {
|
||||
|
||||
// REQ_LONG(in, "practice_id", 0, -1);
|
||||
// REQ_LONG(in, "practice_user_id", 0, -1);
|
||||
REQ_STRING(in, "practice_name", 5, 49, "(.*)");
|
||||
REQ_STRING(in, "username", 5, 49, "(.*)");
|
||||
REQ_STRING(in, "firstname", 2, 49, "(.*)");
|
||||
REQ_STRING(in, "lastname", 2, 49, "(.*)");
|
||||
OPTIONAL(in, "phone") REQ_STRING(in, "phone", 5, 23, "(.*)");
|
||||
REQ_STRING(in, "password", 5, 49, "(.*)");
|
||||
|
||||
long member_id = 0;
|
||||
|
||||
//REQ_STRING (in, "sessionid", 4, 40, "(.*)");
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
out["member_id"] = "0";
|
||||
|
||||
ret = load_db_record(out, "SELECT *,id AS practice_pending_id FROM practice_pending WHERE LOWER(username)=LOWER('%s') ", in["username"].c_str());
|
||||
logfmt(logINFO, "provider_startNewPractice()practice_pending_id=%lu", out["practice_pending_id"].Long());
|
||||
if (out["practice_pending_id"].Long() == 0) {
|
||||
|
||||
// LETS CREATE THE ACOUNT NOW
|
||||
CVars x;
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
x["loc"] = loc;
|
||||
x["loc"].set_valid(true);
|
||||
x["username"] = in["username"];
|
||||
x["username"].set_valid(true);
|
||||
x["firstname"] = in["firstname"];
|
||||
x["firstname"].set_valid(true);
|
||||
x["lastname"] = in["lastname"];
|
||||
x["lastname"].set_valid(true);
|
||||
|
||||
x["email"] = in["email"];
|
||||
x["email"].set_valid(true);
|
||||
|
||||
x["practice_name"] = in["practice_name"];
|
||||
x["practice_name"].set_valid(true);
|
||||
|
||||
out["practice_pending_id"] = insert_db_record(DBS_VALID, "practice_pending", "practice_pending_id_seq", x);
|
||||
|
||||
if (out["practice_pending_id"].Long() > 0) {
|
||||
|
||||
// Now Send Email
|
||||
ret = PHP_API_OK;
|
||||
//make your patient
|
||||
provider_email_calls(MERMS_PROVIDERS_STARTPRACTICE, out, out);
|
||||
// ==============
|
||||
}
|
||||
} // if username
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL provider_startNewPractice");
|
||||
}
|
||||
logfmt(logINFO, "/provider_startNewPractice()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long provider_createmember(CVars in, CVars &out) {
|
||||
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt(logINFO, "Provider CreateMember()");
|
||||
|
||||
try {
|
||||
|
||||
REQ_LONG(in, "practice_id", 0, -1);
|
||||
REQ_LONG(in, "practice_user_id", 0, -1);
|
||||
REQ_STRING(in, "username", 5, 49, "(.*)");
|
||||
REQ_STRING(in, "firstname", 2, 49, "(.*)");
|
||||
REQ_STRING(in, "lastname", 2, 49, "(.*)");
|
||||
OPTIONAL(in, "phone") REQ_STRING(in, "phone", 5, 23, "(.*)");
|
||||
REQ_STRING(in, "password", 5, 49, "(.*)");
|
||||
OPTIONAL(in, "phone") REQ_STRING(in, "loc", 5, 16, "(.*)");
|
||||
OPTIONAL(in, "login") REQ_LONG(in, "login", 0, -1);
|
||||
REQ_LONG(in, "practice_id", 0, -1);
|
||||
REQ_LONG(in, "practice_user_id", 0, -1);
|
||||
REQ_STRING(in, "username", 5, 49, "(.*)");
|
||||
REQ_STRING(in, "firstname", 2, 49, "(.*)");
|
||||
REQ_STRING(in, "lastname", 2, 49, "(.*)");
|
||||
OPTIONAL(in, "phone") REQ_STRING(in, "phone", 5, 23, "(.*)");
|
||||
REQ_STRING(in, "password", 5, 49, "(.*)");
|
||||
OPTIONAL(in, "phone") REQ_STRING(in, "loc", 5, 16, "(.*)");
|
||||
OPTIONAL(in, "login") REQ_LONG(in, "login", 0, -1);
|
||||
|
||||
long member_id = 0;
|
||||
long member_id = 0;
|
||||
|
||||
//REQ_STRING (in, "sessionid", 4, 40, "(.*)");
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
out["member_id"]="0";
|
||||
|
||||
ret = load_db_record(out, "SELECT *,id AS member_id FROM members WHERE LOWER(username)=LOWER('%s') ", in["username"].c_str());
|
||||
logfmt(logINFO, "Provider CreateMember()member_id=%lu",out["member_id"].Long());
|
||||
if (out["member_id"].Long() == 0) {
|
||||
|
||||
// LETS CREATE THE ACOUNT NOW
|
||||
CVars x;
|
||||
//REQ_STRING (in, "sessionid", 4, 40, "(.*)");
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
x["loc"] = loc;
|
||||
x["loc"].set_valid(true);
|
||||
x["username"] = in["username"];
|
||||
x["username"].set_valid(true);
|
||||
x["firstname"] = in["firstname"];
|
||||
x["firstname"].set_valid(true);
|
||||
x["lastname"] = in["lastname"];
|
||||
x["lastname"].set_valid(true);
|
||||
x["phone"] = in["phone"];
|
||||
x["phone"].set_valid(true);
|
||||
// x["loc"] = in["loc"];
|
||||
// x["loc"].set_valid(true);
|
||||
x["email"] = in["email"];
|
||||
x["email"].set_valid(true);
|
||||
// x["password"] = in["email"];
|
||||
// x["password"].set_valid(true);
|
||||
out["member_id"] = insert_db_record(DBS_VALID, "members", "members_id_seq", x);
|
||||
|
||||
if (out["member_id"].Long() > 0) {
|
||||
pgsql_query("UPDATE members SET password = md5('%s') WHERE id = %lu", in["password"].c_str(), out["member_id"].Long()); // setting the password MD5 now
|
||||
// Now Send Email
|
||||
ret = PHP_API_OK;
|
||||
//make your patient
|
||||
CVars z;
|
||||
z["practice_id"] = in["practice_id"];
|
||||
z["practice_id"].set_valid(true);
|
||||
z["practice_user_id"] = in["practice_user_id"];
|
||||
z["practice_user_id"].set_valid(true);
|
||||
z["member_id"] = out["member_id"];
|
||||
z["member_id"].set_valid(true);
|
||||
provider_acceptmember(z, out);
|
||||
out["member_id"] = "0";
|
||||
|
||||
out["status"] = "OK";
|
||||
member_id = out["member_id"].Long();
|
||||
in["member_id"] = out["member_id"];
|
||||
in["member_id"].set_valid(true);
|
||||
medTrUpdateProfile(in, out);
|
||||
ret = load_db_record(out, "SELECT *,id AS member_id FROM members WHERE LOWER(username)=LOWER('%s') ", in["username"].c_str());
|
||||
logfmt(logINFO, "Provider CreateMember()member_id=%lu", out["member_id"].Long());
|
||||
if (out["member_id"].Long() == 0) {
|
||||
|
||||
// ==============
|
||||
}
|
||||
} // if username
|
||||
}catch (bad_parameter) {
|
||||
// LETS CREATE THE ACOUNT NOW
|
||||
CVars x;
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
x["loc"] = loc;
|
||||
x["loc"].set_valid(true);
|
||||
x["username"] = in["username"];
|
||||
x["username"].set_valid(true);
|
||||
x["firstname"] = in["firstname"];
|
||||
x["firstname"].set_valid(true);
|
||||
x["lastname"] = in["lastname"];
|
||||
x["lastname"].set_valid(true);
|
||||
x["phone"] = in["phone"];
|
||||
x["phone"].set_valid(true);
|
||||
// x["loc"] = in["loc"];
|
||||
// x["loc"].set_valid(true);
|
||||
x["email"] = in["email"];
|
||||
x["email"].set_valid(true);
|
||||
// x["password"] = in["email"];
|
||||
// x["password"].set_valid(true);
|
||||
out["member_id"] = insert_db_record(DBS_VALID, "members", "members_id_seq", x);
|
||||
|
||||
if (out["member_id"].Long() > 0) {
|
||||
pgsql_query("UPDATE members SET password = md5('%s') WHERE id = %lu", in["password"].c_str(), out["member_id"].Long()); // setting the password MD5 now
|
||||
// Now Send Email
|
||||
ret = PHP_API_OK;
|
||||
//make your patient
|
||||
CVars z;
|
||||
z["practice_id"] = in["practice_id"];
|
||||
z["practice_id"].set_valid(true);
|
||||
z["practice_user_id"] = in["practice_user_id"];
|
||||
z["practice_user_id"].set_valid(true);
|
||||
z["member_id"] = out["member_id"];
|
||||
z["member_id"].set_valid(true);
|
||||
provider_acceptmember(z, out);
|
||||
|
||||
out["status"] = "OK";
|
||||
member_id = out["member_id"].Long();
|
||||
in["member_id"] = out["member_id"];
|
||||
in["member_id"].set_valid(true);
|
||||
medTrUpdateProfile(in, out);
|
||||
|
||||
// ==============
|
||||
}
|
||||
} // if username
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL Provider CreateMember");
|
||||
}
|
||||
logfmt(logINFO, "/Provider CreateMember()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long provider_acceptmember(CVars in, CVars &out){
|
||||
long provider_acceptmember(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
logfmt(logINFO, "provider_acceptmember()");
|
||||
char vname[15];
|
||||
try{
|
||||
|
||||
REQ_LONG(in, "practice_id", 0, -1);
|
||||
REQ_LONG(in, "practice_user_id", 0, -1);
|
||||
REQ_LONG(in, "member_id", 0, -1);
|
||||
|
||||
GenerateLongID(vname, sizeof (vname), 10);
|
||||
//snprintf(vname, sizeof (vname), "ME%05d", i);
|
||||
char vname[15];
|
||||
try {
|
||||
|
||||
REQ_LONG(in, "practice_id", 0, -1);
|
||||
REQ_LONG(in, "practice_user_id", 0, -1);
|
||||
REQ_LONG(in, "member_id", 0, -1);
|
||||
|
||||
GenerateLongID(vname, sizeof (vname), 10);
|
||||
//snprintf(vname, sizeof (vname), "ME%05d", i);
|
||||
out["long_id"] = vname;
|
||||
|
||||
|
||||
|
||||
CVars x;
|
||||
x["practice_id"] = in["practice_id"];
|
||||
x["practice_id"].set_valid(true);
|
||||
x["practice_user_id"] = in["practice_user_id"];
|
||||
x["practice_user_id"].set_valid(true);
|
||||
x["member_id"] = in["member_id"];
|
||||
x["member_id"].set_valid(true);
|
||||
|
||||
|
||||
|
||||
|
||||
CVars x;
|
||||
x["practice_id"] = in["practice_id"];
|
||||
x["practice_id"].set_valid(true);
|
||||
x["practice_user_id"] = in["practice_user_id"];
|
||||
x["practice_user_id"].set_valid(true);
|
||||
x["member_id"] = in["member_id"];
|
||||
x["member_id"].set_valid(true);
|
||||
|
||||
x["long_id"] = vname;
|
||||
x["long_id"].set_valid(true);
|
||||
x["long_id"].set_valid(true);
|
||||
out["patient_id"] = insert_db_record(DBS_VALID, "patients", "patients_id_seq", x);
|
||||
|
||||
|
||||
|
||||
}catch (bad_parameter) {
|
||||
|
||||
|
||||
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL Provider CreateMember");
|
||||
}
|
||||
logfmt(logINFO, "/provider_acceptmember()");
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void GenerateLongID(char * number, int sz, int seed) {
|
||||
char chars[] = "WRB01234WRB56789WRB";
|
||||
int n = sizeof (chars);
|
||||
@@ -291,9 +356,10 @@ void GenerateLongID(char * number, int sz, int seed) {
|
||||
}
|
||||
number[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//XXX
|
||||
|
||||
long PracticeLogin(CVars in, CVars &out) {
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
@@ -307,7 +373,7 @@ long PracticeLogin(CVars in, CVars &out) {
|
||||
// remove all existing session
|
||||
pgsql_exec("DELETE FROM practice_users_session WHERE practice_users_id=%ld ", out["practice_users_id"].Long());
|
||||
// Create New Session Now
|
||||
if (PracticeSessionCheck(out["practice_id"].Long(), out["practice_users_id"].Long(),out["sessionid"].c_str(), 1) > 0) {
|
||||
if (PracticeSessionCheck(out["practice_id"].Long(), out["practice_users_id"].Long(), out["sessionid"].c_str(), 1) > 0) {
|
||||
|
||||
out["stauts"] = "OK";
|
||||
/*LOAD THE SESSION INTO OUT now */
|
||||
@@ -331,7 +397,6 @@ long PracticeLogin(CVars in, CVars &out) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long PracticeSessionCheck(long practice_id, long practice_users_id, const char *sessionid, int create) {
|
||||
logfmt(logINFO, "long PracticeSessionCheck(long uid, const char *sessionid, int create )");
|
||||
// Sanity check
|
||||
@@ -367,7 +432,7 @@ long PracticeSessionCheck(long practice_id, long practice_users_id, const char *
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (create > 0) {
|
||||
// Check session i?
|
||||
@@ -384,7 +449,7 @@ long PracticeSessionCheck(long practice_id, long practice_users_id, const char *
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
sess["loc"] = loc;
|
||||
sess["loc"].set_valid(true);
|
||||
sess["practice_id"] = practice_id;
|
||||
sess["practice_id"] = practice_id;
|
||||
sess["practice_id"].set_valid(true);
|
||||
sess["practice_user_id"] = practice_users_id;
|
||||
sess["practice_user_id"].set_valid(true);
|
||||
|
||||
Reference in New Issue
Block a user