package FS::part_export::cp;
-use vars qw(@ISA);
+use vars qw(@ISA %info);
+use Tie::IxHash;
use FS::part_export;
@ISA = qw(FS::part_export);
+tie my %options, 'Tie::IxHash',
+ 'port' => { label=>'Port number' },
+ 'username' => { label=>'Username' },
+ 'password' => { label=>'Password' },
+ 'domain' => { label=>'Domain' },
+ 'workgroup' => { label=>'Default Workgroup' },
+;
+
+%info = (
+ 'svc' => 'svc_acct',
+ 'desc' => 'Real-time export to Critical Path Account Provisioning Protocol',
+ 'options'=> \%options,
+ 'notes' => <<'END'
+Real-time export to
+<a href="http://www.cp.net/">Critial Path Account Provisioning Protocol</a>.
+Requires installation of
+<a href="http://search.cpan.org/dist/Net-APP">Net::APP</a>
+from CPAN.
+END
+);
+
sub rebless { shift; }
sub _export_insert {
my( $self, $svc_acct ) = (shift, shift);
$self->cp_queue( $svc_acct->svcnum, 'create_mailbox',
- Mailbox => $svc_acct->username,
- Password => $svc_acct->_password,
- Workgroup => $self->option('workgroup'),
- Domain => $svc_acct->domain,
+ 'Mailbox' => $svc_acct->username,
+ 'Password' => $svc_acct->_password,
+ 'Workgroup' => $self->option('workgroup'),
+ 'Domain' => $svc_acct->domain,
);
}
my( $self, $new, $old ) = (shift, shift, shift);
return "can't change domain with Critical Path"
if $old->domain ne $new->domain;
- return '' unless $old->username ne $new->username
- || $old->_password ne $new->_password;
+ return "can't change username with Critical Path" #CP no longer supports this
+ if $old->username ne $new->username;
+ return '' unless $old->_password ne $new->_password;
$self->cp_queue( $new->svcnum, 'replace', $new->domain,
$old->username, $new->username, $old->_password, $new->_password );
}
sub _export_delete {
my( $self, $svc_acct ) = (shift, shift);
$self->cp_queue( $svc_acct->svcnum, 'delete_mailbox',
- Mailbox => $svc_acct->username,
- Domain => $svc_acct->domain,
+ 'Mailbox' => $svc_acct->username,
+ 'Domain' => $svc_acct->domain,
+ );
+}
+
+sub _export_suspend {
+ my( $self, $svc_acct ) = (shift, shift);
+ $self->cp_queue( $svc_acct->svcnum, 'set_mailbox_status',
+ 'Mailbox' => $svc_acct->username,
+ 'Domain' => $svc_acct->domain,
+ 'OTHER' => 'T',
+ 'OTHER_SUSPEND' => 'T',
+ );
+}
+
+sub _export_unsuspend {
+ my( $self, $svc_acct ) = (shift, shift);
+ $self->cp_queue( $svc_acct->svcnum, 'set_mailbox_status',
+ 'Mailbox' => $svc_acct->username,
+ 'Domain' => $svc_acct->domain,
+ 'PAYMENT' => 'F',
+ 'OTHER' => 'F',
+ 'OTHER_SUSPEND' => 'F',
+ 'OTHER_BOUNCE' => 'F',
);
}
'job' => 'FS::part_export::cp::cp_command',
};
$queue->insert(
- $self->option('host'),
+ $self->machine,
$self->option('port'),
$self->option('username'),
$self->option('password'),
);
}
+ #my $other = 'F';
if ( $new_password =~ /^\*SUSPENDED\* (.*)$/ ) {
$new_password = $1;
- cp_command($host, $port, $username, $password, 'set_mailbox_status',
- Domain => $domain,
- Mailbox => $new_username,
- Other => 'T',
- Other_Bounce => 'T',
- );
- } else {
- cp_command($host, $port, $username, $password, 'set_mailbox_status',
- Domain => $domain,
- Mailbox => $new_username,
- Other => 'F',
- Other_Bounce => 'F',
- );
+ # $other = 'T';
}
+ #cp_command($host, $port, $username, $password, $login_domain,
+ # 'set_mailbox_status',
+ # Domain => $domain,
+ # Mailbox => $new_username,
+ # Other => $other,
+ # Other_Bounce => $other,
+ #);
if ( $old_password ne $new_password ) {
- cp_command($host, $port, $username, $password, 'change_mailbox',
+ cp_command($host, $port, $username, $password, $login_domain,
+ 'change_mailbox',
Domain => $domain,
Mailbox => $new_username,
Password => $new_password,
}
+1;
+