country list

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-22 16:29:37 -04:00
parent d5cb848644
commit c563cbe210
3 changed files with 128 additions and 11 deletions
+105 -1
View File
@@ -81,7 +81,7 @@ long getUserRecipientCombo( CVars in, CVars &out ){
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT b.id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient, b.account_no,b.country "
res = pgsql_query("SELECT b.id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient, b.account_no,b.country,b.added "
"FROM sendmoney_recipient b "
"LEFT JOIN bank_entity_codes k ON k.code=b.bank_code "
"WHERE b.member_id = %lu AND b.status=1",member_id);
@@ -109,6 +109,9 @@ long getUserRecipientCombo( CVars in, CVars &out ){
snprintf(vname, sizeof (vname), "country_%05d", i);
out[vname] = rec["country"];
snprintf(vname, sizeof (vname), "added_%05d", i);
out[vname] = rec["added"];
}
}
ret = PHP_API_OK;
@@ -165,7 +168,58 @@ long getCountryCombo( CVars in, CVars &out ) {
->get('country');
$option_value = $this->optionValueObject($q->result(), "code", "country", $curVal);
id| code |country| phone_code |allow| status |created|updated|jobs
*/
char vname[30];
long ret = PHP_API_BAD_PARAM;
logfmt( logINFO, "getCountryCombo()" );
out["result"] = "Yes i go to this back end";
try {
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT * "
"FROM country "
"WHERE status = 1 ORDER BY country ASC");
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);
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);
snprintf(vname, sizeof (vname), "id_%05d", i);
out[vname] = rec["id"];
snprintf(vname, sizeof (vname), "code_%05d", i);
out[vname] = rec["code"];
snprintf(vname, sizeof (vname), "country_%05d", i);
out[vname] = rec["country"];
snprintf(vname, sizeof (vname), "phone_code_%05d", i);
out[vname] = rec["phone_code"];
snprintf(vname, sizeof (vname), "account_no_%05d", i);
out[vname] = rec["account_no"];
snprintf(vname, sizeof (vname), "created_%05d", i);
out[vname] = rec["created"];
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long getCountryCombo(CVars in, CVars &out)");
}
logfmt( logINFO, "/getCountryCombo()" );
return ret;
return 0;
}
@@ -179,6 +233,56 @@ long getCountryJobCombo( CVars in, CVars &out ) {
$option_value = $this->optionValueObject($q->result(), "code", "country", $curVal);
*/
char vname[30];
long ret = PHP_API_BAD_PARAM;
logfmt( logINFO, "getCountryJobCombo()" );
out["result"] = "Yes i go to this back end";
try {
out["total_record"] = "0";
const PGresult *res;
res = pgsql_query("SELECT * "
"FROM country "
"WHERE jobs IS NOT NULL ORDER BY country ASC");
if (res != NULL && pgsql_num_rows(res) > 0) {
out["total_record"] = pgsql_num_rows(res);
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);
snprintf(vname, sizeof (vname), "id_%05d", i);
out[vname] = rec["id"];
snprintf(vname, sizeof (vname), "code_%05d", i);
out[vname] = rec["code"];
snprintf(vname, sizeof (vname), "country_%05d", i);
out[vname] = rec["country"];
snprintf(vname, sizeof (vname), "phone_code_%05d", i);
out[vname] = rec["phone_code"];
snprintf(vname, sizeof (vname), "account_no_%05d", i);
out[vname] = rec["account_no"];
snprintf(vname, sizeof (vname), "created_%05d", i);
out[vname] = rec["created"];
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long getCountryCombo(CVars in, CVars &out)");
}
logfmt( logINFO, "/getCountryJobCombo()" );
return ret;
return 0;
return 0;
}