protected duplicate
This commit is contained in:
@@ -120,6 +120,8 @@ long WrenchPromoAddList(CVars in, CVars &out){
|
||||
logfmt(logINFO, "WrenchPromoAdminLogin()");
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
CVars outX;
|
||||
|
||||
CVars x;
|
||||
|
||||
try {
|
||||
@@ -133,13 +135,24 @@ logfmt(logINFO, "WrenchPromoAdminLogin()");
|
||||
ret = load_db_record( out, "SELECT *,id AS promo_admin_id FROM promo_admin WHERE status=1 AND id=%lu AND uid::text='%s'", admin_id, in["admin_uid"].c_str() );
|
||||
if (ret && out["promo_admin_id"].Long() > 0) {
|
||||
|
||||
x["admin_id"] = admin_id; x["admin_id"].set_valid(true);
|
||||
x["email"] = in["email"]; x["email"].set_valid(true);
|
||||
x["firstname"] = in["firstname"]; x["firstname"].set_valid(true);
|
||||
x["lastname"] = in["lastname"]; x["lastname"].set_valid(true);
|
||||
long retF = load_db_record( outX, "SELECT *,id AS promo_admin_id "
|
||||
"FROM promo_member WHERE (email)=LOWER('%s') AND admin_id= %lu", in["email"].c_str(), admin_id );
|
||||
if (retF && outX["promo_admin_id"].Long() > 0) {
|
||||
out["status_message"] = "Error Duplicate Found";
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
return 0;
|
||||
}
|
||||
|
||||
x["loc"] = in["loc"]; x["loc"].set_valid(true);
|
||||
long sid = insert_db_record(DBS_VALID, "promo_member", "promo_member_id_seq", x);
|
||||
x["admin_id"] = admin_id; x["admin_id"].set_valid(true);
|
||||
x["email"] = in["email"]; x["email"].set_valid(true);
|
||||
x["firstname"] = in["firstname"]; x["firstname"].set_valid(true);
|
||||
x["lastname"] = in["lastname"]; x["lastname"].set_valid(true);
|
||||
x["loc"] = in["loc"]; x["loc"].set_valid(true);
|
||||
long sid = insert_db_record(DBS_VALID, "promo_member", "promo_member_id_seq", x);
|
||||
if (sid > 0 ){
|
||||
out["status_message"] = "New Entry Added";
|
||||
}
|
||||
|
||||
|
||||
// there will be promo action
|
||||
|
||||
Reference in New Issue
Block a user