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