summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2010-02-21 07:32:21 +0000
committerivan <ivan>2010-02-21 07:32:21 +0000
commit6495ef2f0c495e55db9e182f5607d93a5c4adc20 (patch)
treed9f089d7257bc5c4f00fa47e715860091848abb5 /FS
parent690f020eb7e2af7112793747f45b488aa0e24e03 (diff)
communigate, RT#7083
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Schema.pm1
-rw-r--r--FS/FS/part_export/communigate_pro.pm56
-rw-r--r--FS/FS/svc_acct.pm1
3 files changed, 48 insertions, 10 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 1edb0d28d..b2c49b3a6 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1487,6 +1487,7 @@ sub tables_hashref {
'password_selfchange','char', 'NULL', 1, '', '',
'password_recover', 'char', 'NULL', 1, '', '',
'cgp_type', 'varchar', 'NULL', $char_d, '', '', #AccountType
+ 'cgp_aliases', 'varchar', 'NULL', 255, '', '', #AccountType
],
'primary_key' => 'svcnum',
#'unique' => [ [ 'username', 'domsvc' ] ],
diff --git a/FS/FS/part_export/communigate_pro.pm b/FS/FS/part_export/communigate_pro.pm
index 11cf88f54..c31aea385 100644
--- a/FS/FS/part_export/communigate_pro.pm
+++ b/FS/FS/part_export/communigate_pro.pm
@@ -17,7 +17,7 @@ tie %options, 'Tie::IxHash',
'password' => { label =>'The administrator account password.', },
'accountType' => { label => 'Type for newly-created accounts (default when not specified in service)',
type => 'select',
- options => [qw(MultiMailbox TextMailbox MailDirMailbox)],
+ options => [qw(MultiMailbox TextMailbox MailDirMailbox AGrade BGrade CGrade)],
default => 'MultiMailbox',
},
'externalFlag' => { label => 'Create accounts with an external (visible for legacy mailers) INBOX.',
@@ -70,30 +70,45 @@ sub _export_insert {
sub _export_insert_svc_acct {
my( $self, $svc_acct ) = (shift, shift);
- my @options = ( $svc_acct->svcnum, 'CreateAccount',
- 'accountName' => $self->export_username($svc_acct),
- 'accountType' => ( $svc_acct->cgp_type
- || $self->option('accountType') ),
+ my %settings = (
'AccessModes' => ( $svc_acct->cgp_accessmodes
|| $self->option('AccessModes') ),
'RealName' => $svc_acct->finger,
'Password' => $svc_acct->_password,
+ map { $quotas{$_} => $svc_acct->$_() }
+ grep $svc_acct->$_(), keys %quotas
);
- push @options, $quotas{$_} => $svc_acct->$_()
- foreach grep $svc_acct->$_(), keys %quotas;
+ #XXX preferences phase 1: message delete method, on logout remove trash
+ #phase 2: language, time zone, layout, pronto style, send read receipts
#phase 2: pwdallowed, passwordrecovery, allowed mail rules,
# RPOP modifications, accepts mail to all, add trailer to sent mail
#phase 3: archive messages, mailing lists
+ my @options = ( 'CreateAccount',
+ 'accountName' => $self->export_username($svc_acct),
+ 'accountType' => ( $svc_acct->cgp_type
+ || $self->option('accountType') ),
+ 'settings' => \%settings
+ );
+
push @options, 'externalFlag' => $self->option('externalFlag')
if $self->option('externalFlag');
- #XXX preferences phase 1: message delete method, on logout remove trash
- #phase 2: language, time zone, layout, pronto style, send read receipts
+ #let's do the create realtime too, for much the same reasons, and to avoid
+ #pain of trying to queue w/dep the aliases
+ #my $r=
+ eval { $self->communigate_pro_runcommand( @options ) };
+ return $@ if $@;
- $self->communigate_pro_queue( @options );
+ my $err= $self->communigate_pro_queue( $svc_acct->svcnum, 'SetAccountAliases',
+ $self->export_username($svc_acct),
+ [ split(/\s*,\s*/, $svc_acct->cgp_aliases) ],
+ );
+ warn "WARNING: error queueing SetAccountAliases job: $err" if $err;
+
+ '';
}
@@ -172,6 +187,16 @@ sub _export_replace_svc_acct {
return $error if $error;
}
+ if ( $old->cgp_aliases ne $new->cgp_aliases ) {
+ my $error = $self->communigate_pro_queue(
+ $new->svcnum,
+ 'SetAccountAliases',
+ $self->export_username($new),
+ [ split(/\s*,\s*/, $new->cgp_aliases) ],
+ );
+ return $error if $error;
+ }
+
#XXX preferences phase 1: message delete method, on logout remove trash
#phase 2: language, time zone, layout, pronto style, send read receipts
@@ -395,6 +420,17 @@ sub export_getsettings_svc_acct {
keys(%$prefs)
);
+ #aliases too
+
+ my $aliases = eval { $self->communigate_pro_runcommand(
+ 'GetAccountAliases',
+ $svc_acct->email
+ ) };
+ return $@ if $@;
+
+ $effective_settings->{'Aliases'} = join(', ', @$aliases);
+ $settings->{'Aliases'} = join(', ', @$aliases);
+
#false laziness w/above
my %defaults = map { $_ => 1 }
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 088ccd472..54d443c80 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -1100,6 +1100,7 @@ sub check {
|| $self->ut_enum( 'password_recover', [ '', 'Y' ] )
|| $self->ut_textn( 'cgp_accessmodes' )
|| $self->ut_alphan( 'cgp_type' )
+ || $self->ut_textn( 'cgp_aliases' ) #well
;
return $error if $error;