summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_export/communigate_pro.pm35
-rw-r--r--FS/FS/part_svc.pm11
-rw-r--r--FS/FS/svc_acct.pm17
3 files changed, 55 insertions, 8 deletions
diff --git a/FS/FS/part_export/communigate_pro.pm b/FS/FS/part_export/communigate_pro.pm
index 90283d2ae..11cf88f54 100644
--- a/FS/FS/part_export/communigate_pro.pm
+++ b/FS/FS/part_export/communigate_pro.pm
@@ -152,10 +152,11 @@ sub _export_replace_svc_acct {
if $old->finger ne $new->finger;
$settings{$quotas{$_}} = $new->$_()
foreach grep $old->$_() ne $new->$_(), keys %quotas;
- $settings{'AccessModes'} = $new->cgp_accessmodes
- if $old->cgp_accessmodes ne $new->cgp_accessmodes;
$settings{'accountType'} = $new->cgp_type
if $old->cgp_type ne $new->cgp_type;
+ $settings{'AccessModes'} = $new->cgp_accessmodes
+ if $old->cgp_accessmodes ne $new->cgp_accessmodes
+ || $old->cgp_type ne $new->cgp_type;
#phase 2: pwdallowed, passwordrecovery, allowed mail rules,
# RPOP modifications, accepts mail to all, add trailer to sent mail
@@ -276,7 +277,8 @@ sub _export_unsuspend_svc_acct {
$svc_acct->svcnum,
'UpdateAccountSettings',
$self->export_username($svc_acct),
- 'AccessModes' => $self->option('AccessModes'),
+ 'AccessModes' => ( $svc_acct->cgp_accessmodes
+ || $self->option('AccessModes') ),
);
}
@@ -338,7 +340,7 @@ sub export_getsettings_svc_domain {
{
my $value = $effective_settings->{$key};
if ( ref($value) eq 'ARRAY' ) {
- $effective_settings->{$key} = join(', ', @$value);
+ $effective_settings->{$key} = join(' ', @$value);
} else {
#XXX
warn "serializing ". ref($value). " for table display not yet handled";
@@ -370,7 +372,28 @@ sub export_getsettings_svc_acct {
delete($effective_settings->{'Password'});
- #XXX prefs/effectiveprefs too
+ #prefs/effectiveprefs too
+
+ my $prefs = eval { $self->communigate_pro_runcommand(
+ 'GetAccountPrefs',
+ $svc_acct->email
+ ) };
+ return $@ if $@;
+
+ my $effective_prefs = eval { $self->communigate_pro_runcommand(
+ 'GetAccountEffectivePrefs',
+ $svc_acct->email
+ ) };
+ return $@ if $@;
+
+ %$effective_settings = ( %$effective_settings,
+ map { ("Pref $_" => $effective_prefs->{$_}); }
+ keys(%$effective_prefs)
+ );
+ %$settings = ( %$settings,
+ map { ("Pref $_" => $prefs->{$_}); }
+ keys(%$prefs)
+ );
#false laziness w/above
@@ -382,7 +405,7 @@ sub export_getsettings_svc_acct {
{
my $value = $effective_settings->{$key};
if ( ref($value) eq 'ARRAY' ) {
- $effective_settings->{$key} = join(', ', @$value);
+ $effective_settings->{$key} = join(' ', @$value);
} else {
#XXX
warn "serializing ". ref($value). " for table display not yet handled";
diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm
index db39ea9ae..3ed153e0c 100644
--- a/FS/FS/part_svc.pm
+++ b/FS/FS/part_svc.pm
@@ -724,7 +724,18 @@ sub process {
ref($param->{'svc_acct__usergroup'})
? join(',', @{$param->{'svc_acct__usergroup'}} )
: $param->{'svc_acct__usergroup'};
+
+ #unmunge cgp_accessmodes (falze laziness-ish w/edit/process/svc_acct.cgi)
+ $param->{'svc_acct__cgp_accessmodes'} ||=
+ join(' ', sort
+ grep { $_ !~ /^(flag|label)$/ }
+ map { /^svc_acct__cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; }
+ grep $param->{$_},
+ grep /^svc_acct__cgp_accessmodes_([\w\/]+)$/,
+ keys %$param
+ );
+
my $new = new FS::part_svc ( {
map {
$_ => $param->{$_};
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 181628715..088ccd472 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -271,8 +271,21 @@ sub table_info {
disable_fixed => 1,
disable_select => 1,
},
+ 'cgp_type'=> {
+ label => 'Communigate account type',
+ type => 'select',
+ select_list => [ ],
+ disable_inventory => 1,
+ disable_select => 1,
+ },
+ 'cgp_accessmodes' => {
+ label => 'Communigate enabled services',
+ type => 'communigate_pro-accessmodes',
+ disable_inventory => 1,
+ disable_select => 1,
+ },
'quota' => {
- label => 'Quota',
+ label => 'Quota', #Mail storage limit
type => 'text',
disable_inventory => 1,
disable_select => 1,
@@ -1085,7 +1098,7 @@ sub check {
)
|| $self->ut_enum( 'password_selfchange', [ '', 'Y' ] )
|| $self->ut_enum( 'password_recover', [ '', 'Y' ] )
- || $self->ut_alphasn( 'cgp_accessmodes' )
+ || $self->ut_textn( 'cgp_accessmodes' )
|| $self->ut_alphan( 'cgp_type' )
;
return $error if $error;