[freeside-commits] freeside/FS/FS svc_mailinglist.pm, 1.2, 1.3 mailinglistmember.pm, 1.2, 1.3 mailinglist.pm, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Tue Mar 23 02:13:34 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv29313/FS/FS

Modified Files:
	svc_mailinglist.pm mailinglistmember.pm mailinglist.pm 
Log Message:
export svc_mailinglist to CGP groups, RT#7514

Index: mailinglist.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/mailinglist.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- mailinglist.pm	23 Mar 2010 03:48:30 -0000	1.2
+++ mailinglist.pm	23 Mar 2010 09:13:32 -0000	1.3
@@ -2,8 +2,9 @@
 
 use strict;
 use base qw( FS::Record );
-use FS::Record qw( qsearch dbh ); # qsearchs );
+use FS::Record qw( qsearch qsearchs dbh );
 use FS::mailinglistmember;
+use FS::svc_mailinglist;
 
 =head1 NAME
 
@@ -148,6 +149,15 @@
   qsearch('mailinglistmember', { 'listnum' => $self->listnum } );
 }
 
+=item svc_mailinglist
+
+=cut
+
+sub svc_mailinglist {
+  my $self = shift;
+  qsearchs('svc_mailinglist', { 'listnum' => $self->listnum } );
+}
+
 =back
 
 =head1 BUGS

Index: svc_mailinglist.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_mailinglist.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- svc_mailinglist.pm	23 Mar 2010 03:48:30 -0000	1.2
+++ svc_mailinglist.pm	23 Mar 2010 09:13:32 -0000	1.3
@@ -2,6 +2,7 @@
 
 use strict;
 use base qw( FS::svc_Domain_Mixin FS::svc_Common );
+use Scalar::Util qw( blessed );
 use FS::Record qw( qsearchs dbh ); # qsearch );
 use FS::svc_domain;
 use FS::mailinglist;
@@ -160,7 +161,6 @@
       $dbh->rollback if $oldAutoCommit;
       return $error;
     }
-    warn $mailinglist->listnum;
     $self->listnum($mailinglist->listnum);
   #}
 

Index: mailinglistmember.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/mailinglistmember.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- mailinglistmember.pm	23 Mar 2010 03:48:30 -0000	1.2
+++ mailinglistmember.pm	23 Mar 2010 09:13:32 -0000	1.3
@@ -2,7 +2,8 @@
 
 use strict;
 use base qw( FS::Record );
-use FS::Record qw( qsearchs ); # qsearch );
+use Scalar::Util qw( blessed );
+use FS::Record qw( dbh qsearchs ); # qsearch );
 use FS::mailinglist;
 use FS::svc_acct;
 use FS::contact_email;
@@ -82,7 +83,30 @@
 
 =cut
 
-# the insert method can be inherited from FS::Record
+sub insert {
+  my $self = shift;
+
+  local $SIG{HUP} = 'IGNORE';
+  local $SIG{INT} = 'IGNORE';
+  local $SIG{QUIT} = 'IGNORE';
+  local $SIG{TERM} = 'IGNORE';
+  local $SIG{TSTP} = 'IGNORE';
+  local $SIG{PIPE} = 'IGNORE';
+
+  my $oldAutoCommit = $FS::UID::AutoCommit;
+  local $FS::UID::AutoCommit = 0;
+  my $dbh = dbh;
+
+  my $error =    $self->SUPER::insert
+              || $self->export('mailinglistmember_insert');
+  if ( $error ) {
+    $dbh->rollback if $oldAutoCommit;
+    return $error;
+  }
+
+  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+  '';
+}
 
 =item delete
 
@@ -90,7 +114,30 @@
 
 =cut
 
-# the delete method can be inherited from FS::Record
+sub delete {
+  my $self = shift;
+
+  local $SIG{HUP} = 'IGNORE';
+  local $SIG{INT} = 'IGNORE';
+  local $SIG{QUIT} = 'IGNORE';
+  local $SIG{TERM} = 'IGNORE';
+  local $SIG{TSTP} = 'IGNORE';
+  local $SIG{PIPE} = 'IGNORE';
+
+  my $oldAutoCommit = $FS::UID::AutoCommit;
+  local $FS::UID::AutoCommit = 0;
+  my $dbh = dbh;
+
+  my $error =    $self->SUPER::delete
+              || $self->export('mailinglistmember_delete');
+  if ( $error ) {
+    $dbh->rollback if $oldAutoCommit;
+    return $error;
+  }
+
+  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+  '';
+}
 
 =item replace OLD_RECORD
 
@@ -99,7 +146,34 @@
 
 =cut
 
-# the replace method can be inherited from FS::Record
+sub replace {
+  my $new = shift;
+
+  my $old = ( blessed($_[0]) && $_[0]->isa('FS::Record') )
+              ? shift
+              : $new->replace_old;
+
+  local $SIG{HUP} = 'IGNORE';
+  local $SIG{INT} = 'IGNORE';
+  local $SIG{QUIT} = 'IGNORE';
+  local $SIG{TERM} = 'IGNORE';
+  local $SIG{TSTP} = 'IGNORE';
+  local $SIG{PIPE} = 'IGNORE';
+
+  my $oldAutoCommit = $FS::UID::AutoCommit;
+  local $FS::UID::AutoCommit = 0;
+  my $dbh = dbh;
+
+  my $error =    $new->SUPER::replace($old)
+              || $new->export('mailinglistmember_replace', $old);
+  if ( $error ) {
+    $dbh->rollback if $oldAutoCommit;
+    return $error;
+  }
+
+  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+  '';
+}
 
 =item check
 
@@ -136,6 +210,27 @@
   qsearchs('mailinglist', { 'listnum' => $self->listnum } );
 }
 
+=item email_address
+
+=cut
+
+sub email_address {
+  my $self = shift;
+  #XXX svcnum, contactemailnum
+  $self->email;
+}
+
+=item export
+
+=cut
+
+sub export {
+  my( $self, $method ) = ( shift, shift );
+  my $svc_mailinglist = $self->mailinglist->svc_mailinglist
+    or return '';
+  $svc_mailinglist->export($method, $self, @_);
+}
+
 =back
 
 =head1 BUGS



More information about the freeside-commits mailing list