Difference between revisions of "Freeside:3:Documentation:Developer/FS/contact"
From Freeside
m (Edit via perl MediaWiki framework (1.13)) |
m (Edit via perl MediaWiki framework (1.13)) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
</code> | </code> | ||
==DESCRIPTION== | ==DESCRIPTION== | ||
− | An FS::contact object represents an | + | An FS::contact object represents an specific contact person for a prospect or customer. FS::contact inherits from FS::Record. The following fields are currently supported: |
; contactnum | ; contactnum | ||
Line 45: | Line 45: | ||
==METHODS== | ==METHODS== | ||
; new HASHREF | ; new HASHREF | ||
− | :Creates a new | + | :Creates a new contact. To add the contact to the database, see [[#insert|"insert"]]. |
:Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the ''hash'' method. | :Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the ''hash'' method. | ||
Line 54: | Line 54: | ||
; replace OLD_RECORD | ; replace OLD_RECORD | ||
:Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. | :Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. | ||
+ | ; _parse_phonestring PHONENUMBER_STRING | ||
+ | :Subroutine, takes a string and returns a list (suitable for assigning to a hash) with keys 'countrycode', 'phonenum' and 'extension' | ||
+ | |||
+ | :(Should probably be moved to contact_phone.pm, hence the initial underscore.) | ||
; queue_fuzzyfiles_update | ; queue_fuzzyfiles_update | ||
:Used by insert & replace to update the fuzzy search cache | :Used by insert & replace to update the fuzzy search cache | ||
; check | ; check | ||
− | :Checks all fields to make sure this is a valid | + | :Checks all fields to make sure this is a valid contact. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods. |
+ | ; line | ||
+ | :Returns a formatted string representing this contact, including name, title and comment. | ||
+ | ; firstlast | ||
+ | :Returns a formatted string representing this contact, with just the name. | ||
+ | ; contact_classname | ||
+ | :Returns the name of this contact's class (see [[Freeside:3:Documentation:Developer/FS/contact class|FS::contact_class]]). | ||
+ | ; by_selfservice_email EMAILADDRESS | ||
+ | :Alternate search constructor (class method). Given an email address, returns the contact for that address, or the empty string if no contact has that email address. | ||
+ | ; cgi_contact_fields | ||
+ | :Returns a list reference containing the set of contact fields used in the web interface for one-line editing (i.e. excluding contactnum, prospectnum, custnum and locationnum, as well as password fields, but including fields for contact_email and contact_phone records.) | ||
==BUGS== | ==BUGS== | ||
==SEE ALSO== | ==SEE ALSO== | ||
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation. | [[Freeside:3:Documentation:Developer/FS/Record|FS::Record]], schema.html from the base documentation. |
Latest revision as of 09:57, 10 April 2015
Contents
NAME
FS::contact - Object methods for contact records
SYNOPSIS
use FS::contact; $record = new FS::contact \%hash; $record = new FS::contact { 'column' => 'value' }; $error = $record->insert; $error = $new_record->replace($old_record); $error = $record->delete; $error = $record->check;
DESCRIPTION
An FS::contact object represents an specific contact person for a prospect or customer. FS::contact inherits from FS::Record. The following fields are currently supported:
- contactnum
- primary key
- prospectnum
- prospectnum
- custnum
- custnum
- locationnum
- locationnum
- last
- last
- first
- first
- title
- title
- comment
- comment
- selfservice_access
- empty or Y
- _password; _password_encoding
- empty or bcrypt
- disabled
- disabled
METHODS
- new HASHREF
- Creates a new contact. To add the contact to the database, see "insert".
- Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
- insert
- Adds this record to the database. If there is an error, returns the error, otherwise returns false.
- delete
- Delete this record from the database.
- replace OLD_RECORD
- Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
- _parse_phonestring PHONENUMBER_STRING
- Subroutine, takes a string and returns a list (suitable for assigning to a hash) with keys 'countrycode', 'phonenum' and 'extension'
- (Should probably be moved to contact_phone.pm, hence the initial underscore.)
- queue_fuzzyfiles_update
- Used by insert & replace to update the fuzzy search cache
- check
- Checks all fields to make sure this is a valid contact. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
- line
- Returns a formatted string representing this contact, including name, title and comment.
- firstlast
- Returns a formatted string representing this contact, with just the name.
- contact_classname
- Returns the name of this contact's class (see FS::contact_class).
- by_selfservice_email EMAILADDRESS
- Alternate search constructor (class method). Given an email address, returns the contact for that address, or the empty string if no contact has that email address.
- cgi_contact_fields
- Returns a list reference containing the set of contact fields used in the web interface for one-line editing (i.e. excluding contactnum, prospectnum, custnum and locationnum, as well as password fields, but including fields for contact_email and contact_phone records.)
BUGS
SEE ALSO
FS::Record, schema.html from the base documentation.