1 package FS::part_export::acct_sql_status;
2 use base qw( FS::part_export::sql_Common );
9 tie my %options, 'Tie::IxHash', %{__PACKAGE__->sql_options};
10 delete $options{$_} for qw( table schema static primary_key );
14 'desc' => 'Mailbox status information from SQL',
15 'options' => \%options,
18 Read mailbox status information (vacation and spam settings) from an SQL
19 database, tables "vacation" and "users" respectively.
23 sub rebless { shift; }
25 #don't want to inherit these from sql_Common
27 sub _export_replace {}
29 sub _export_suspend {}
30 sub _export_unsuspend {}
32 sub export_getstatus {
33 my($self, $svc_acct, $htmlref, $hashref) = @_;
35 my $dbh = DBI->connect( map $self->option($_), qw(datasrc username password) )
36 or return "can't connect: ". $DBI::errstr;
42 my $vsth = $dbh->prepare('SELECT * FROM vacation WHERE email = ?')
43 or return "can't prepare: ". $dbh->errstr;
44 $vsth->execute( $svc_acct->email )
45 or return "can't execute: ". $vsth->errstr;
47 my $vrow = $vsth->fetchrow_hashref;
49 $hashref->{'vacation_active'} = $vrow->{'active'};
50 $hashref->{'vacation_subject'} = $vrow->{'subject'};
51 $hashref->{'vacation_body'} = $vrow->{'body'};
53 #| cache | text | NO | | NULL | |
54 #| domain | varchar(255) | NO | | NULL | |
55 #and disabling "Sender e-mail address for auto-reply message:", no place for it
62 my $ssth = $dbh->prepare('SELECT * FROM users WHERE address = ?')
63 or return "can't prepare: ". $dbh->errstr;
64 $ssth->execute( $svc_acct->email )
65 or return "can't execute: ". $ssth->errstr;
67 my $srow = $ssth->fetchrow_hashref;
69 $hashref->{'spam_tag_level'} = $srow->{'spam_tag_level'};
70 $hashref->{'spam_tag2_level'} = $srow->{'spam_tag2_level'};
71 $hashref->{'spam_kill_level'} = $srow->{'spam_kill_level'};
72 $hashref->{'bypass_spam_checks'} = $srow->{'bypass_spam_checks'};
73 $hashref->{'spam_tag2_level'} = $srow->{'spam_tag2_level'};
77 # spam allow/deny list
80 #my $lsth = $dbh->prepare('SELECT * FROM
82 #htmlref not implemented/used for this status export