diff options
-rw-r--r-- | FS/FS.pm | 2 | ||||
-rw-r--r-- | FS/FS/InitHandler.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 14 | ||||
-rw-r--r-- | FS/FS/part_export.pm | 2 | ||||
-rw-r--r-- | FS/FS/part_svc.pm | 27 | ||||
-rw-r--r-- | FS/FS/svc_acct.pm | 9 | ||||
-rw-r--r-- | FS/FS/svc_acct_sm.pm | 260 | ||||
-rw-r--r-- | FS/MANIFEST | 2 | ||||
-rw-r--r-- | FS/t/svc_acct_sm.t | 5 | ||||
-rw-r--r-- | httemplate/docs/schema.dia | bin | 14414 -> 14438 bytes | |||
-rw-r--r-- | httemplate/docs/schema.html | 9 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 8 | ||||
-rwxr-xr-x | httemplate/edit/process/part_svc.cgi | 2 | ||||
-rwxr-xr-x | httemplate/edit/process/svc_acct_sm.cgi | 34 | ||||
-rwxr-xr-x | httemplate/edit/svc_acct_sm.cgi | 178 | ||||
-rw-r--r-- | httemplate/index.html | 1 | ||||
-rwxr-xr-x | httemplate/misc/link.cgi | 1 | ||||
-rwxr-xr-x | httemplate/search/svc_acct_sm.cgi | 84 | ||||
-rwxr-xr-x | httemplate/search/svc_acct_sm.html | 23 | ||||
-rwxr-xr-x | httemplate/search/svc_domain.cgi | 12 | ||||
-rwxr-xr-x | httemplate/view/svc_acct_sm.cgi | 58 |
21 files changed, 12 insertions, 720 deletions
@@ -62,8 +62,6 @@ L<FS::domain_record> - DNS zone entries L<FS::svc_forward> - Mail forwarding class -L<FS::svc_acct_sm> - (Depreciated) Vitual mail alias class - L<FS::svc_www> - Web virtual host class. L<FS::part_svc> - Service definition class diff --git a/FS/FS/InitHandler.pm b/FS/FS/InitHandler.pm index 0216615da..5038cf352 100644 --- a/FS/FS/InitHandler.pm +++ b/FS/FS/InitHandler.pm @@ -52,7 +52,6 @@ sub handler { use FS::session; use FS::svc_acct; use FS::svc_acct_pop; - use FS::svc_acct_sm; use FS::svc_domain; use FS::svc_forward; use FS::svc_www; diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 12508e1aa..0c71435e1 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -14,7 +14,6 @@ use FS::pkg_svc; # setup } # because they load configuraion by setting FS::UID::callback (see TODO) use FS::svc_acct; -use FS::svc_acct_sm; use FS::svc_domain; use FS::svc_www; use FS::svc_forward; @@ -679,7 +678,7 @@ sub order { =head1 VERSION -$Id: cust_pkg.pm,v 1.23 2002-08-26 20:40:55 ivan Exp $ +$Id: cust_pkg.pm,v 1.24 2002-09-17 09:19:06 ivan Exp $ =head1 BUGS @@ -690,11 +689,12 @@ In sub order, the @pkgparts array (passed by reference) is clobbered. Also in sub order, no money is adjusted. Once FS::part_pkg defines a standard method to pass dates to the recur_prog expression, it should do so. -FS::svc_acct, FS::svc_acct_sm, and FS::svc_domain are loaded via 'use' at -compile time, rather than via 'require' in sub { setup, suspend, unsuspend, -cancel } because they use %FS::UID::callback to load configuration values. -Probably need a subroutine which decides what to do based on whether or not -we've fetched the user yet, rather than a hash. See FS::UID and the TODO. +FS::svc_acct, FS::svc_domain, FS::svc_www and FS::svc_forward are loaded via +'use' at compile time, rather than via 'require' in sub +{ setup, suspend, unsuspend, cancel } because they use %FS::UID::callback to +load configuration values. Probably need a subroutine which decides what to +do based on whether or not we've fetched the user yet, rather than a hash. +See FS::UID and the TODO. Now that things are transactional should the check in the insert method be moved to check ? diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 69cd8058b..647666b86 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -819,8 +819,6 @@ tie my %sqlmail_options, 'Tie::IxHash', }, - 'svc_acct_sm' => {}, - 'svc_forward' => { 'sqlmail' => { 'desc' => 'Real-time export to SQL-backed mail server', diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 959a3f887..7c6acdbcd 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -254,31 +254,6 @@ sub check { my @fields = eval { fields( $recref->{svcdb} ) }; #might die return "Unknown svcdb!" unless @fields; -##REPLACED BY part_svc_column -# my $svcdb; -# foreach $svcdb ( qw( -# svc_acct svc_acct_sm svc_domain -# ) ) { -# my @rows = map { /^${svcdb}__(.*)$/; $1 } -# grep ! /_flag$/, -# grep /^${svcdb}__/, -# fields('part_svc'); -# foreach my $row (@rows) { -# unless ( $svcdb eq $recref->{svcdb} ) { -# $recref->{$svcdb.'__'.$row}=''; -# $recref->{$svcdb.'__'.$row.'_flag'}=''; -# next; -# } -# $recref->{$svcdb.'__'.$row.'_flag'} =~ /^([DF]?)$/ -# or return "Illegal flag for $svcdb $row"; -# $recref->{$svcdb.'__'.$row.'_flag'} = $1; -# -# my $error = $self->ut_anything($svcdb.'__'.$row); -# return $error if $error; -# -# } -# } - ''; #no error } @@ -325,7 +300,7 @@ sub part_export { =head1 VERSION -$Id: part_svc.pm,v 1.13 2002-04-11 22:05:31 ivan Exp $ +$Id: part_svc.pm,v 1.14 2002-09-17 09:19:06 ivan Exp $ =head1 BUGS diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index f73ab82da..bd348f8ed 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -18,11 +18,9 @@ use FS::UID qw( datasrc ); use FS::Conf; use FS::Record qw( qsearch qsearchs fields dbh ); use FS::svc_Common; -use Net::SSH; use FS::cust_svc; use FS::part_svc; use FS::svc_acct_pop; -use FS::svc_acct_sm; use FS::cust_main_invoice; use FS::svc_domain; use FS::raddb; @@ -410,11 +408,6 @@ The corresponding FS::cust_svc record will be deleted as well. sub delete { my $self = shift; - if ( defined( $FS::Record::dbdef->table('svc_acct_sm') ) ) { - return "Can't delete an account which has (svc_acct_sm) mail aliases!" - if $self->uid && qsearch( 'svc_acct_sm', { 'domuid' => $self->uid } ); - } - return "Can't delete an account which is a (svc_forward) source!" if qsearch( 'svc_forward', { 'srcsvc' => $self->svcnum } ); @@ -1148,7 +1141,7 @@ probably live somewhere else... L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface, export.html from the base documentation, L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>, -L<freeside-queued>), L<Net::SSH>, L<ssh>, L<FS::svc_acct_pop>, +L<freeside-queued>), L<FS::svc_acct_pop>, schema.html from the base documentation. =cut diff --git a/FS/FS/svc_acct_sm.pm b/FS/FS/svc_acct_sm.pm deleted file mode 100644 index c92f1421f..000000000 --- a/FS/FS/svc_acct_sm.pm +++ /dev/null @@ -1,260 +0,0 @@ -package FS::svc_acct_sm; - -use strict; -use vars qw( @ISA $nossh_hack $conf $shellmachine @qmailmachines ); -use FS::Record qw( fields qsearch qsearchs ); -use FS::svc_Common; -use FS::cust_svc; -use Net::SSH qw(ssh); -use FS::Conf; -use FS::svc_acct; -use FS::svc_domain; - -@ISA = qw( FS::svc_Common ); - -#ask FS::UID to run this stuff for us later -#$FS::UID::callback{'FS::svc_acct_sm'} = sub { -# $conf = new FS::Conf; -# $shellmachine = $conf->exists('qmailmachines') -# ? $conf->config('shellmachine') -# : ''; -#}; - -=head1 NAME - -FS::svc_acct_sm - Object methods for svc_acct_sm records - -=head1 SYNOPSIS - - use FS::svc_acct_sm; - - $record = new FS::svc_acct_sm \%hash; - $record = new FS::svc_acct_sm { 'column' => 'value' }; - - $error = $record->insert; - - $error = $new_record->replace($old_record); - - $error = $record->delete; - - $error = $record->check; - - $error = $record->suspend; - - $error = $record->unsuspend; - - $error = $record->cancel; - -=head1 WARNING - -FS::svc_acct_sm is B<depreciated>. This class is only included for migration -purposes. See L<FS::svc_forward>. - -=head1 DESCRIPTION - -An FS::svc_acct_sm object represents a virtual mail alias. FS::svc_acct_sm -inherits from FS::Record. The following fields are currently supported: - -=over 4 - -=item svcnum - primary key (assigned automatcially for new accounts) - -=item domsvc - svcnum of the virtual domain (see L<FS::svc_domain>) - -=item domuid - uid of the target account (see L<FS::svc_acct>) - -=item domuser - virtual username - -=back - -=head1 METHODS - -=over 4 - -=item new HASHREF - -Creates a new virtual mail alias. To add the virtual mail alias to the -database, see L<"insert">. - -=cut - -sub table { 'svc_acct_sm'; } - -=item insert - -Adds this virtual mail alias to the database. If there is an error, returns -the error, otherwise returns false. - -The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be -defined. An FS::cust_svc record will be created and inserted. - - #If the configuration values (see L<FS::Conf>) shellmachine and qmailmachines - #exist, and domuser is `*' (meaning a catch-all mailbox), the command: - # - # [ -e $dir/.qmail-$qdomain-default ] || { - # touch $dir/.qmail-$qdomain-default; - # chown $uid:$gid $dir/.qmail-$qdomain-default; - # } - # - #is executed on shellmachine via ssh (see L<dot-qmail/"EXTENSION ADDRESSES">). - #This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true. - -=cut - -sub insert { - my $self = shift; - my $error; - - local $SIG{HUP} = 'IGNORE'; - local $SIG{INT} = 'IGNORE'; - local $SIG{QUIT} = 'IGNORE'; - local $SIG{TERM} = 'IGNORE'; - local $SIG{TSTP} = 'IGNORE'; - local $SIG{PIPE} = 'IGNORE'; - - $error=$self->check; - return $error if $error; - - return "Domain username (domuser) in use for this domain (domsvc)" - if qsearchs('svc_acct_sm',{ 'domuser'=> $self->domuser, - 'domsvc' => $self->domsvc, - } ); - - return "First domain username (domuser) for domain (domsvc) must be " . - qq='*' (catch-all)!= - if $self->domuser ne '*' - && ! qsearch('svc_acct_sm',{ 'domsvc' => $self->domsvc } ) - && ! $conf->exists('maildisablecatchall'); - - $error = $self->SUPER::insert; - return $error if $error; - - #my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $self->domsvc } ); - #my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $self->domuid } ); - #my ( $uid, $gid, $dir, $domain ) = ( - # $svc_acct->uid, - # $svc_acct->gid, - # $svc_acct->dir, - # $svc_domain->domain, - #); - #my $qdomain = $domain; - #$qdomain =~ s/\./:/g; #see manpage for 'dot-qmail': EXTENSION ADDRESSES - #ssh("root\@$shellmachine","[ -e $dir/.qmail-$qdomain-default ] || { touch $dir/.qmail-$qdomain-default; chown $uid:$gid $dir/.qmail-$qdomain-default; }") - # if ( ! $nossh_hack && $shellmachine && $dir && $self->domuser eq '*' ); - - ''; #no error - -} - -=item delete - -Deletes this virtual mail alias from the database. If there is an error, -returns the error, otherwise returns false. - -The corresponding FS::cust_svc record will be deleted as well. - -=item replace OLD_RECORD - -Replaces OLD_RECORD with this one in the database. If there is an error, -returns the error, otherwise returns false. - -=cut - -sub replace { - my ( $new, $old ) = ( shift, shift ); - my $error; - - return "Domain username (domuser) in use for this domain (domsvc)" - if ( $old->domuser ne $new->domuser - || $old->domsvc != $new->domsvc - ) && qsearchs('svc_acct_sm',{ - 'domuser'=> $new->domuser, - 'domsvc' => $new->domsvc, - } ) - ; - - $new->SUPER::replace($old); - -} - -=item suspend - -Just returns false (no error) for now. - -Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>). - -=item unsuspend - -Just returns false (no error) for now. - -Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>). - -=item cancel - -Just returns false (no error) for now. - -Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>). - -=item check - -Checks all fields to make sure this is a valid virtual mail alias. If there is -an error, returns the error, otherwise returns false. Called by the insert and -replace methods. - -Sets any fixed values; see L<FS::part_svc>. - -=cut - -sub check { - my $self = shift; - my $error; - - my $x = $self->setfixed; - return $x unless ref($x); - #my $part_svc = $x; - - my($recref) = $self->hashref; - - $recref->{domuser} =~ /^(\*|[a-z0-9_\-]{2,32})$/ - or return "Illegal domain username (domuser)"; - $recref->{domuser} = $1; - - $recref->{domsvc} =~ /^(\d+)$/ or return "Illegal domsvc"; - $recref->{domsvc} = $1; - my($svc_domain); - return "Unknown domsvc" unless - $svc_domain=qsearchs('svc_domain',{'svcnum'=> $recref->{domsvc} } ); - - $recref->{domuid} =~ /^(\d+)$/ or return "Illegal uid"; - $recref->{domuid} = $1; - my($svc_acct); - return "Unknown uid" unless - $svc_acct=qsearchs('svc_acct',{'uid'=> $recref->{domuid} } ); - - ''; #no error -} - -=back - -=head1 VERSION - -$Id: svc_acct_sm.pm,v 1.5 2001-09-06 20:41:59 ivan Exp $ - -=head1 BUGS - -The remote commands should be configurable. - -The $recref stuff in sub check should be cleaned up. - -=head1 SEE ALSO - -L<FS::svc_forward> - -L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, -L<FS::svc_acct>, L<FS::svc_domain>, L<Net::SSH>, L<ssh>, L<dot-qmail>, -schema.html from the base documentation. - -=cut - -1; - diff --git a/FS/MANIFEST b/FS/MANIFEST index 4a250d77b..3cf4c2ba3 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -87,7 +87,6 @@ FS/pkg_svc.pm FS/svc_Common.pm FS/svc_acct.pm FS/svc_acct_pop.pm -FS/svc_acct_sm.pm FS/svc_broadband.pm FS/svc_domain.pm FS/type_pkgs.pm @@ -165,7 +164,6 @@ t/radius_usergroup.t t/session.t t/svc_acct.t t/svc_acct_pop.t -t/svc_acct_sm.t t/svc_Common.t t/svc_domain.t t/svc_forward.t diff --git a/FS/t/svc_acct_sm.t b/FS/t/svc_acct_sm.t deleted file mode 100644 index 1082f2cdb..000000000 --- a/FS/t/svc_acct_sm.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n" } -END {print "not ok 1\n" unless $loaded;} -use FS::svc_acct_sm; -$loaded=1; -print "ok 1\n"; diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia Binary files differindex 092d2f88b..c0842a602 100644 --- a/httemplate/docs/schema.dia +++ b/httemplate/docs/schema.dia diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 2b8b3a132..54adec3a7 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -248,7 +248,7 @@ <ul> <li>svcpart - primary key <li>svc - name of this service - <li>svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo + <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo <li>disabled - Disabled flag, empty or `Y' <!-- <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i> <li><i>table</i>__<i>field</i>_flag - null, D or F @@ -347,13 +347,6 @@ <li>npa - area code <li>nxx - exchange </ul> - <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases - <ul> - <li>svcnum - <a href="#cust_svc">primary key</a> - <li>domsvc - <a href="#svc_domain">Domain</a> (by svcnum) - <li>domuid - <a href="#svc_acct">Account</a> (by uid) - <li>domuser - domuser @ <a href="#svc_domain">Domain</a> forwards to <a href="#svc_acct">Account</a> - </ul> <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains <ul> <li>svcnum - <a href="#cust_svc">primary key</a> diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index a23107a40..b2862f5a3 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -50,7 +50,6 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<%= $hashref- Services are items you offer to your customers. <UL><LI>svc_acct - Shell accounts, POP mailboxes, SLIP/PPP and ISDN accounts <LI>svc_domain - Domains - <LI>svc_acct_sm - <B>deprecated</B> (use svc_forward for new installations) Virtual domain mail aliasing. <LI>svc_forward - mail forwarding <LI>svc_www - Virtual domain website <LI>svc_broadband - Broadband/High-speed Internet service @@ -102,11 +101,6 @@ my %defs = ( 'svc_domain' => { 'domain' => 'Domain', }, - 'svc_acct_sm' => { - 'domuser' => 'domuser@virtualdomain.com', - 'domuid' => 'UID where domuser@virtualdomain.com mail is forwarded', - 'domsvc' => 'svcnum from svc_domain for virtualdomain.com', - }, 'svc_forward' => { 'srcsvc' => 'service from which mail is to be forwarded', 'dstsvc' => 'service to which mail is to be forwarded', @@ -137,7 +131,7 @@ my %defs = ( my @dbs = $hashref->{svcdb} ? ( $hashref->{svcdb} ) - : qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www svc_broadband ); + : qw( svc_acct svc_domain svc_forward svc_www svc_broadband ); tie my %svcdb, 'Tie::IxHash', map { $_=>$_ } @dbs; my $widget = new HTML::Widgets::SelectLayers( diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index 69e8ac2fa..9633fabdf 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -17,7 +17,7 @@ my $new = new FS::part_svc ( { push @fields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge map { ( $svcdb.'__'.$_, $svcdb.'__'.$_.'_flag' ) } @fields; } grep defined( $FS::Record::dbdef->table($_) ), - qw( svc_acct svc_domain svc_acct_sm svc_forward svc_www svc_broadband ) + qw( svc_acct svc_domain svc_forward svc_www svc_broadband ) ) } ); diff --git a/httemplate/edit/process/svc_acct_sm.cgi b/httemplate/edit/process/svc_acct_sm.cgi deleted file mode 100755 index 41d03fb92..000000000 --- a/httemplate/edit/process/svc_acct_sm.cgi +++ /dev/null @@ -1,34 +0,0 @@ -<% - -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum =$1; - -my $old = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) if $svcnum; - -#unmunge domsvc and domuid -#$cgi->param('domsvc',(split(/:/, $cgi->param('domsvc') ))[0] ); -#$cgi->param('domuid',(split(/:/, $cgi->param('domuid') ))[0] ); - -my $new = new FS::svc_acct_sm ( { - map { - ($_, scalar($cgi->param($_))); - #} qw(svcnum pkgnum svcpart domuser domuid domsvc) - } ( fields('svc_acct_sm'), qw( pkgnum svcpart ) ) -} ); - -my $error = ''; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->getfield('svcnum'); -} - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_acct_sm.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_acct_sm.cgi?$svcnum"); -} - -%> diff --git a/httemplate/edit/svc_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi deleted file mode 100755 index 0fd5f7622..000000000 --- a/httemplate/edit/svc_acct_sm.cgi +++ /dev/null @@ -1,178 +0,0 @@ -<!-- mason kludge --> -<% - -my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); - -my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct_sm ); -if ( $cgi->param('error') ) { - $svc_acct_sm = new FS::svc_acct_sm ( { - map { $_, scalar($cgi->param($_)) } fields('svc_acct_sm') - } ); - $svcnum = $svc_acct_sm->svcnum; - $pkgnum = $cgi->param('pkgnum'); - $svcpart = $cgi->param('svcpart'); - #$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - #die "No part_svc entry!" unless $part_svc; -} else { - my($query) = $cgi->keywords; - if ( $query =~ /^(\d+)$/ ) { #editing - $svcnum=$1; - $svc_acct_sm=qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) - or die "Unknown (svc_acct_sm) svcnum!"; - - my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum}) - or die "Unknown (cust_svc) svcnum!"; - - $pkgnum=$cust_svc->pkgnum; - $svcpart=$cust_svc->svcpart; - - #$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - #die "No part_svc entry!" unless $part_svc; - - } else { #adding - - $svc_acct_sm = new FS::svc_acct_sm({}); - - foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart - $pkgnum=$1 if /^pkgnum(\d+)$/; - $svcpart=$1 if /^svcpart(\d+)$/; - } - my $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; - - $svcnum=''; - - #set fixed and default fields from part_svc - foreach my $part_svc_column ( - grep { $_->columnflag } $part_svc->all_part_svc_column - ) { - $svc_acct_sm->setfield( $part_svc_column->columnname, - $part_svc_column->columnvalue, - ); - } - - } -} -my $action = $svc_acct_sm->svcnum ? 'Edit' : 'Add'; - -my %username = (); -my %domain = (); -if ($pkgnum) { - - #find all possible uids (and usernames) - - my @u_acct_svcparts = (); - foreach my $u_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_acct'}) ) { - push @u_acct_svcparts,$u_part_svc->getfield('svcpart'); - } - - my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - my($custnum)=$cust_pkg->getfield('custnum'); - foreach my $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { - my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); - my($acct_svcpart); - foreach $acct_svcpart (@u_acct_svcparts) { #now find the corresponding - #record(s) in cust_svc ( for this - #pkgnum ! ) - my($i_cust_svc); - foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { - my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); - $username{$svc_acct->getfield('uid')}=$svc_acct->getfield('username'); - } - } - } - - #find all possible domains (and domsvc's) - - my @d_acct_svcparts = (); - foreach my $d_part_svc ( qsearch('part_svc',{'svcdb'=>'svc_domain'}) ) { - push @d_acct_svcparts,$d_part_svc->getfield('svcpart'); - } - - foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { - my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); - my($acct_svcpart); - foreach $acct_svcpart (@d_acct_svcparts) { - my($i_cust_svc); - foreach $i_cust_svc ( qsearch('cust_svc',{'pkgnum'=>$cust_pkgnum,'svcpart'=>$acct_svcpart}) ) { - my($svc_domain)=qsearch('svc_domain',{'svcnum'=>$i_cust_svc->getfield('svcnum')}); - $domain{$svc_domain->getfield('svcnum')}=$svc_domain->getfield('domain'); - } - } - } - -} elsif ( $action eq 'Edit' ) { - - my($svc_acct)=qsearchs('svc_acct',{'uid'=>$svc_acct_sm->domuid}); - $username{$svc_acct_sm->uid} = $svc_acct->username; - - my($svc_domain)=qsearchs('svc_domain',{'svcnum'=>$svc_acct_sm->domsvc}); - $domain{$svc_acct_sm->domsvc} = $svc_domain->domain; - -} else { - die "\$action eq Add, but \$pkgnum is null!\n"; -} - -my $p1 = popurl(1); -print header("Mail Alias $action", ''); - -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT>" - if $cgi->param('error'); - -print qq!<FORM ACTION="${p1}process/svc_acct_sm.cgi" METHOD=POST>!; - -#display - - #formatting - print "<PRE>"; - -#svcnum -print qq!<INPUT TYPE="hidden" NAME="svcnum" VALUE="$svcnum">!; -print qq!Service #<FONT SIZE=+1><B>!, $svcnum ? $svcnum : " (NEW)", "</B></FONT>"; - -#pkgnum -print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!; - -#svcpart -print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!; - -my($domuser,$domsvc,$domuid)=( - $svc_acct_sm->domuser, - $svc_acct_sm->domsvc, - $svc_acct_sm->domuid, -); - -#domuser -print qq!\n\nMail to <INPUT TYPE="text" NAME="domuser" VALUE="$domuser"> <I>( * for anything )</I>!; - -#domsvc -print qq! \@ <SELECT NAME="domsvc" SIZE=1>!; -foreach $_ (keys %domain) { - print "<OPTION", $_ eq $domsvc ? " SELECTED" : "", - qq! VALUE="$_">$domain{$_}!; -} -print "</SELECT>"; - -#uid -print qq!\nforwards to <SELECT NAME="domuid" SIZE=1>!; -foreach $_ (keys %username) { - print "<OPTION", ($_ eq $domuid) ? " SELECTED" : "", - qq! VALUE="$_">$username{$_}!; -} -print "</SELECT>\@$mydomain mailbox."; - - #formatting - print "</PRE>\n"; - -print qq!<CENTER><INPUT TYPE="submit" VALUE="Submit"></CENTER>!; - -print <<END; - - </FORM> - </BODY> -</HTML> -END - -%> diff --git a/httemplate/index.html b/httemplate/index.html index 2cb707326..f17639d44 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -34,7 +34,6 @@ <FORM ACTION="search/cust_main.cgi" METHOD="POST"><INPUT TYPE="hidden" NAME="phone_on" VALUE="1">Phone # <INPUT TYPE="text" NAME="phone_text"><INPUT TYPE="submit" VALUE="Search"></FORM> <BR><FORM ACTION="search/svc_acct.cgi" METHOD="POST">Username <INPUT TYPE="text" NAME="username"><SELECT NAME="username_type"><OPTION VALUE="All">(all)</OPTION><OPTION>Fuzzy</OPTION><OPTION>Substring</OPTION><OPTION SELECTED>Exact</OPTION></SELECT><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_acct.cgi?username">all accounts by username</A> or <A HREF="search/svc_acct.cgi?uid">uid</A></FORM> <BR><FORM ACTION="search/svc_domain.cgi" METHOD="POST">Domain <INPUT TYPE="text" NAME="domain"><INPUT TYPE="submit" VALUE="Search"> or <A HREF="search/svc_domain.cgi?domain">all domains</A></FORM> -<!-- <LI><A HREF="search/svc_acct_sm.html">mail aliases (by domain, and optionally username)</A>--> <!-- <LI><A HREF="search/svc_forward.html">mail forwards (by ?)</A>--> <BR> </TD></TR> diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index efc762cc5..79adce88c 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -4,7 +4,6 @@ my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', - 'svc_acct_sm' => '', 'svc_charge' => '', 'svc_wo' => '', ); diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi deleted file mode 100755 index 4ee300612..000000000 --- a/httemplate/search/svc_acct_sm.cgi +++ /dev/null @@ -1,84 +0,0 @@ -<% - -my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); - -$cgi->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/; -my $domuser = $1; - -$cgi->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain"; -my $svc_domain = qsearchs('svc_domain',{'domain'=>$1}) - or die "Unknown domain"; -my $domsvc = $svc_domain->svcnum; - -my @svc_acct_sm; -if ($domuser) { - @svc_acct_sm=qsearch('svc_acct_sm',{ - 'domuser' => $domuser, - 'domsvc' => $domsvc, - }); -} else { - @svc_acct_sm=qsearch('svc_acct_sm',{'domsvc' => $domsvc}); -} - -if ( scalar(@svc_acct_sm) == 1 ) { - my($svcnum)=$svc_acct_sm[0]->svcnum; - print $cgi->redirect(popurl(2). "view/svc_acct_sm.cgi?$svcnum"); -} elsif ( scalar(@svc_acct_sm) > 1 ) { -%> -<!-- mason kludge --> -<% - print header('Mail Alias Search Results'), &table(), <<END; - <TR> - <TH>Mail to<BR><FONT SIZE=-1>(click to view mail alias)</FONT></TH> - <TH>Forwards to<BR><FONT SIZE=-1>(click to view account)</FONT></TH> - </TR> -END - - my($svc_acct_sm); - foreach $svc_acct_sm (@svc_acct_sm) { - my($svcnum,$domuser,$domuid,$domsvc)=( - $svc_acct_sm->svcnum, - $svc_acct_sm->domuser, - $svc_acct_sm->domuid, - $svc_acct_sm->domsvc, - ); - - my $svc_domain = qsearchs( 'svc_domain', { 'svcnum' => $domsvc } ); - if ( $svc_domain ) { - my $domain = $svc_domain->domain; - - print qq!<TR><TD><A HREF="!. popurl(2). qq!view/svc_acct_sm.cgi?$svcnum">!, - #print '', ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser ); - ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser ), - qq!\@$domain</A> </TD>!, - ; - } else { - my $warning = "couldn't find svc_domain.svcnum $svcnum ( svc_acct_sm.svcnum $svcnum"; - warn $warning; - print "<TR><TD>WARNING: $warning</TD>"; - } - - my $svc_acct = qsearchs( 'svc_acct', { 'uid' => $domuid } ); - if ( $svc_acct ) { - my $username = $svc_acct->username; - my $svc_acct_svcnum =$svc_acct->svcnum; - print qq!<TD><A HREF="!, popurl(2), - qq!view/svc_acct.cgi?$svc_acct_svcnum">$username\@$mydomain</A>!, - qq!</TD></TR>! - ; - } else { - my $warning = "couldn't find svc_acct.uid $domuid (svc_acct_sm.svcnum $svcnum)!"; - warn $warning; - print "<TD>WARNING: $warning</TD></TR>"; - } - - } - - print '</TABLE></BODY></HTML>'; - -} else { #error - idiot("Mail Alias not found"); -} - -%> diff --git a/httemplate/search/svc_acct_sm.html b/httemplate/search/svc_acct_sm.html deleted file mode 100755 index 0719856db..000000000 --- a/httemplate/search/svc_acct_sm.html +++ /dev/null @@ -1,23 +0,0 @@ -<HTML> - <HEAD> - <TITLE>Mail Alias Search</TITLE> - </HEAD> - <BODY> - <CENTER> - <H1>Mail Alias Search</H1> - </CENTER> - <HR> - <FORM ACTION="svc_acct_sm.cgi" METHOD="post"> - Search for <B>mail alias</B>: - <INPUT TYPE="text" NAME="domuser"><FONT SIZE=-1>(opt.)</FONT> @ - <INPUT TYPE="text" NAME="domain"><FONT SIZE=-1>(req.)</FONT> - - <P><INPUT TYPE="submit" VALUE="Search"> - - </FORM> - - <HR> - - </BODY> -</HTML> - diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index fb372db14..0bb39f191 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -67,18 +67,6 @@ END $svc_domain->svcnum, $svc_domain->domain, ); - #my($malias); - #if ( qsearch('svc_acct_sm',{'domsvc'=>$svcnum}) ) { - # $malias=( - # qq|<FORM ACTION="svc_acct_sm.cgi" METHOD="post">|. - # qq|<INPUT TYPE="hidden" NAME="domuser" VALUE="">|. - # qq|<INPUT TYPE="hidden" NAME="domain" VALUE="$domain">|. - # qq|<INPUT TYPE="submit" VALUE="(mail aliases)">|. - # qq|</FORM>| - # ); - #} else { - # $malias=''; - #} my @svc_acct=qsearch('svc_acct',{'domsvc' => $svcnum}); my $rowspan = 0; diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi deleted file mode 100755 index 4e5acc427..000000000 --- a/httemplate/view/svc_acct_sm.cgi +++ /dev/null @@ -1,58 +0,0 @@ -<!-- mason kludge --> -<% - -my $conf = new FS::Conf; -my $mydomain = $conf->config('domain'); - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_acct_sm = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}); -die "Unknown svcnum" unless $svc_acct_sm; - -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum); -if ($pkgnum) { - $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); - $custnum=$cust_pkg->getfield('custnum'); -} else { - $cust_pkg = ''; - $custnum = ''; -} - -my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) - or die "Unkonwn svcpart"; - -print header('Mail Alias View', menubar( - ( ( $pkgnum || $custnum ) - ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) account" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ), - "Main menu" => $p, -)); - -my($domsvc,$domuid,$domuser) = ( - $svc_acct_sm->domsvc, - $svc_acct_sm->domuid, - $svc_acct_sm->domuser, -); -my $svc = $part_svc->svc; -my $svc_domain = qsearchs('svc_domain',{'svcnum'=>$domsvc}) - or die "Corrupted database: no svc_domain.svcnum matching domsvc $domsvc"; -my $domain = $svc_domain->domain; -my $svc_acct = qsearchs('svc_acct',{'uid'=>$domuid}) - or die "Corrupted database: no svc_acct.uid matching domuid $domuid"; -my $username = $svc_acct->username; - -print qq!<A HREF="${p}edit/svc_acct_sm.cgi?$svcnum">Edit this information</A>!, - "<BR>Service #$svcnum", - "<BR>Service: <B>$svc</B>", - qq!<BR>Mail to <B>!, ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser ) , qq!</B>\@<B>$domain</B> forwards to <B>$username</B>\@$mydomain mailbox.!, - '</BODY></HTML>' -; - -%> |