| 
				 public 
				
				
				 | 
			#
			__construct( )
				
Initialize Contacts Overrides | 
		
			| 
				 public 
				integer
				
				 | 
			#
			add( array $vars )
				
Add a contact with the fields given 
				
Add a contact with the fields given Parameters
						$varsarray$vars An array of variable contact info, including - client_id The client ID
this contact will be associated with - user_id The user ID this contact belongs
to if this contact has their own unique user record (optional) - contact_type
The type of contact, either 'primary' (default), 'billing', or 'other'
(optional) - contact_type_id The ID of the contact type if contact_type is
'other' (optional) - first_name The first name of this contact - last_name The
last name of this contact - title The business title for this contact (optional)
- company The company/organization this contact belongs to (optional) - email
This contact's email address - address1 This contact's address (optional) -
address2 This contact's address line two (optional) - city This contact's city
(optional) - state The 3-character ISO 3166-2 subdivision code, requires country
(optional) - zip The zip/postal code for this contact (optional) - country The
2-character ISO 3166-1 country code, required if state is given (optional) -
numbers An array of number data including (optional): - number The phone number
to add - type The type of phone number 'phone', 'fax' (optional, default
'phone') - location The location of this phone line 'home', 'work', 'mobile'
(optional, default 'home')
Returns
						integerThe contact ID, void on error
 
 See | 
		
			| 
				 public 
				stdClass | 
			#
			edit( integer $contact_id, array $vars )
				
Edit the contact with the fields given, all fields optional 
				
Edit the contact with the fields given, all fields optional Parameters
						$contact_idinteger$contact_id The contact ID to update
$varsarray$vars An array of variable contact info, including - user_id The user ID this
contact belongs to if this contact has their own unique user record (optional) -
contact_type The type of contact, either "primary" (default) or "other"
(optional) - contact_type_id The ID of the contact type if contact_type is
"other" (optional) - first_name The first name of this contact - last_name The
last name of this contact - title The business title for this contact (optional)
- company The company/organization this contact belongs to (optional) - email
This contact's email address - address1 This contact's address (optional) -
address2 This contact's address line two (optional) - city This contact's city
(optional) - state The 3-character ISO 3166-2 subdivision code, requires country
(optional) - zip The zip/postal code for this contact (optional) - country The
2-character ISO 3166-1 country code, required if state is given (optional) -
numbers An array of number data including (optional): - id The ID of the contact
number to update (if empty, will add as new) - number The phone number to add
(if empty, will remove this record) - type The type of phone number 'phone',
'fax' (optional, default 'phone') - location The location of this phone line
'home', 'work', 'mobile' (optional, default 'home')
Returns
						stdClassobject represented the updated contact if successful, void otherwise
					 See | 
		
			| 
				 public 
				
				
				 | 
			#
			delete( integer $contact_id )
				
Permanently removes this contact from the system. 
				
Permanently removes this contact from the system. Parameters
						$contact_idinteger$contact_id The ID of the contact to remove from the system
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			get( integer $contact_id )
				
Fetch the contact with the given contact ID 
				
Fetch the contact with the given contact ID Parameters
						$contact_idinteger$contact_id The contact ID to fetch
Returns
						mixedA stdClass contact object, or false if the contact does not exist
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getByUserId( integer $user_id, integer $client_id )
				
Fetch the contact with the given contact ID 
				
Fetch the contact with the given contact ID Parameters
						$user_idinteger$user_id The contact user ID to fetch on
$client_idinteger$client_id The contact client ID to fetch on
Returns
						mixedA stdClass contact object, or false if the contact does not exist
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getList( integer $client_id, integer $page = 1, array $order = array('last_name'=>"asc", 'first_name'=>"asc") )
				
Fetches a list of all contacts under a client 
				
Fetches a list of all contacts under a client Parameters
						$client_idinteger$client_id The client ID to fetch contacts for
$pageinteger$page The page to return results for
$orderstring$sort_by The field to sort by
Returns
						mixedAn array of objects or false if no results.
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getListCount( integer $client_id )
				
Return the total number of contacts returned from Contacts::getList(), useful
in constructing pagination for the getList() method. 
				
Return the total number of contacts returned from Contacts::getList(), useful
in constructing pagination for the getList() method. Parameters
						$client_idinteger$client_id The client ID to fetch contacts for
