1 package FS::part_export_acct_sql_status;
2 use base qw( FS::part_export::sql_Common );
8 my $options = __PACKAGE__->sql_options;
9 delete $options->{$_} for qw( table schema static primary_key );
13 'options' => $options,
16 Read mailbox status information (vacation and spam settings) from an SQL
17 database, tables "vacation" and "users" respectively.
21 sub rebless { shift; }
23 #don't want to inherit these from sql_Common
25 sub _export_replace {}
27 sub _export_suspend {}
28 sub _export_unsuspend {}
30 sub export_getstatus {
31 my($self, $svc_acct, $htmlref, $hashref) = @_;
33 my $dbh = DBI->connect( map $self->option($_), qw(datasrc username password) )
34 or do { $hashref->{'error'} = "can't connect: ". $DBI::errstr; return; };
40 my $vsth = $dbh->prepare('SELECT * FROM vacation WHERE email = ?')
41 or do { $hashref->{'error'} = "can't prepare: ". $dbh->errstr; return; };
42 $vsth->execute( $svc_acct->email )
43 or do { $hashref->{'error'} = "can't execute: ". $vsth->errstr; return; };
45 my $vrow = $vsth->fetchrow_hashref;
47 $hashref->{'vacation_active'} = $vrow->{'active'};
48 $hashref->{'vacation_subject'} = $vrow->{'subject'};
49 $hashref->{'vacation_body'} = $vrow->{'body'};
51 #| cache | text | NO | | NULL | |
52 #| domain | varchar(255) | NO | | NULL | |
53 #and disabling "Sender e-mail address for auto-reply message:", no place for it
60 my $ssth = $dbh->prepare('SELECT * FROM users WHERE address = ?')
61 or do { $hashref->{'error'} = "can't prepare: ". $dbh->errstr; return; };
62 $ssth->execute( $svc_acct->email )
63 or do { $hashref->{'error'} = "can't execute: ". $ssth->errstr; return; };
65 my $srow = $ssth->fetchrow_hashref;
67 $hashref->{'spam_tag_level'} = $srow->{'spam_tag_level'};
68 $hashref->{'spam_tag2_level'} = $srow->{'spam_tag2_level'};
69 $hashref->{'spam_kill_level'} = $srow->{'spam_kill_level'};
70 $hashref->{'bypass_spam_checks'} = $srow->{'bypass_spam_checks'};
71 $hashref->{'spam_tag2_level'} = $srow->{'spam_tag2_level'};
75 # spam allow/deny list
78 #my $lsth = $dbh->prepare('SELECT * FROM
80 #htmlref not implemented/used for this status export