$user['firstName'], 'lastName' => $user['lastName'], 'address' => $company['address'], 'address2' => $company['address2'], 'city' => $company['city'], 'state' => $company['state'], 'zip' => $company['zip'], 'email' => $user['email'], 'phone' => $user['directPhone'], ]; return $address; } public static function filterAddress(array &$address) { $fields = ['address', 'address2', 'city', 'state', 'zip']; $address = array_intersect_key($address, array_fill_keys($fields, '')); } public static function getLists() { if (null === self::$_lists) { self::$_lists = (new Qs_Db_Table('List'))->get4Select(); } return self::$_lists; } public static function getLoggedUserCompanyTaxExempt() { $auth = Auth::getInstance(); if (!$auth->isLoggedIn()) { return false; } $select = Qs_Db::getSelect(); $select->from(Qs_Db::getPair('User', 'u'), []); $select->join(Qs_Db::getPair('Company', 'c'), 'c.id = u.companyId', ['taxExempt']); $select->where('u.id = ?', $auth->getData('id'), Qs_Db::INT_TYPE); $select->limit(1); return 'y' === Qs_Db::getInstance()->fetchOne($select); } public static function getCompanyAddress($companyId, $addressType, $default = null) { if (null === $companyId) { return $default; } $fields = ['address', 'address2', 'city', 'state', 'zip']; $columns = []; foreach ($fields as $field) { $columns[$field] = $addressType . ucfirst($field); } $select = Qs_Db::getSelect()->from(Qs_Db::getPair('Company'), $columns); $select->where('`id` = ?', (int) $companyId, Qs_Db::INT_TYPE); $select->limit(1); $address = Qs_Db::getInstance()->fetchRow($select); return empty($address) ? $default : $address; } }