1 package FS::invoice_mode;
2 use base qw(FS::Record);
5 use FS::Record qw( qsearchs ); #qsearch qsearchs );
10 FS::invoice_mode - Object methods for invoice_mode records
16 $record = new FS::invoice_mode \%hash;
17 $record = new FS::invoice_mode { 'column' => 'value' };
19 $error = $record->insert;
21 $error = $new_record->replace($old_record);
23 $error = $record->delete;
25 $error = $record->check;
29 An FS::invoice_mode object represents an invoice rendering style.
30 FS::invoice_mode inherits from FS::Record. The following fields are
35 =item modenum - primary key
37 =item agentnum - the agent who owns this invoice mode (can be null)
39 =item modename - descriptive name for internal use
50 Creates a new invoice mode. To add the object to the database,
53 Note that this stores the hash reference, not a distinct copy of the hash it
54 points to. You can ask the object for a copy with the I<hash> method.
58 # the new method can be inherited from FS::Record, if a table method is defined
60 sub table { 'invoice_mode'; }
64 Adds this record to the database. If there is an error, returns the error,
65 otherwise returns false.
69 # the insert method can be inherited from FS::Record
73 Delete this record from the database.
77 # the delete method can be inherited from FS::Record
79 =item replace OLD_RECORD
81 Replaces the OLD_RECORD with this one in the database. If there is an error,
82 returns the error, otherwise returns false.
86 # the replace method can be inherited from FS::Record
90 Checks all fields to make sure this is a valid example. If there is
91 an error, returns the error, otherwise returns false. Called by the insert
96 # the check method should currently be supplied - FS::Record contains some
97 # data checking routines
103 $self->ut_numbern('modenum')
104 || $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
105 || $self->ut_text('modename')
107 return $error if $error;
112 =item invoice_conf [ LOCALE ]
114 Returns the L<FS::invoice_conf> for this invoice mode, with the specified
115 locale. If there isn't one with that locale, returns the one with null
116 locale. If that doesn't exist, returns nothing.
125 $invoice_conf = qsearchs('invoice_conf', {
126 modenum => $self->modenum,
130 $invoice_conf ||= qsearchs('invoice_conf', {
131 modenum => $self->modenum,
139 Returns the agent associated with this invoice mode, if any.
145 L<FS::Record>, schema.html from the base documentation.