Example #1
0
    /**
     * Returns VoIP account data
     * 
     * @param int $id VoIP account id
     * @return array|false VoIP account data on success, false on failure
     */
    public function getVoipAccount($id)
    {
        $result = $this->db->GetRow('
            SELECT v.id, ownerid, login, passwd, phone, creationdate, moddate, creatorid, modid, access,
		location, location_city, location_street, location_house, location_flat,
		lb.name AS borough_name, ld.name AS district_name, ls.name AS state_name
		FROM voipaccounts v
		LEFT JOIN location_cities lc ON lc.id = v.location_city
		LEFT JOIN location_boroughs lb ON lb.id = lc.boroughid
		LEFT JOIN location_districts ld ON ld.id = lb.districtid
		LEFT JOIN location_states ls ON ls.id = ld.stateid
            WHERE v.id = ?', array($id));
        if ($result) {
            $customer_manager = new LMSCustomerManager($this->db, $this->auth, $this->cache, $this->syslog);
            $user_manager = new LMSUserManager($this->db, $this->auth, $this->cache, $this->syslog);
            $result['createdby'] = $user_manager->getUserName($result['creatorid']);
            $result['modifiedby'] = $user_manager->getUserName($result['modid']);
            $result['creationdateh'] = date('Y/m/d, H:i', $result['creationdate']);
            $result['moddateh'] = date('Y/m/d, H:i', $result['moddate']);
            $result['owner'] = $customer_manager->getCustomerName($result['ownerid']);
            return $result;
        } else {
            return FALSE;
        }
    }
Example #2
0
    /**
     * Returns VoIP account data
     *
     * @param int $id VoIP account id
     * @return array|false VoIP account data on success, false on failure
     */
    public function getVoipAccount($id)
    {
        $result = $this->db->GetRow('
            SELECT v.id, ownerid, login, passwd, creationdate, moddate, creatorid, modid, access, balance,
                location, location_city, location_street, location_house, location_flat,
                lb.name AS borough_name, ld.name AS district_name, lst.name AS state_name,
				lc.name AS city_name,
				(CASE WHEN ls.name2 IS NOT NULL THEN ' . $this->db->Concat('ls.name2', "' '", 'ls.name') . ' ELSE ls.name END) AS street_name,
				lt.name AS street_type,
                v.flags, v.balance, v.cost_limit
            FROM voipaccounts v
                LEFT JOIN location_cities lc ON lc.id = v.location_city
				LEFT JOIN location_streets ls ON (ls.id = v.location_street)
				LEFT JOIN location_street_types lt ON (lt.id = ls.typeid)
                LEFT JOIN location_boroughs lb ON lb.id = lc.boroughid
                LEFT JOIN location_districts ld ON ld.id = lb.districtid
                LEFT JOIN location_states lst ON lst.id = ld.stateid
            WHERE v.id = ?', array($id));
        if ($result) {
            $customer_manager = new LMSCustomerManager($this->db, $this->auth, $this->cache, $this->syslog);
            $user_manager = new LMSUserManager($this->db, $this->auth, $this->cache, $this->syslog);
            $result['createdby'] = $user_manager->getUserName($result['creatorid']);
            $result['modifiedby'] = $user_manager->getUserName($result['modid']);
            $result['creationdateh'] = date('Y/m/d, H:i', $result['creationdate']);
            $result['moddateh'] = date('Y/m/d, H:i', $result['moddate']);
            $result['phones'] = $this->db->GetAll('SELECT phone, number_index FROM voip_numbers WHERE voip_account_id = ?;', array($id));
            $result['owner'] = $customer_manager->getCustomerName($result['ownerid']);
            return $result;
        }
        return FALSE;
    }