add status_shellcommands export, RT#15987
[freeside.git] / FS / FS / part_export / status_shellcommands.pm
1 package FS::part_export::status_shellcommands;
2 use base qw( FS::part_export::shellcommands );
3
4 use vars qw( %info );
5 use Tie::IxHash;
6
7 tie my %options, 'Tie::IxHash',
8   'user' => { label=>'Remote username', default=>'root' },
9
10   'spam_enable'     => { label=>'Spam filtering enable command', },
11   'spam_disable'    => { label=>'Spam filtering disable command', },
12   'spam_tag2_level'  => { label=>'Spam set tag2 level command', },
13   'spam_kill_level' => { label=>'Spam set kill level command', },
14
15   'ignore_all_output' => {
16     label => 'Ignore all output and errors from the command',
17     type  => 'checkbox',
18   },
19 ;
20
21 %info = (
22   'svc'      => 'svc_acct',
23   'desc'     => 'Set mailbox status via shell commands',
24   'options'  => \%options,
25   'nodomain' => '',
26   'notes'    => <<END
27 Set mailbox status information (vacation and spam settings) with shell commands.
28 END
29 );
30
31 #don't want to inherit these from shellcommands
32 sub _export_insert    {}
33 sub _export_replace   {}
34 sub _export_delete    {}
35 sub _export_suspend   {}
36 sub _export_unsuspend {}
37
38 sub export_setstatus {
39   my($self, $svc_acct, $hashref) = @_;
40
41   $self->_export_command('spam_enable', $svc_acct->email);
42
43   $self->_export_command('spam_tag2_level', $svc_acct->email, $hashref->{'spam_tag2_level'} );
44   $self->_export_command('spam_kill_level', $svc_acct->email, $hashref->{'spam_kill_level'} );
45
46 }
47
48 1;