Returns
						integerThe total number of clients
 
 See | 
		
			| 
				 public 
				array
				
				 | 
			#
			getAll( integer $client_id, string $contact_type = null, array $order = array('last_name'=>"asc", 'first_name'=>"asc") )
				
Fetches a list of all contacts under a client 
				
Fetches a list of all contacts under a client Parameters
						$client_idinteger$client_id The client ID to fetch contacts for
$contact_typestring$contact_type The contact type to fetch (i.e. "primary", "billing", or "other")
(optional, default all contact types)
$orderarray$order The sort and order conditions (e.g. array('sort_field'=>"ASC"),
optional)
Returns
						arrayA list of stdClass objects representing each contact
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getContactTypes( )
				
Retrieves a list of client contact types 
				
Retrieves a list of client contact types Returns
						arrayKey=>value pairs of client contact types
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getType( integer $contact_type_id )
				
Retrieve a single contact type 
				
Retrieve a single contact type Parameters
						$contact_type_idinteger$contact_type_id The contact type ID
Returns
						mixedAn stdClass object representing the contact type, or false if none exist
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getTypes( integer $company_id = null )
				
Return all existing contact types in the system for the given company 
				
Return all existing contact types in the system for the given company Parameters
						$company_idinteger$company_id The company ID to fetch contact types for (optional)
Returns
						arrayAn array of stdClass objects representing contact types
 
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			addType( array $vars )
				
Add a contact type Parameters
						$varsarray$vars An array of contact type information including: - name The name of this
contact type - is_lang Whether or not 'name' is a language definition -
company_id The company ID to add the contact type under (optional)
Returns
						integerThe contact type ID created, void if error
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			editType( integer $contact_type_id, array $vars )
				
Update the contact type with the given data 
				
Update the contact type with the given data Parameters
						$contact_type_idinteger$contact_type_id The contact type ID to update
$varsarray$vars An array of contact type information including: - name The name of this
contact type - is_lang Whether or not 'name' is a language definition
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteType( integer $contact_type_id )
				
Delete a contact type and reset the type for all affected contacts to
null 
				
Delete a contact type and reset the type for all affected contacts to
null Parameters
						$contact_type_idinteger$contact_type_id The contact type ID
 | 
		
			| 
				 public 
				integer
				
				 | 
			#
			addNumber( integer $contact_id, array $vars )
				
Adds a new number Parameters
						$contact_idinteger$contact_id The contact ID to attach the number
$varsarray$vars An array of number information including: - number The phone number to add
- type The type of phone number 'phone', 'fax' (optional, default 'phone') -
location The location of this phone line 'home', 'work', 'mobile' (optional,
default 'home')
Returns
						integerThe contact number ID of the number created, void if error
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			editNumber( integer $contact_number_id, array $vars )
				
Updates an existing number 
				
Updates an existing number Parameters
						$contact_number_idinteger$contact_number_id The number ID to update
$varsarray$vars An array of number information including: - number The phone number to add
- type The type of phone number 'phone', 'fax' (optional, default 'phone') -
location The location of this phone line 'home', 'work', 'mobile' (optional,
default 'home')
 | 
		
			| 
				 public 
				
				
				 | 
			#
			deleteNumber( integer $contact_number_id )
				
Permanently removes a number from the system 
				
Permanently removes a number from the system Parameters
						$contact_number_idinteger$contact_number_id The Id of the number to delete
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getNumber( integer $contact_number_id )
				
Fetches a specific number 
				
Fetches a specific number Parameters
						$contact_number_idinteger$contact_number_id The ID of the number to fetch
Returns
						mixedA stdClass object representing the number, false if no such number exists
 
 | 
		
			| 
				 public 
				mixed
				
				 | 
			#
			getNumbers( integer $contact_id, string $type = null, string $location = null, mixed $order = array("FIELD(location,'work','home','mobile')"=>"ASC") )
				
Fetches all numbers for the given contact and (optionally) type 
				
Fetches all numbers for the given contact and (optionally) type Parameters
						$contact_idinteger$contact_id The contact ID to fetch all numbers for
$typestring$type The type of number to fetch ('phone', or 'fax', default null for all)
$locationstring$location The location of the number to fetch ('home', 'work', or 'mobile',
default null for all)
$orderReturns
						mixedAn array of stdClass objects representing contact numbers, false if no records
found
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getNumberTypes( )
				
