From 8a8c9386cbd3383b0134aae8e32b5995f8886fb2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 19 Aug 2001 15:53:36 +0000 Subject: [PATCH 1/1] added user interface for svc_forward and vpopmail support --- FS/FS/cust_svc.pm | 12 +- FS/FS/svc_acct.pm | 21 ++- FS/FS/svc_forward.pm | 5 +- FS/MANIFEST | 2 + httemplate/edit/part_svc.cgi | 18 ++- httemplate/edit/process/svc_forward.cgi | 51 +++++++ httemplate/edit/svc_acct.cgi | 27 +++- httemplate/edit/svc_forward.cgi | 242 ++++++++++++++++++++++++++++++++ httemplate/misc/catchall.cgi | 157 +++++++++++++++++++++ httemplate/misc/process/catchall.cgi | 55 ++++++++ httemplate/search/svc_acct.cgi | 9 +- httemplate/search/svc_domain.cgi | 117 ++++++++------- httemplate/view/svc_acct.cgi | 15 +- httemplate/view/svc_domain.cgi | 19 ++- httemplate/view/svc_forward.cgi | 91 ++++++++++++ 15 files changed, 766 insertions(+), 75 deletions(-) create mode 100755 httemplate/edit/process/svc_forward.cgi create mode 100755 httemplate/edit/svc_forward.cgi create mode 100755 httemplate/misc/catchall.cgi create mode 100755 httemplate/misc/process/catchall.cgi create mode 100755 httemplate/view/svc_forward.cgi diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index cbc4d91fa..3a83679fb 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -10,6 +10,7 @@ use FS::part_svc; use FS::svc_acct; use FS::svc_acct_sm; use FS::svc_domain; +use FS::svc_forward; @ISA = qw( FS::Record ); @@ -131,6 +132,15 @@ sub label { my $svc_domain = qsearchs ( 'svc_domain', { 'svcnum' => $svc_x->domsvc } ); my $domain = $svc_domain->domain; $tag = "$domuser\@$domain"; + } elsif ( $svcdb eq 'svc_forward' ) { + my $svc_acct = qsearchs ( 'svc_acct', { 'svcnum' => $svc_x->srcsvc } ); + $tag = $svc_acct->email . '->'; + if ($svc_x->dstsvc) { + $svc_acct = qsearchs ( 'svc_acct', { 'svcnum' => $svc_x->dstsvc } ); + $tag .= $svc_acct->email; + }else{ + $tag .= $svc_x->dst; + } } elsif ( $svcdb eq 'svc_domain' ) { $tag = $svc_x->getfield('domain'); } else { @@ -144,7 +154,7 @@ sub label { =head1 VERSION -$Id: cust_svc.pm,v 1.1 1999-08-04 09:03:53 ivan Exp $ +$Id: cust_svc.pm,v 1.2 2001-08-19 15:53:34 jeff Exp $ =head1 BUGS diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 253d56c40..42eb7d9ee 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -551,11 +551,30 @@ sub radius_check { } grep { /^rc_/ && $self->getfield($_) } fields( $self->table ); } +=item email + +Returns an email address associated with the account. + +=cut + +sub email { + my $self = shift; + my $domain; + my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $self->domsvc } ); + if ($svc_domain) { + $domain=$svc_domain->domain; + }else{ + warn "couldn't find svc_acct.domsvc " . $self->domsvc . "!"; + $domain="unknown"; + } + return $self->username . "@" . $domain; +} + =back =head1 VERSION -$Id: svc_acct.pm,v 1.23 2001-08-19 08:18:01 ivan Exp $ +$Id: svc_acct.pm,v 1.24 2001-08-19 15:53:34 jeff Exp $ =head1 BUGS diff --git a/FS/FS/svc_forward.pm b/FS/FS/svc_forward.pm index 5264a60b1..db9180dbf 100644 --- a/FS/FS/svc_forward.pm +++ b/FS/FS/svc_forward.pm @@ -223,9 +223,8 @@ sub check { } if ($recref->{dst}) { - $recref->{dst} =~ /^(\w\.\-]+)\@(([\w\.\-]+\.)+\w+)$/ + $recref->{dst} =~ /^([\w\.\-]+)\@(([\w\.\-]+\.)+\w+)$/ or return "Illegal dst"; - $recref->{dst} = $1; } ''; #no error @@ -235,7 +234,7 @@ sub check { =head1 VERSION -$Id: svc_forward.pm,v 1.2 2001-08-12 19:41:24 jeff Exp $ +$Id: svc_forward.pm,v 1.3 2001-08-19 15:53:35 jeff Exp $ =head1 BUGS diff --git a/FS/MANIFEST b/FS/MANIFEST index 15245b8d4..fa51b21b6 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -40,8 +40,10 @@ Makefile.PL test.pl README bin/freeside-bill +bin/freeside-email bin/freeside-print-batch FS/domain_record.pm FS/prepay_credit.pm FS/svc_www.pm FS/CGIwrapper.pm +FS/svc_forward.pm diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 7fadf000f..b8715fb49 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ - + <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -51,7 +51,8 @@ Service Services are items you offer to your customers.