family count

This commit is contained in:
CHIEFSOFT\ameye
2023-11-11 10:07:01 -05:00
parent 16514b960f
commit 8ad44b2781
2 changed files with 19 additions and 5 deletions
+13
View File
@@ -519,6 +519,8 @@ CREATE TABLE members_myfiles (
long WrenchGetRecentDash(CVars in, CVars &out) {
long WrenchJobCount(long member_id);
long WrenchFamilyCount(long member_id);
logfmt(logINFO, "WrenchGetRecentDash()");
char vname[30];
@@ -2198,6 +2200,15 @@ long WrenchJobCount(long member_id){
return active_job_count;
}
long WrenchFamilyCount(long member_id){
CVars out;
long active_family_count = 0 ;
if ( load_db_record(out, "SELECT count(id) AS active_job_count FROM members_family WHERE member_id=%lu AND status = 1",member_id)> 0 ){
active_family_count = out["active_job_count"].Long();
}
return active_family_count;
}
long LoginWrenchBoardAccount(CVars in, CVars &out) {
long ret = PHP_API_BAD_PARAM;
@@ -2247,6 +2258,7 @@ long LoginWrenchBoardAccount(CVars in, CVars &out) {
out["profile_pic_url"] = "https://www.wrenchboard.com/assets/images/profile.jpg";
out["password"] = "";
out["active_job_count"] = WrenchJobCount( out["member_id"].Long() );
out["active_family_count"] = WrenchFamilyCount( out["member_id"].Long() );
LoginLogger(out["member_id"].Long(),login_mode);
} else {
out["status"] = "Session check failed";
@@ -2395,6 +2407,7 @@ long LoginWrenchBoardExternal(CVars in, CVars &out) {
account_email(ACCOUNT_LOGIN_ALERT, out, out); // ALERT CUSTOMER OF LOGIN
out["profile_pic_url"] = "https://www.wrenchboard.com/assets/images/profile.jpg";
out["active_job_count"] = WrenchJobCount( out["member_id"].Long() );
out["active_family_count"] = WrenchFamilyCount( out["member_id"].Long() );
res = PHP_LOGIN_OK;
} else {
out["status"] = "Session check failed";