/** * * @name get_officeserviceareas * @param integer $accountid * @param integer $officelocationid * @return boolean|array */ function get_officeserviceareas ($accountid,$officelocationid){ if (!$accountid || !$officelocationid) return false; $serviceareas = db_query("select serviceareaid,officelocationid,state,county,city from tblservicearea where officelocationid in (select officelocationid from tblofficelocation where accountid = ".db_number($accountid)." and officelocationid=".db_number($officelocationid).")"); if (is_array($serviceareas) && !empty($serviceareas)) $serviceareas[states] = db_query ("select code as id, name as value from tblstate order by id asc"); else return false; // No service areas found return $serviceareas; } /** * @name get_staffinoffice * @param number $accountid * @param integer $officelocationid * @return boolean|unknown */ function get_staffinoffice($accountid=0,$officelocationid){ if (!$officelocationid) return false; if (!$accountid && !accountid()) redirect ("/"); if (!$accountid) $accountid = accountid(); $staffinoffice = db_query ("select accountstaffid from tblaccountstaff where accountid=".db_number($accountid)." and officelocationid=".$officelocationid); if (is_array($staffinoffice) && !empty($staffinoffice)) return $staffinoffice; else return false; } /** * @name get_officelocations * @param integer $accountid * @param integer $officelocationid * @return array|boolean */ function get_officelocations ($accountid=0,$officelocationid=0){ if (!$accountid && !accountid()) redirect ("/"); if (!$accountid) $accountid = accountid(); $osql = "select * from tblofficelocation where accountid=".db_number(accountid()); if (db_number($officelocationid)) $osql .= " and officelocationid =".db_number($officelocationid)." and officelocationinactive is null"; // Specific office check always check for active else $osql .=" order by officelocationid"; $officelocations = db_query ($osql); //d($officelocations); if ((is_array($officelocations) && !empty($officelocations)) && !$officelocationid) return $officelocations; else if ($officelocationid && (is_array($officelocations) && !empty($officelocations))) return $officelocations[0][officelocationid]; else return false; } /** * @name get_availableoffices * @param integer $accountid * @return boolean | integer */ function get_availableoffices($accountid=0){ if (!db_number($accountid)) return false; return db_firstval("select accountallowedofficelocations from tblaccount where accountid =".db_number($accountid)); } function get_availablevendorprofiles($accountid=0){ if (!db_number($accountid)) return false; $allowedofficelocations = get_availableoffices(accountid()); $allowedstaffcount = db_firstval("select accountallowedstaffcount from tblaccount where accountid = ".accountid()); // we take one of of the total here to find out how many ADDITIONAL staff we get if(!$allowedstaffcount) $allowedstaffcount = 1; //in case this table has not been initialized, just start with one. $allowedstaffcount-=1; //subtract one since we always end up having one more in this table $allowedvendorprofiles = $allowedofficelocations+$allowedstaffcount; return $allowedvendorprofiles ; } /** * @get_usedoffices * @param integer $accountid * @return boolean|integer */ function get_usedoffices($accountid=0){ if (!db_number($accountid)) return false; return db_firstval("select count(1) from tblofficelocation where accountid=".db_number($accountid)." and officelocationinactive is null"); } /** * @name get_accountstaffcount * @param integer $accountid * @param number $all * @param number $profileonly * @return boolean|integer */ function get_accountstaffcount($accountid,$all=0,$profileonly=0){ if (!db_number($accountid)) return false; $sql ="select count(1) from tblaccountstaff "; if (!$all) $sql .= " join (select logininactive, accountstaffid from tbllogin ) as tbllogin using (accountstaffid)"; $sql .="where accountid=".db_number($accountid); if ($profileonly) $sql .=" and accountstaffdisplayvendorprofile = 1 "; if (!$all) $sql .=" and logininactive is null"; return db_firstval($sql); } function account_hasparent($accountid) { if(!$accountid) ddie("Invalid call to account_hasparent"); $account = get_accountcompany($accountid); return db_number($account[accountparentaccountid]); } function accountinvite_send($accountinviteid) { /* any call to this function with an invalid stafflicentinviteid is considered a violation */ if( !is_numeric($accountinviteid)) ddie("Invalid developer configuration issue accountinvite_send($accountinviteid) -accountinviteid not set"); $arr = db_first("select * from tblaccountinvite where accountinviteid = ".db_number($accountinviteid));//" and accountid = ".accountid()); if( !$arr) //lets die if they got in here incorrectly ddie("Invalid developer configuration accountinvite_send($accountinviteid) was called on an invalid record "); $accountarr = get_accountcompany(accountid()); $email = $arr[accountinviteemail]; if(!is_email($email)) { d("Invalid email found in accountemail ($email)",$arr); dlog(accountinvite_send,"Invalid email found in accountemail ($email), $accountinviteid"); d(backtrace,debug_backtrace()); return; } d(email,$email); d(accountinviteid,$accountinviteid); $ln = get_verificationvar($email,$accountinviteid); $proto="https"; if($_SERVER[SERVER_PORT]==80) $proto="http"; $rndlink = "$proto://$_SERVER[HTTP_HOST]/".replacelinkwithpermalink("manage_externaluser_verify.php?signup=-1&inviteid=$accountinviteid&verify=".urlencode($ln)); $eml = get_email('subaccountinvitation'); if(!$eml) ddie("DEV, CONFIGURE, need to make sure this email exists"); $subject = $eml[emailsubject]; $body = $eml[emailtext]; $invitingcompany = ""; $invitingstaffname = ""; if(clientcompanyid()) { $sql = "select clientcompanyname from tblclientcompany where clientcompanyid = " . clientcompanyid(); $qry = db_firstval($sql); if($qry) $invitingcompany = $qry; if(clientstaffid()) { $sql = "select clientstafffname, clientstafflname from tblclientstaff where clientstaffid = " . clientstaffid(); $qry = db_first($sql); if($qry) $invitingstaffname = $qry[clientstafffname] . ' ' . $qry[clientstafflname]; } } if(!$invitingcompany) $invitingcompany = $accountarr[accountname]; if(!$invitingstaffname) $invitingstaffname = get_login_info(loginid()); $body = email_replace_var($body,"invitingcompany",$invitingcompany); $body = email_replace_var($body,"invitingstaffname",$invitingstaffname); $body = email_replace_var($body,"clickherelink",$rndlink); $subject = email_replace_var($subject,"invitingstaffname",$invitingstaffname); $subject = email_replace_var($subject,"invitingcompany",$invitingcompany); html_mail_cc($email,$eml[emailcc],$eml[emailfrom],$subject,$body); $sql = "update tblaccountinvite set accountinvitesentdate = now() ,accountinvitesentby = ".loginid()." where accountinviteid = $accountinviteid "; d($sql); db_exec($sql,1); } function get_accountofficestaffdisplay($canedit = false, $officelocationid = 0) { $aolid = $_SESSION[login][accountofficelocationid]; $selector = " , loginid , officelocationname , accountstaffid , accountstafflname || ', ' || accountstafffname as name , tblofficelocation.officelocationid , accountstaffemail , accountstafftitle , accountstaffdisplayvendorprofile"; $staffsql = " select tblaccountstaff.officelocationid as asolid{$selector} from tblofficelocation left join tblaccountstaff using (officelocationid) join (select loginid,accountstaffid from tbllogin where accountid=".db_number(accountid()).") as tbllogin using (accountstaffid) where tblofficelocation.accountid =".db_number(accountid()); if ($officelocationid > 0) $staffsql .= " and tblofficelocation.officelocationid = ".db_number($officelocationid); $staffarr = db_query($staffsql); //d(htmlpre($staffsql),$staffarr); if (!$staffarr) return; foreach ($staffarr as $key=>$val) $offices[$val[officelocationid]]=$val[officelocationname]; //d('offices', $offices); foreach ($offices as $id=>$name) { global $alternate_class_counter; $alternate_class_counter=""; ?>
echo $name.($id ==$aolid?" HQ":""); ?> |
|||||
| } ?> | Photo | Name | Title | if(!has_customization("corporateaccount")) { ?>Vendor Profile | } ?>|
|---|---|---|---|---|---|
|
|
} ?>
if (file_exists($_SERVER[DOCUMENT_ROOT]."/loginprofileimages/".$staff[loginid].".jpg"))
echo " ![]() | ";
else {
echo 'echo ucwords($staff[name])?> | if(!has_customization("corporateaccount")) { ?> | Fatal error: Uncaught Error: Call to undefined function yesno() in /data/webs/rio_api_dev/_inc/functions_account.php:290 Stack trace: #0 {main} thrown in /data/webs/rio_api_dev/_inc/functions_account.php on line 290 |