[freeside-commits] freeside/FS/FS/part_export communigate_pro.pm, 1.21, 1.22
Ivan,,,
ivan at wavetail.420.am
Sun Feb 21 14:54:12 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv11125/FS/FS/part_export
Modified Files:
communigate_pro.pm
Log Message:
communigate forwarders, RT#7083
Index: communigate_pro.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/communigate_pro.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- communigate_pro.pm 21 Feb 2010 09:19:05 -0000 1.21
+++ communigate_pro.pm 21 Feb 2010 22:54:09 -0000 1.22
@@ -94,7 +94,6 @@
#let's do the create realtime too, for much the same reasons, and to avoid
#pain of trying to queue w/dep the prefs & aliases
- #my $r=
eval { $self->communigate_pro_runcommand( @options ) };
return $@ if $@;
@@ -142,8 +141,18 @@
$self->communigate_pro_queue( @options );
}
-#sub _export_insert_svc_forward {
-#}
+sub _export_insert_svc_forward {
+ my( $self, $svc_forward ) = (shift, shift);
+
+ my $src = $svc_forward->src || $svc_forward->srcsvc_acct->email;
+ my $dst = $svc_forward->dst || $svc_forward->dstsvc_acct->email;
+
+ #real-time here, presuming CGP does some dup detection?
+ eval { $self->communigate_pro_runcommand( 'CreateForwarder', $src, $dst); };
+ return $@ if $@;
+
+ '';
+}
sub _export_replace {
my( $self, $new, $old ) = (shift, shift, shift);
@@ -160,7 +169,6 @@
#w/dependencies. we don't want FS winding up out-of-sync with the wrong
#username and a queued job anyway. right??
if ( $self->export_username($old) ne $self->export_username($new) ) {
- #my $r =
eval { $self->communigate_pro_runcommand(
'RenameAccount',
$self->export_username($old),
@@ -258,6 +266,35 @@
'';
}
+sub _export_replace_svc_forward {
+ my( $self, $new, $old ) = (shift, shift, shift);
+
+ my $osrc = $old->src || $old->srcsvc_acct->email;
+ my $nsrc = $new->src || $new->srcsvc_acct->email;
+ my $odst = $old->dst || $old->dstsvc_acct->email;
+ my $ndst = $new->dst || $new->dstsvc_acct->email;
+
+ if ( $odst ne $ndst ) {
+
+ #no change command, so delete and create (real-time)
+ eval { $self->communigate_pro_runcommand('DeleteForwarder', $osrc) };
+ return $@ if $@;
+ eval { $self->communigate_pro_runcommand('CreateForwarder', $nsrc, $ndst)};
+ return $@ if $@;
+
+ } elsif ( $osrc ne $nsrc ) {
+
+ #real-time here, presuming CGP does some dup detection?
+ eval { $self->communigate_pro_runcommand( 'RenameForwarder', $osrc, $nsrc)};
+ return $@ if $@;
+
+ } else {
+ warn "communigate replace called for svc_forward with no changes\n";#confess
+ }
+
+ '';
+}
+
sub _export_delete {
my( $self, $svc_x ) = (shift, shift);
@@ -272,7 +309,6 @@
$self->communigate_pro_queue( $svc_acct->svcnum, 'DeleteAccount',
$self->export_username($svc_acct),
);
-
}
sub _export_delete_svc_domain {
@@ -282,7 +318,14 @@
$svc_domain->domain,
#XXX turn on force option for domain deletion?
);
+}
+sub _export_delete_svc_forward {
+ my( $self, $svc_forward ) = (shift, shift);
+
+ $self->communigate_pro_queue( $svc_forward->svcnum, 'DeleteForwarder',
+ ($svc_forward->src || $svc_forward->srcsvc_acct->email),
+ );
}
sub _export_suspend {
@@ -597,7 +640,7 @@
#warn "$method ". Dumper(@args) if $DEBUG;
my $return = $cli->$method(@args)
- or die "Communigate Pro error: ". $cli->getErrMessage;
+ or die "Communigate Pro error: ". $cli->getErrMessage. "\n";
$cli->Logout; # or die "Can't logout of CGPro: $CGP::ERR_STRING\n";
More information about the freeside-commits
mailing list