1 package FS::cust_contact;
2 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::cust_contact - Object methods for cust_contact records
15 $record = new FS::cust_contact \%hash;
16 $record = new FS::cust_contact { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::cust_contact object represents a contact's attachment to a specific
29 customer. FS::cust_contact inherits from FS::Record. The following fields are
54 =item selfservice_access
66 Creates a new record. To add the record to the database, see L<"insert">.
68 Note that this stores the hash reference, not a distinct copy of the hash it
69 points to. You can ask the object for a copy with the I<hash> method.
73 # the new method can be inherited from FS::Record, if a table method is defined
75 sub table { 'cust_contact'; }
79 Adds this record to the database. If there is an error, returns the error,
80 otherwise returns false.
84 Delete this record from the database.
86 =item replace OLD_RECORD
88 Replaces the OLD_RECORD with this one in the database. If there is an error,
89 returns the error, otherwise returns false.
93 Checks all fields to make sure this is a valid record. If there is
94 an error, returns the error, otherwise returns false. Called by the insert
99 # the check method should currently be supplied - FS::Record contains some
100 # data checking routines
105 if ( $self->selfservice_access eq 'R' ) {
106 $self->selfservice_access('Y');
111 $self->ut_numbern('custcontactnum')
112 || $self->ut_number('custnum')
113 || $self->ut_number('contactnum')
114 || $self->ut_numbern('classnum')
115 || $self->ut_textn('comment')
116 || $self->ut_enum('selfservice_access', [ '', 'Y' ])
118 return $error if $error;
123 =item contact_classname
125 Returns the name of this contact's class (see L<FS::contact_class>).
129 sub contact_classname {
131 my $contact_class = $self->contact_class or return '';
132 $contact_class->classname;
141 L<FS::contact>, L<FS::cust_main>, L<FS::Record>