4 use base qw( FS::Record );
5 use FS::Record qw( qsearchs );
11 FS::cust_tag - Object methods for cust_tag records
17 $record = new FS::cust_tag \%hash;
18 $record = new FS::cust_tag { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::cust_tag object represents a customer tag. FS::cust_tag inherits from
31 FS::Record. The following fields are currently supported:
56 Creates a new customer tag. To add the tag to the database, see L<"insert">.
58 Note that this stores the hash reference, not a distinct copy of the hash it
59 points to. You can ask the object for a copy with the I<hash> method.
63 # the new method can be inherited from FS::Record, if a table method is defined
65 sub table { 'cust_tag'; }
69 Adds this record to the database. If there is an error, returns the error,
70 otherwise returns false.
74 # the insert method can be inherited from FS::Record
78 Delete this record from the database.
82 # the delete method can be inherited from FS::Record
84 =item replace OLD_RECORD
86 Replaces the OLD_RECORD with this one in the database. If there is an error,
87 returns the error, otherwise returns false.
91 # the replace method can be inherited from FS::Record
95 Checks all fields to make sure this is a valid customer tag. If there is
96 an error, returns the error, otherwise returns false. Called by the insert
101 # the check method should currently be supplied - FS::Record contains some
102 # data checking routines
108 $self->ut_numbern('custtagnum')
109 || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
110 || $self->ut_foreign_key('tagnum', 'part_tag', 'tagnum' )
112 return $error if $error;
123 qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
132 qsearchs( 'part_tag', { 'tagnum' => $self->tagnum } );
142 L<FS::Record>, schema.html from the base documentation.