1 package FS::mailinglist;
2 use base qw(FS::Record);
5 use FS::Record qw( dbh ); #qw( qsearch qsearchs dbh );
9 FS::mailinglist - Object methods for mailinglist records
15 $record = new FS::mailinglist \%hash;
16 $record = new FS::mailinglist { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::mailinglist object represents a mailing list FS::mailinglist inherits
29 from FS::Record. The following fields are currently supported:
49 Creates a new mailing list. To add the mailing list to the database, see
52 Note that this stores the hash reference, not a distinct copy of the hash it
53 points to. You can ask the object for a copy with the I<hash> method.
57 # the new method can be inherited from FS::Record, if a table method is defined
59 sub table { 'mailinglist'; }
63 Adds this record to the database. If there is an error, returns the error,
64 otherwise returns false.
68 # the insert method can be inherited from FS::Record
72 Delete this record from the database.
79 local $SIG{HUP} = 'IGNORE';
80 local $SIG{INT} = 'IGNORE';
81 local $SIG{QUIT} = 'IGNORE';
82 local $SIG{TERM} = 'IGNORE';
83 local $SIG{TSTP} = 'IGNORE';
84 local $SIG{PIPE} = 'IGNORE';
86 my $oldAutoCommit = $FS::UID::AutoCommit;
87 local $FS::UID::AutoCommit = 0;
90 foreach my $member ( $self->mailinglistmember ) {
91 my $error = $member->delete;
93 $dbh->rollback if $oldAutoCommit;
98 my $error = $self->SUPER::delete;
100 $dbh->rollback if $oldAutoCommit;
104 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
109 =item replace OLD_RECORD
111 Replaces the OLD_RECORD with this one in the database. If there is an error,
112 returns the error, otherwise returns false.
116 # the replace method can be inherited from FS::Record
120 Checks all fields to make sure this is a valid mailing list. If there is
121 an error, returns the error, otherwise returns false. Called by the insert
126 # the check method should currently be supplied - FS::Record contains some
127 # data checking routines
133 $self->ut_numbern('listnum')
134 || $self->ut_text('listname')
136 return $error if $error;
141 =item mailinglistmember
143 =item svc_mailinglist
151 L<FS::mailinglistmember>, L<FS::svc_mailinglist>, L<FS::Record>, schema.html
152 from the base documentation.