[freeside-commits] freeside/FS/FS/part_export communigate_pro.pm, 1.32, 1.33
Ivan,,,
ivan at wavetail.420.am
Sat May 22 18:59:21 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv13392/FS/FS/part_export
Modified Files:
communigate_pro.pm
Log Message:
communigate pro rules, RT#7515
Index: communigate_pro.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/communigate_pro.pm,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -d -r1.32 -r1.33
--- communigate_pro.pm 20 Apr 2010 04:13:34 -0000 1.32
+++ communigate_pro.pm 23 May 2010 01:59:19 -0000 1.33
@@ -135,6 +135,15 @@
if $alias_err;
}
+ my $rule_error = $self->communigate_pro_queue(
+ $svc_acct->svcnum,
+ 'SetAccountMailRules',
+ $self->export_username($svc_acct),
+ $svc_acct->cgp_rule_arrayref,
+ );
+ warn "WARNING: error queueing SetAccountMailRules job: $rule_error"
+ if $rule_error;
+
'';
}
@@ -204,6 +213,15 @@
warn "WARNING: error queueing SetAccountDefaultPrefs job: $pref_err"
if $pref_err;
+ my $rule_error = $self->communigate_pro_queue(
+ $svc_domain->svcnum,
+ 'SetDomainMailRules',
+ $svc_domain->domain,
+ $svc_domain->cgp_rule_arrayref,
+ );
+ warn "WARNING: error queueing SetDomainMailRules job: $rule_error"
+ if $rule_error;
+
'';
}
@@ -349,6 +367,15 @@
return $error if $error;
}
+ my $rule_error = $self->communigate_pro_queue(
+ $new->svcnum,
+ 'SetAccountMailRules',
+ $self->export_username($new),
+ $new->cgp_rule_arrayref,
+ );
+ warn "WARNING: error queueing SetAccountMailRules job: $rule_error"
+ if $rule_error;
+
'';
}
@@ -429,6 +456,15 @@
warn "WARNING: error queueing SetAccountDefaultPrefs job: $pref_err"
if $pref_err;
+ my $rule_error = $self->communigate_pro_queue(
+ $new->svcnum,
+ 'SetDomainMailRules',
+ $new->domain,
+ $new->cgp_rule_arrayref,
+ );
+ warn "WARNING: error queueing SetDomainMailRules job: $rule_error"
+ if $rule_error;
+
'';
}
@@ -655,24 +691,11 @@
) };
return $@ if $@;
- %$effective_settings = (
- %$effective_settings,
- ( map { ("Acct. Default $_" => $acct_defaults->{$_}); }
- keys(%$acct_defaults)
- ),
- ( map { ("Acct. Default $_" => $acct_defaultprefs->{$_}); } #diff label??
- keys(%$acct_defaultprefs)
- ),
- );
- %$settings = (
- %$settings,
- ( map { ("Acct. Default $_" => $acct_defaults->{$_}); }
- keys(%$acct_defaults)
- ),
- ( map { ("Acct. Default $_" => $acct_defaultprefs->{$_}); } #diff label??
- keys(%$acct_defaultprefs)
- ),
- );
+ my $rules = eval { $self->communigate_pro_runcommand(
+ 'GetDomainMailRules',
+ $svc_domain->domain
+ ) };
+ return $@ if $@;
#aliases too
my $aliases = eval { $self->communigate_pro_runcommand(
@@ -681,9 +704,19 @@
) };
return $@ if $@;
- $effective_settings->{'Aliases'} = join(', ', @$aliases);
- $settings->{'Aliases'} = join(', ', @$aliases);
+ my %more = (
+ ( map { ("Acct. Default $_" => $acct_defaults->{$_}); }
+ keys(%$acct_defaults)
+ ),
+ ( map { ("Acct. Default $_" => $acct_defaultprefs->{$_}); } #diff label??
+ keys(%$acct_defaultprefs)
+ ),
+ ( map _rule2string($_), @$rules ),
+ 'Aliases' => join(', ', @$aliases),
+ );
+ %$effective_settings = ( %$effective_settings, %more );
+ %$settings = ( %$settings, %more );
#false laziness w/below
@@ -750,8 +783,21 @@
keys(%$prefs)
);
- #aliases too
+ #mail rules
+ my $rules = eval { $self->communigate_pro_runcommand(
+ 'GetAccountMailRules',
+ $svc_acct->email
+ ) };
+ return $@ if $@;
+
+ %$effective_settings = ( %$effective_settings,
+ map _rule2string($_), @$rules
+ );
+ %$settings = ( %$settings,
+ map _rule2string($_), @$rules
+ );
+ #aliases too
my $aliases = eval { $self->communigate_pro_runcommand(
'GetAccountAliases',
$svc_acct->email
@@ -785,6 +831,14 @@
}
+sub _rule2string {
+ my $rule = shift;
+ my($priority, $name, $conditions, $actions, $comment) = @$rule;
+ $conditions = join(', ', map { my $a = $_; join(' ', @$a); } @$conditions);
+ $actions = join(', ', map { my $a = $_; join(' ', @$a); } @$actions);
+ ("Mail rule $name" => "$priority IF $conditions THEN $actions ($comment)");
+}
+
sub export_getsettings_svc_mailinglist {
my($self, $svc_mailinglist, $settingsref, $defaultref ) = @_;
More information about the freeside-commits
mailing list