[freeside-commits] freeside/FS/FS svc_acct.pm, 1.300, 1.301 acct_snarf.pm, 1.4, 1.5
Ivan,,,
ivan at wavetail.420.am
Sat Aug 7 03:11:45 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv15605/FS/FS
Modified Files:
svc_acct.pm acct_snarf.pm
Log Message:
communigate phase 3: RPOP/acct_snarf, RT#7515
Index: acct_snarf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/acct_snarf.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- acct_snarf.pm 7 Aug 2010 07:39:05 -0000 1.4
+++ acct_snarf.pm 7 Aug 2010 10:11:42 -0000 1.5
@@ -3,7 +3,8 @@
use strict;
use vars qw( @ISA );
use Tie::IxHash;
-use FS::Record;
+use FS::Record qw( qsearchs );
+use FS::cust_svc;
@ISA = qw( FS::Record );
@@ -91,6 +92,37 @@
# the replace method can be inherited from FS::Record
+=item cust_svc
+
+=cut
+
+sub cust_svc {
+ my $self = shift;
+ qsearchs('cust_svc', { 'svcnum' => $self->svcnum } );
+}
+
+
+=item svc_export
+
+Calls the replace export for any communigate exports attached to this rule's
+service.
+
+=cut
+
+sub svc_export {
+ my $self = shift;
+
+ my $cust_svc = $self->cust_svc;
+ my $svc_x = $cust_svc->svc_x;
+
+ #_singledomain too
+ my @exports = $cust_svc->part_svc->part_export('communigate_pro');
+ my @errors = map $_->export_replace($svc_x, $svc_x), @exports;
+
+ @errors ? join(' / ', @errors) : '';
+
+}
+
=item check
Checks all fields to make sure this is a valid external mail account. If
@@ -149,6 +181,26 @@
\%hash;
}
+=item cgp_hashref
+
+Returns a hashref representing this external mail account, suitable for
+Communigate Pro API commands:
+
+=cut
+
+sub cgp_hashref {
+ my $self = shift;
+ {
+ 'authName' => $self->username,
+ 'domain' => $self->machine,
+ 'password' => $self->_password,
+ 'period' => $self->check_freq.'s',
+ 'APOP' => ( $self->apop eq 'Y' ? 'YES' : 'NO' ),
+ 'TLS' => ( $self->tls eq 'Y' ? 'YES' : 'NO' ),
+ 'Leave' => ( $self->leave eq 'Y' ? 'YES' : 'NO' ), #XXX leave??
+ };
+}
+
=back
=head1 BUGS
Index: svc_acct.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_acct.pm,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -w -d -r1.300 -r1.301
--- svc_acct.pm 6 Aug 2010 21:31:04 -0000 1.300
+++ svc_acct.pm 7 Aug 2010 10:11:42 -0000 1.301
@@ -47,6 +47,7 @@
use FS::svc_forward;
use FS::svc_www;
use FS::cdr;
+use FS::acct_snarf;
$DEBUG = 0;
$me = '[FS::svc_acct]';
@@ -1929,17 +1930,27 @@
=item acct_snarf
Returns an array of FS::acct_snarf records associated with the account.
-If the acct_snarf table does not exist or there are no associated records,
-an empty list is returned
=cut
sub acct_snarf {
my $self = shift;
- return () unless dbdef->table('acct_snarf');
- eval "use FS::acct_snarf;";
- die $@ if $@;
- qsearch('acct_snarf', { 'svcnum' => $self->svcnum } );
+ qsearch({
+ 'table' => 'acct_snarf',
+ 'hashref' => { 'svcnum' => $self->svcnum },
+ #'order_by' => 'ORDER BY priority ASC',
+ });
+}
+
+=item cgp_rpop_hashref
+
+Returns an arrayref of RPOP data suitable for Communigate Pro API commands.
+
+=cut
+
+sub cgp_rpop_hashref {
+ my $self = shift;
+ { map { $_->snarfname => $_->cgp_hashref } $self->acct_snarf };
}
=item decrement_upbytes OCTETS
More information about the freeside-commits
mailing list