From 8a8c9386cbd3383b0134aae8e32b5995f8886fb2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 19 Aug 2001 15:53:36 +0000 Subject: added user interface for svc_forward and vpopmail support --- httemplate/misc/catchall.cgi | 157 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100755 httemplate/misc/catchall.cgi (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi new file mode 100755 index 000000000..79b72565b --- /dev/null +++ b/httemplate/misc/catchall.cgi @@ -0,0 +1,157 @@ +<% +# +# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ +# +# Usage: catchall.cgi {svcnum} +# http://server.name/path/catchall.cgi? {svcnum} +# +# $Log: catchall.cgi,v $ +# Revision 1.1 2001-08-19 15:53:35 jeff +# added user interface for svc_forward and vpopmail support +# +# + +use strict; +use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart + $part_svc $query %email $p1 $domain $catchall ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::CGI qw(header popurl); +use FS::Record qw(qsearch qsearchs fields); +use FS::svc_acct; +use FS::svc_domain; +use FS::svc_forward; +use FS::Conf; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; + +if ( $cgi->param('error') ) { + $svc_domain = new FS::svc_domain ( { + map { $_, scalar($cgi->param($_)) } fields('svc_domain') + } ); + $svcnum = $svc_domain->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_domain=qsearchs('svc_domain',{'svcnum'=>$svcnum}) + or die "Unknown (svc_domain) 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 { + + die "Invalid (svc_domain) svcnum!"; + + } +} + +if ($pkgnum) { + + #find all possible user svcnums (and emails) + + #starting with that currently attached + if ($svc_domain->catchall) { + my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$svc_domain->catchall}); + $email{$svc_domain->catchall} = $svc_acct->email; + } + + #and including the rest for this customer + my($u_part_svc,@u_acct_svcparts); + foreach $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'); + my($i_cust_pkg); + foreach $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')}); + $email{$svc_acct->getfield('svcnum')}=$svc_acct->email; + } + } + } + +} else { + + my($svc_acct)=qsearchs('svc_acct',{'svcnum'=>$svc_domain->catchall}); + $email{$svc_domain->catchall} = $svc_acct->email; +} + +# add an absence of a catchall +$email{0} = "(none)"; + +$p1 = popurl(1); +print $cgi->header( '-expires' => 'now' ), header("Domain Catchall Edit", ''); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print qq!
!; + +#display + + #formatting + print "
";
+
+#svcnum
+print qq!!;
+print qq!Service #!, $svcnum ? $svcnum : " (NEW)", "";
+
+#pkgnum
+print qq!!;
+ 
+#svcpart
+print qq!!;
+
+($domain,$catchall)=(
+  $svc_domain->domain,
+  $svc_domain->catchall,
+);
+
+print qq!!;
+
+#catchall
+print qq!\n\nMail to (anything)@$domain forwards to ";
+
+	#formatting
+	print "
\n"; + +print qq!
!; + +print < + + +END + +%> -- cgit v1.2.1 From 3d671921441ba8422650b54435a1959ad1d4c71d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Aug 2001 02:31:57 +0000 Subject: remove $Log$ messages. whew. --- httemplate/misc/catchall.cgi | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 79b72565b..9ebec6688 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,15 +1,5 @@ <% -# -# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ -# -# Usage: catchall.cgi {svcnum} -# http://server.name/path/catchall.cgi? {svcnum} -# -# $Log: catchall.cgi,v $ -# Revision 1.1 2001-08-19 15:53:35 jeff -# added user interface for svc_forward and vpopmail support -# -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart -- cgit v1.2.1 From 91387f8f489e561deaf1de052d80ef800a4970a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 26 Oct 2001 10:24:56 +0000 Subject: cache foo *sigh* --- httemplate/misc/catchall.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 9ebec6688..7e90ac4e0 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart @@ -94,7 +94,7 @@ if ($pkgnum) { $email{0} = "(none)"; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Domain Catchall Edit", ''); +print $cgi->header( @FS::CGI::header ), header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), "" -- cgit v1.2.1 From c14a267229fc0d6f2d2afdebab3bd34d825df2ef Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Oct 2001 14:54:07 +0000 Subject: get rid of header foo in individual templates --- httemplate/misc/catchall.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 7e90ac4e0..3aafd0d49 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart @@ -94,7 +94,7 @@ if ($pkgnum) { $email{0} = "(none)"; $p1 = popurl(1); -print $cgi->header( @FS::CGI::header ), header("Domain Catchall Edit", ''); +print header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), "" -- cgit v1.2.1 From 1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 30 Jan 2002 14:18:09 +0000 Subject: remove use Module; and $cgi = new CGI; &cgisuidsetup(); from all templates. should work better under Mason. --- httemplate/misc/catchall.cgi | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 3aafd0d49..a8d865780 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,24 +1,9 @@ + <% -# - -use strict; -use vars qw( $conf $cgi $action $svcnum $svc_domain $pkgnum $svcpart - $part_svc $query %email $p1 $domain $catchall ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch qsearchs fields); -use FS::svc_acct; -use FS::svc_domain; -use FS::svc_forward; -use FS::Conf; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; + +my($svc_domain, $svcnum, $pkgnum, $svcpart, $part_svc); if ( $cgi->param('error') ) { $svc_domain = new FS::svc_domain ( { map { $_, scalar($cgi->param($_)) } fields('svc_domain') @@ -51,6 +36,7 @@ if ( $cgi->param('error') ) { } } +my %email; if ($pkgnum) { #find all possible user svcnums (and emails) @@ -93,7 +79,7 @@ if ($pkgnum) { # add an absence of a catchall $email{0} = "(none)"; -$p1 = popurl(1); +my $p1 = popurl(1); print header("Domain Catchall Edit", ''); print qq!Error: !, $cgi->param('error'), @@ -117,7 +103,7 @@ print qq!!; #svcpart print qq!!; -($domain,$catchall)=( +my($domain,$catchall)=( $svc_domain->domain, $svc_domain->catchall, ); -- cgit v1.2.1 From 22a35047ecdffff80110e06cc08fc84f9ddba9b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 13:21:31 +0000 Subject: removed from all files to fix any redirects, whew Mason handler.pl overrides CGI::redirect fixed strict; problems in edit/part_pkg.cgi & edit/process/part_pkg.cgi --- httemplate/misc/catchall.cgi | 1 - 1 file changed, 1 deletion(-) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index a8d865780..cc4adb88a 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; -- cgit v1.2.1 From a4c96748eb6eab29a70f3a944c6520283a635c78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 16:05:22 +0000 Subject: *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. --- httemplate/misc/catchall.cgi | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index cc4adb88a..9aa84be18 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -1,3 +1,4 @@ + <% my $conf = new FS::Conf; -- cgit v1.2.1 From aee635ea9986d031a996381f71e67d1446c10331 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 29 Apr 2003 19:49:37 +0000 Subject: 0 has a hash key looks like svcnum = 0. Suprisingly, '' works. --- httemplate/misc/catchall.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/catchall.cgi') diff --git a/httemplate/misc/catchall.cgi b/httemplate/misc/catchall.cgi index 9aa84be18..3402b61e6 100755 --- a/httemplate/misc/catchall.cgi +++ b/httemplate/misc/catchall.cgi @@ -77,7 +77,7 @@ if ($pkgnum) { } # add an absence of a catchall -$email{0} = "(none)"; +$email{''} = "(none)"; my $p1 = popurl(1); print header("Domain Catchall Edit", ''); -- cgit v1.2.1