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,
19 Read mailbox status information (vacation and spam settings) from an SQL
20 database, tables "vacation" and "users" respectively.
24 sub rebless { shift; }
26 #don't want to inherit these from sql_Common
28 sub _export_replace {}
30 sub _export_suspend {}
31 sub _export_unsuspend {}
33 sub export_getstatus {
34 my($self, $svc_acct, $htmlref, $hashref) = @_;
36 my $dbh = DBI->connect( map $self->option($_), qw(datasrc username password) )
37 or return "can't connect: ". $DBI::errstr;
43 my $vsth = $dbh->prepare('SELECT * FROM vacation WHERE email = ?')
44 or return "can't prepare: ". $dbh->errstr;
45 $vsth->execute( $svc_acct->email )
46 or return "can't execute: ". $vsth->errstr;
48 my $vrow = $vsth->fetchrow_hashref;
50 $hashref->{'vacation_active'} = $vrow->{'active'};
51 $hashref->{'vacation_subject'} = $vrow->{'subject'};
52 $hashref->{'vacation_body'} = $vrow->{'body'};
54 #| cache | text | NO | | NULL | |
55 #| domain | varchar(255) | NO | | NULL | |
56 #and disabling "Sender e-mail address for auto-reply message:", no place for it
63 my $ssth = $dbh->prepare('SELECT * FROM users WHERE address = ?')
64 or return "can't prepare: ". $dbh->errstr;
65 $ssth->execute( $svc_acct->email )
66 or return "can't execute: ". $ssth->errstr;
68 my $srow = $ssth->fetchrow_hashref;
70 $hashref->{'spam_tag_level'} = $srow->{'spam_tag_level'};
71 $hashref->{'spam_tag2_level'} = $srow->{'spam_tag2_level'};
72 $hashref->{'spam_kill_level'} = $srow->{'spam_kill_level'};
73 $hashref->{'bypass_spam_checks'} = $srow->{'bypass_spam_checks'};
74 $hashref->{'spam_tag2_level'} = $srow->{'spam_tag2_level'};
78 # spam allow/deny list
81 #my $lsth = $dbh->prepare('SELECT * FROM
83 #htmlref not implemented/used for this status export