selection data

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-22 13:27:25 -04:00
parent 5f355713c0
commit a0f75d63b0
5 changed files with 257 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
#ifndef __mx_sel_data_h__
#define __mx_sel_data_h__
#include "vars.h"
long getJobPriceCombo( CVars in, CVars &out );
long getJobPostDuration( CVars in, CVars &out );
long getUserRecipientCombo( CVars in, CVars &out );
long getAccountTypeCombo( CVars in, CVars &out );
long getGeneralSkillCombo( CVars in, CVars &out );
long getUserNewSkillCombo( CVars in, CVars &out );
long getCountryCombo( CVars in, CVars &out );
long getCountryJobCombo( CVars in, CVars &out );
long getBankCombo( CVars in, CVars &out );
#endif
@@ -197,6 +197,13 @@ enum { PARTNER_STRIPE };
#define WRENCHBOARD_ACCOUNT_COMPLETE_TOPUP 11063
#define WRENCHBOARD_ACCOUNT_PRICE_COMBO 11171
#define WRENCHBOARD_ACCOUNT_JOBPOST_DURATION 11173
#define WRENCHBOARD_ACCOUNT_USER_RECIPEINT 11175
#define WRENCHBOARD_ACCOUNT_ACCOUNT_TYPES 11177
#define WRENCHBOARD_ACCOUNT_COUNTRY_COMBO 11179
#define WRENCHBOARD_ACCOUNT_JOB_COUNTRY 11181
#define WRENCHBOARD_USER_DELETEACC 11990
#define WRENCHBOARD_ACCOUNT_END 11999
+26
View File
@@ -16,6 +16,8 @@
#include "creditcards.h"
#include "payments.h"
#include "sel_data.h"
#include "jobs.h"
#define CREATE_BY_EMAIL 1000
@@ -400,6 +402,30 @@ long account_calls(CVars in, CVars &out) {
*/
break;
case WRENCHBOARD_ACCOUNT_PRICE_COMBO:
return getJobPriceCombo(in, out);
break;
case WRENCHBOARD_ACCOUNT_JOBPOST_DURATION:
return getJobPostDuration(in, out);
break;
case WRENCHBOARD_ACCOUNT_USER_RECIPEINT:
return getUserRecipientCombo(in, out);
break;
case WRENCHBOARD_ACCOUNT_ACCOUNT_TYPES:
return getAccountTypeCombo(in, out);
break;
case WRENCHBOARD_ACCOUNT_COUNTRY_COMBO:
return getCountryCombo(in, out);
break;
case WRENCHBOARD_ACCOUNT_JOB_COUNTRY:
return getCountryJobCombo(in, out);
break;
}
logfmt(logINFO, "/account_calls()");
return ret;
+1 -1
View File
@@ -1,5 +1,5 @@
// Account management toosl
// History Listing
#include "clog.h"
#include "cgi.h"
#include "input.h"
+207
View File
@@ -0,0 +1,207 @@
// Combo Data
#include "clog.h"
#include "cgi.h"
#include "input.h"
#include "wrenchboard_api.h"
#include "sel_data.h"
#include "email.h"
#include "payments.h"
#include "safestring.h"
#include <string>
#include "pgsql.h"
#include "pgsql_wrapper.h"
#include "cfg.h"
#include <curl/curl.h>
public function getJobPriceCombo( CVars in, CVars &out )
{
/* $this->defaultComboMessage ='Select Price...';
$cmbstr ="<option value='0'>". $this->defaultComboMessage ."</option>";
for ($i = 2000; $i <= 10000; $i = $i + 1000) {
// $amountArray[] = [$i,$i,'Naira'];
$selV = '';
if ($curVal == $i) {
$selV = " selected ";
}
$cmbstr .= "<option value='".$i."' ".$selV.">".$i." ".$description."</option>";
}
*/
return 0;
}
long getJobPostDuration( CVars in, CVars &out )
{
/*
$this->defaultComboMessage ='Select duration of post';
$cmbstr ="";
for ($ii = 2; $ii <= 10; $ii++) {
$cmbstr .= "<option value='$ii'>$ii day(s)</option>";
}
for ($ii = 2; $ii <= 5; $ii++) {
$days_c = $ii*7;
$cmbstr .= "<option value='$days_c'>$ii Weeks</option>";
}
*/
return 0;
}
long getUserJobGroupCombo( CVars in, CVars &out )
{
/*
// $sql = "SELECT id,group_name FROM members_job_group WHERE member_id = $member_id AND status = 1 ORDER BY group_name ASC ";
$sql = "SELECT m.id,m.group_name, m.group_name||' ['||count(g.group_id)||' members]' AS member_group_count "
. "FROM members_job_group m "
. "LEFT JOIN members_job_groupmember g ON g.group_id = m.id "
. "WHERE m.member_id = $member_id "
. "AND m.status = 1 GROUP BY m.id,m.group_name ORDER BY m.group_name ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "member_group_count", $curVal);
*/
return 0;
}
long getUserRecipientCombo( CVars in, CVars &out ){
char vname[30];
long ret = PHP_API_BAD_PARAM;
logfmt( logINFO, "getUserRecipientCombo()" );
out["result"] = "Yes i go to this back end";
try {
long member_id = REQ_LONG( in, "member_id", 1, -1 );
long limit = REQ_LONG( in, "limit", 1, -1 );
REQ_LONG( in, "page", 1, -1 );
REQ_STRING (in, "uid", 10, 100, "(.*)");
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 "
"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);
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), "recipient_%05d", i);
out[vname] = rec["recipient"];
snprintf(vname, sizeof (vname), "id_%05d", i);
out[vname] = rec["id"];
snprintf(vname, sizeof (vname), "uid_%05d", i);
out[vname] = rec["uid"];
snprintf(vname, sizeof (vname), "account_no_%05d", i);
out[vname] = rec["account_no"];
snprintf(vname, sizeof (vname), "country_%05d", i);
out[vname] = rec["country"];
}
}
ret = PHP_API_OK;
out["status"] = "OK";
} catch (bad_parameter) {
logfmt(logINFO, "ERROR CALL long getUserRecipientCombo(CVars in, CVars &out)");
}
logfmt( logINFO, "/getUserRecipientCombo()" );
return ret;
}
long getAccountTypeCombo( CVars in, CVars &out ) {
/* $q = $this
->db
->where('status', 1)
->order_by('type_name', 'ASC')
->get('account_types');
$option_value = $this->optionValueObject($q->result(), "type_value", "type_name", $curVal);
*/
return 0;
}
long getGeneralSkillCombo( CVars in, CVars &out ) {
/* $this->showDefaultSelect = false;
$q = $this
->db
->where('status', 1)
->order_by('lorder', 'DESC')
->get('skill_category');
$option_value = $this->optionValueObject($q->result(), "id", "category", $curVal);
*/
return 0;
}
long getUserNewSkillCombo( CVars in, CVars &out ) {
/* $q = $this
->db
->where('status', 1)
->where('category_id', $category_id)
->order_by('lorder', 'DESC')
->get('skill_types');
$option_value = $this->optionValueObject($q->result(), "id", "skill", $curVal);
*/
return 0;
}
long getCountryCombo( CVars in, CVars &out ) {
/* $q = $this
->db
->where('status', 1)
->order_by('country', 'ASC')
->get('country');
$option_value = $this->optionValueObject($q->result(), "code", "country", $curVal);
*/
return 0;
}
long getCountryJobCombo( CVars in, CVars &out ) {
/* $q = $this
->db
->where('status', 1)
->where('jobs is NOT NULL', NULL, FALSE)
->order_by('country', 'ASC')
->get('country');
$option_value = $this->optionValueObject($q->result(), "code", "country", $curVal);
*/
return 0;
}
long getBankCombo( CVars in, CVars &out ) {
/*
wrenchboard=> Select code,name from bank_entity_codes WHERE country ='NG' ORDER BY name ASC;
code | name
------+------------------------------------------------
044 | Access Bank
014 | Afri Bank
023 | Citi Bank
063 | Diamond Bank
050 | Ecobank
040 | Equitorial Trust Bank
*/
/* $q = $this
->db
->where('status', 1)
->order_by('name', 'ASC')
->get('bank_entity_codes');
$option_value = $this->optionValueObject($q->result(), "code", "name", $curVal);
*/
return 0;
}