1 package FS::msg_template;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::msg_template - Object methods for msg_template records
15 $record = new FS::msg_template \%hash;
16 $record = new FS::msg_template { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::msg_template object represents a customer message template.
29 FS::msg_template inherits from FS::Record. The following fields are currently
67 Creates a new template. To add the template to the database, see L<"insert">.
69 Note that this stores the hash reference, not a distinct copy of the hash it
70 points to. You can ask the object for a copy with the I<hash> method.
74 # the new method can be inherited from FS::Record, if a table method is defined
76 sub table { 'msg_template'; }
80 Adds this record to the database. If there is an error, returns the error,
81 otherwise returns false.
85 # the insert method can be inherited from FS::Record
89 Delete this record from the database.
93 # the delete method can be inherited from FS::Record
95 =item replace OLD_RECORD
97 Replaces the OLD_RECORD with this one in the database. If there is an error,
98 returns the error, otherwise returns false.
102 # the replace method can be inherited from FS::Record
106 Checks all fields to make sure this is a valid template. If there is
107 an error, returns the error, otherwise returns false. Called by the insert
112 # the check method should currently be supplied - FS::Record contains some
113 # data checking routines
119 $self->ut_numbern('msgnum')
120 || $self->ut_text('msgname')
121 || $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
122 || $self->ut_textn('mime_type')
123 || $self->ut_anything('body')
124 || $self->ut_enum('disabled', [ '', 'Y' ] )
126 return $error if $error;
128 $self->mime_type('text/html') unless $self->mime_type;
139 L<FS::Record>, schema.html from the base documentation.