1<?php
2	class socatalog_contact_addr_type
3	{
4		function socatalog_contact_addr_type()
5		{
6			$this->db = &$GLOBALS['phpgw']->db;
7		}
8
9		function _constructor()
10		{
11		}
12
13		function select_catalog()
14		{
15			$addr_type = CreateObject('phpgwapi.contact_addr_type');
16			$addr_type->add_select('addr_type_id');
17			$addr_type->add_select('addr_description');
18			$sql = $addr_type->select();
19			$this->db->query($sql,__LINE__,__FILE__);
20			while ($this->db->next_record())
21			{
22				$return_fields[] = $this->db->Record;
23			}
24			return $return_fields;
25		}
26
27		function insert($fields)
28		{
29			$comm_type = CreateObject('phpgwapi.contact_addr_type');
30			return $comm_type->insert($fields, PHPGW_SQL_RUN_SQL);
31		}
32
33		function delete($key)
34		{
35			$comm_type = CreateObject('phpgwapi.contact_addr_type');
36			return $comm_type->delete('addr_type_id ='. $key, PHPGW_SQL_RUN_SQL);
37		}
38
39		function update($key, $fields)
40		{
41			$comm_type = CreateObject('phpgwapi.contact_addr_type');
42			return $comm_type->update($fields, 'addr_type_id ='. $key, PHPGW_SQL_RUN_SQL);
43		}
44
45		function get_record($key)
46		{
47			$comm_type = CreateObject('phpgwapi.contact_addr_type');
48			$comm_type->add_select('addr_type_id');
49			$comm_type->add_select('addr_description');
50			$comm_type->set_criteria('addr_type_id='. $key);
51			$sql = $comm_type->select();
52			$this->db->query($sql,__LINE__,__FILE__);
53			while ($this->db->next_record())
54			{
55				$return_fields[] = $this->db->Record;
56			}
57			return $return_fields;
58		}
59	}
60?>
61