1 package FS::template_content;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::template_content - Object methods for template_content records
13 use FS::template_content;
15 $record = new FS::template_content \%hash;
16 $record = new FS::template_content { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::template_content object represents the content of a message template
29 (subject line and body) for a specific region. FS::template_content inherits
30 from FS::Record. The following fields are currently supported:
34 =item contentnum - primary key
36 =item msgnum - the L<FS::msg_template> for which this is the content.
38 =item locale - locale (such as 'en_US'); can be NULL.
40 =item subject - Subject: line of the message, in L<Text::Template> format.
42 =item body - Message body, as plain text or HTML, in L<Text::Template> format.
52 Creates a new example. To add the example to the database, see L<"insert">.
54 Note that this stores the hash reference, not a distinct copy of the hash it
55 points to. You can ask the object for a copy with the I<hash> method.
59 # the new method can be inherited from FS::Record, if a table method is defined
61 sub table { 'template_content'; }
65 Adds this record to the database. If there is an error, returns the error,
66 otherwise returns false.
70 # the insert method can be inherited from FS::Record
74 Delete this record from the database.
78 # the delete method can be inherited from FS::Record
80 =item replace OLD_RECORD
82 Replaces the OLD_RECORD with this one in the database. If there is an error,
83 returns the error, otherwise returns false.
87 # the replace method can be inherited from FS::Record
91 Checks all fields to make sure this is a valid example. If there is
92 an error, returns the error, otherwise returns false. Called by the insert
97 # the check method should currently be supplied - FS::Record contains some
98 # data checking routines
104 $self->ut_numbern('contentnum')
105 || $self->ut_foreign_key('msgnum', 'msg_template', 'msgnum')
106 || $self->ut_textn('locale')
107 || $self->ut_anything('subject')
108 || $self->ut_anything('body')
110 return $error if $error;
119 L<FS::Record>, schema.html from the base documentation.