Returns a list of contact number types 
				
Returns a list of contact number types Returns
						arrayA key=>value list of contact number types
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getNumberLocations( )
				
Returns a list of contact number locations 
				
Returns a list of contact number locations Returns
						arrayA key=>value list of contact number locations
 
 | 
		
			| 
				 public 
				string
				
				 | 
			#
			intlNumber( string $number, string $country, string $code_delimiter = "." )
				
Internationalizes the given format number (+NNN.NNNNNNNNNN) 
				
Internationalizes the given format number (+NNN.NNNNNNNNNN) Parameters
						$numberstring$number The phone number
$countrystring$country The ISO 3166-1 alpha2 country code
$code_delimiterstring$code_delimiter The delimiter to use between the country prefix and the number
Returns
						stringThe number in +NNN.NNNNNNNNNN
 
 | 
		
			| 
				 public 
				
				
				 | 
			#
			setPermissions( integer $contact_id, array $vars )
				
Sets permissions for the given contact 
				
Sets permissions for the given contact Parameters
						$contact_idinteger$contact_id The ID of the contact to set permissions for
$varsarray$vars A numerically indexed array of arrays containing: - area The area
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getPermissions( integer $contact_id )
				
Fetch all permissions set for a contact 
				
Fetch all permissions set for a contact Parameters
						$contact_idinteger$contact_id The ID of the contact to set permissions for
Returns
						arrayAn array of stdClass objects, each representing a permission
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			hasPermission( integer $company_id, integer $contact_id, string $area )
				
Checks whether or not the contact has permissions for the given area 
				
Checks whether or not the contact has permissions for the given area Parameters
						$company_idinteger$company_id The ID of the company
$contact_idinteger$contact_id The ID of the contact
$areastring$area The area to check
Returns
						booleanTrue if permission allowed, false otherwise
 
 | 
		
			| 
				 public 
				array
				
				 | 
			#
			getPermissionOptions( integer $company_id )
				
Returns an array of key/value pairs of all available permission options 
				
Returns an array of key/value pairs of all available permission options Parameters
						$company_idinteger$company_id The ID of the company to fetch options under
Returns
						arrayAn array of key/value pairs
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateContactNumberType( string $type )
				
Validates the contact numbers 'type' field 
				
Validates the contact numbers 'type' field Parameters
						$typestring$type The type to check
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateContactNumberLocation( string $location )
				
Validates the contact numbers 'location' field 
				
Validates the contact numbers 'location' field Parameters
						$locationstring$location The location to check
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateContactType( string $contact_type, integer $contact_id = null, integer $client_id = null )
				
Validates a contact's 'contact_type' field 
				
Validates a contact's 'contact_type' field Parameters
						$contact_typestring$contact_type The contact type to check
$contact_idinteger$contact_id The ID of the contact being updated
$client_idinteger$client_id The ID of the contact being added to
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateContactTypeId( integer $contact_type_id, string $contact_type, integer $client_id )
				
Validates a contact's 'contact_type_id' field 
				
Validates a contact's 'contact_type_id' field Parameters
						$contact_type_idinteger$contact_type_id The contact type ID to check
$contact_typestring$contact_type The contact type
$client_idinteger$client_id The ID of the client the contact's type is being set for
Returns
						booleanTrue if validated, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateCountrySet( string $state, string $country )
				
Validates a country is set when a state is provided 
				
Validates a country is set when a state is provided Parameters
						$statestring$state The state
$countrystring$country The country
Returns
						booleanTrue if a country is set, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateIsPrimary( integer $contact_id )
				
Validates whether this contact is the primary contact for a client 
				
Validates whether this contact is the primary contact for a client Parameters
						$contact_idinteger$contact_id The contact ID
Returns
						booleanTrue if this contact is a client's primary billing contact, false otherwise
 
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			validateReceivesInvoices( string $contact_type = null, integer $contact_id = null )
				
Validates whether the given contact is the contact whom invoices are
addressed to and can be based on the given contact type 
				
Validates whether the given contact is the contact whom invoices are
addressed to and can be based on the given contact type Parameters
						$contact_typestring$contact_type The contact type of the contact (i.e. "primary", "billing",
"other"; optional)
$contact_idinteger$contact_id The contact ID
Returns
						booleanTrue if this contact is the contact whom invoices are addressed to, false
otherwise
 
 |