Country banks
This commit is contained in:
@@ -282,8 +282,6 @@ long getCountryJobCombo( CVars in, CVars &out ) {
|
||||
|
||||
logfmt( logINFO, "/getCountryJobCombo()" );
|
||||
return ret;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long getBankCombo( CVars in, CVars &out ) {
|
||||
@@ -307,5 +305,40 @@ long getBankCombo( CVars in, CVars &out ) {
|
||||
|
||||
$option_value = $this->optionValueObject($q->result(), "code", "name", $curVal);
|
||||
*/
|
||||
return 0;
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
logfmt( logINFO, "getBankCombo()" );
|
||||
out["result"] = "Yes i go to this back end";
|
||||
|
||||
try {
|
||||
REQ_STRING(in, "country", 2, 25, "(.*)");
|
||||
out["total_record"] = "0";
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT code,name "
|
||||
"FROM bank_entity_codes "
|
||||
"WHERE country ='%s' ORDER BY name ASC",in['country'].c_str());
|
||||
|
||||
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), "code_%05d", i);
|
||||
out[vname] = rec["code"];
|
||||
|
||||
}
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long getBankCombo(CVars in, CVars &out)");
|
||||
}
|
||||
|
||||
logfmt( logINFO, "/getBankCombo()" );
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user