diff options
author | ivan <ivan> | 2002-01-30 14:18:09 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-01-30 14:18:09 +0000 |
commit | 1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39 (patch) | |
tree | caee70f2707d97a43e21ea4253afe728ea6f421a | |
parent | ea0d3938b57a079ce4aa6db0cae316e3ac6da654 (diff) |
remove
use Module;
and
$cgi = new CGI;
&cgisuidsetup();
from all templates. should work better under Mason.
80 files changed, 619 insertions, 1516 deletions
diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm index c66bfe3c2..40932147e 100644 --- a/FS/FS/CGI.pm +++ b/FS/FS/CGI.pm @@ -168,9 +168,9 @@ Returns HTML tag for beginning a table. sub table { my $col = shift; if ( $col ) { - qq!<TABLE BGCOLOR="$col" BORDER=1 WIDTH="100%">!; + qq!<TABLE BGCOLOR="$col" BORDER=1 WIDTH="100%" CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">!; } else { - "<TABLE BORDER=1>"; + '<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">'; } } @@ -202,7 +202,7 @@ sub ntable { if ( $col ) { qq!<TABLE BGCOLOR="$col" BORDER=0 CELLSPACING=$cellspacing>!; } else { - "<TABLE BORDER>"; + '<TABLE BORDER CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">'; } } diff --git a/htetc/global.asa b/htetc/global.asa index 20ef1467d..c4b4380d6 100644 --- a/htetc/global.asa +++ b/htetc/global.asa @@ -2,19 +2,49 @@ use strict; use vars qw( $cgi $p ); use CGI; #use CGI::Carp qw(fatalsToBrowser); -use HTML::Entities; use Date::Format; use Date::Parse; use Tie::IxHash; -use FS::UID qw(cgisuidsetup dbh); -use FS::Record qw(qsearch qsearchs fields); -use FS::part_svc; -use FS::part_pkg; -use FS::pkg_svc; +use HTML::Entities; +use IO::Handle; +use IO::File; +use String::Approx qw(amatch); +use FS::UID qw(cgisuidsetup dbh getotaker datasrc); +use FS::Record qw(qsearch qsearchs fields dbdef); +use FS::Conf; +use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot + small_custview); + +use FS::agent; +use FS::agent_type; +use FS::domain_record; +use FS::cust_bill; +use FS::cust_bill_pay; +use FS::cust_credit; +use FS::cust_credit_bill; +use FS::cust_main; +use FS::cust_main_county; +use FS::cust_pay; use FS::cust_pkg; +use FS::cust_refund; use FS::cust_svc; +use FS::nas; use FS::part_bill_event; -use FS::CGI qw(header menubar popurl table itable ntable); +use FS::part_pkg; +use FS::part_referral; +use FS::part_svc; +use FS::pkg_svc; +use FS::port; +use FS::queue; +use FS::raddb; +use FS::session; +use FS::svc_acct; +use FS::svc_acct_pop qw(popselector); +use FS::svc_acct_sm; +use FS::svc_domain; +use FS::svc_forward; +use FS::svc_www; +use FS::type_pkgs; sub Script_OnStart { $cgi = new CGI; diff --git a/htetc/handler.pl b/htetc/handler.pl index 6ff9d436c..f80c79e65 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -61,15 +61,45 @@ sub handler use Date::Parse; use Tie::IxHash; use HTML::Entities; - use FS::UID qw(cgisuidsetup); - use FS::Record qw(qsearch qsearchs fields); - use FS::part_svc; - use FS::part_pkg; - use FS::pkg_svc; + use IO::Handle; + use IO::File; + use String::Approx qw(amatch); + use FS::UID qw(cgisuidsetup dbh getotaker datasrc); + use FS::Record qw(qsearch qsearchs fields dbdef); + use FS::Conf; + use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot + small_custview); + + use FS::agent; + use FS::agent_type; + use FS::domain_record; + use FS::cust_bill; + use FS::cust_bill_pay; + use FS::cust_credit; + use FS::cust_credit_bill; + use FS::cust_main; + use FS::cust_main_county; + use FS::cust_pay; use FS::cust_pkg; + use FS::cust_refund; use FS::cust_svc; + use FS::nas; use FS::part_bill_event; - use FS::CGI qw(header menubar popurl table itable ntable); + use FS::part_pkg; + use FS::part_referral; + use FS::part_svc; + use FS::pkg_svc; + use FS::port; + use FS::queue; + use FS::raddb; + use FS::session; + use FS::svc_acct; + use FS::svc_acct_pop qw(popselector); + use FS::svc_acct_sm; + use FS::svc_domain; + use FS::svc_forward; + use FS::svc_www; + use FS::type_pkgs; $cgi = new CGI; &cgisuidsetup($cgi); diff --git a/httemplate/browse/agent.cgi b/httemplate/browse/agent.cgi index 62004490f..067a06b30 100755 --- a/httemplate/browse/agent.cgi +++ b/httemplate/browse/agent.cgi @@ -1,15 +1,5 @@ +<!-- $Id: agent.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: agent.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $ui $cgi $p $agent ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar table popurl); -use FS::agent; -use FS::agent_type; #Begin silliness # @@ -22,12 +12,6 @@ use FS::agent_type; #__END__ #End silliness -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); - print header('Agent Listing', menubar( 'Main Menu' => $p, 'Agent Types' => $p. 'browse/agent_type.cgi', @@ -47,7 +31,7 @@ END # <TH><FONT SIZE=-1>Agent #</FONT></TH> # <TH>Agent</TH> -foreach $agent ( sort { +foreach my $agent ( sort { $a->getfield('agentnum') <=> $b->getfield('agentnum') } qsearch('agent',{}) ) { my($hashref)=$agent->hashref; diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 11ba20ac5..8321048e7 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,22 +1,6 @@ +<!-- $Id: agent_type.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: agent_type.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw( $cgi $p $agent_type ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar popurl table); -use FS::agent_type; -use FS::type_pkgs; -use FS::part_pkg; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); print header("Agent Type Listing", menubar( 'Main Menu' => $p, )), "Agent types define groups of packages that you can then assign to". @@ -27,7 +11,7 @@ print header("Agent Type Listing", menubar( </TR> END -foreach $agent_type ( sort { +foreach my $agent_type ( sort { $a->getfield('typenum') <=> $b->getfield('typenum') } qsearch('agent_type',{}) ) { my($hashref)=$agent_type->hashref; diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index bbd75cc4a..89b1bfd71 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -1,20 +1,5 @@ +<!-- $Id: cust_main_county.cgi,v 1.6 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_main_county.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $p $cust_main_county ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar popurl table); -use FS::cust_main_county; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); print header("Tax Rate Listing", menubar( 'Main Menu' => $p, diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi index 7779bd0c3..960843adf 100755 --- a/httemplate/browse/cust_pay_batch.cgi +++ b/httemplate/browse/cust_pay_batch.cgi @@ -1,21 +1,5 @@ +<!-- $Id: cust_pay_batch.cgi,v 1.2 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_pay_batch.cgi,v 1.1 2001-10-30 19:05:27 ivan Exp $ --> - -use strict; -use vars qw( $cgi $p ); # $part_referral ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch); -use FS::CGI qw(header menubar popurl table); -use FS::queue; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); print header("Pending credit card batch", menubar( 'Main Menu' => $p, diff --git a/httemplate/browse/nas.cgi b/httemplate/browse/nas.cgi index 6df40e049..b392dc083 100755 --- a/httemplate/browse/nas.cgi +++ b/httemplate/browse/nas.cgi @@ -1,22 +1,6 @@ +<!-- $Id --> <% -use strict; -use vars qw( $cgi $p ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch); # qsearchs); -use FS::CGI qw(header menubar table popurl); -use FS::nas; -use FS::port; -use FS::session; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$p=popurl(2); - print header('NAS ports', menubar( 'Main Menu' => $p, )); diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi index f33997666..cd90bc1da 100755 --- a/httemplate/browse/part_bill_event.cgi +++ b/httemplate/browse/part_bill_event.cgi @@ -1,4 +1,4 @@ -<!-- $Id: part_bill_event.cgi,v 1.1 2002-01-29 16:33:15 ivan Exp $ --> +<!-- $Id: part_bill_event.cgi,v 1.2 2002-01-30 14:18:08 ivan Exp $ --> <% my %search; @@ -22,7 +22,7 @@ my $total = scalar(@part_bill_event); : do { $cgi->param('showdisabled', 1); '( <a href="'. $cgi->self_url. '">show disabled events</a> )'; } %> -<TABLE BORDER=1> +<%= table() %> <TR> <TH COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Event</TH> <TH>Payby</TH> @@ -32,11 +32,12 @@ my $total = scalar(@part_bill_event); <% foreach my $part_bill_event ( sort { $a->payby cmp $b->payby || $a->seconds <=> $b->seconds + || $a->weight <=> $b->weight || $a->eventpart <=> $b->eventpart } @part_bill_event ) { my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart; use Time::Duration; - my $delay = duration_exact($hashref->{seconds}); + my $delay = duration_exact($part_bill_event->seconds); %> <TR> <TD><A HREF="<%= $url %>"> diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index d0b572aa4..22d139c99 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,22 +1,5 @@ +<!-- $Id: part_pkg.cgi,v 1.10 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: part_pkg.cgi,v 1.9 2001-12-27 09:26:14 ivan Exp $ --> - -use strict; -use vars qw( $cgi $p $part_pkg ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar popurl table); -use FS::part_pkg; -use FS::pkg_svc; -use FS::part_svc; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); my %search; if ( $cgi->param('showdisabled') ) { @@ -56,7 +39,7 @@ print &table(), <<END; </TR> END -foreach $part_pkg ( sort { +foreach my $part_pkg ( sort { $a->getfield('pkgpart') <=> $b->getfield('pkgpart') } @part_pkg ) { my($hashref)=$part_pkg->hashref; diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index b82d4cba0..82f42924f 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -1,20 +1,5 @@ +<!-- $Id: part_referral.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: part_referral.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $p $part_referral ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch); -use FS::CGI qw(header menubar popurl table); -use FS::part_referral; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); print header("Referral Listing", menubar( 'Main Menu' => $p, @@ -25,7 +10,7 @@ print header("Referral Listing", menubar( </TR> END -foreach $part_referral ( sort { +foreach my $part_referral ( sort { $a->getfield('refnum') <=> $b->getfield('refnum') } qsearch('part_referral',{}) ) { my($hashref)=$part_referral->hashref; diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index da523ca51..54d4b083b 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -1,4 +1,4 @@ -<!-- $Id: part_svc.cgi,v 1.6 2001-12-27 09:26:14 ivan Exp $ --> +<!-- $Id: part_svc.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% my %search; @@ -22,7 +22,7 @@ my $total = scalar(@part_svc); : do { $cgi->param('showdisabled', 1); '( <a href="'. $cgi->self_url. '">show disabled services</a> )'; } %> -<TABLE BORDER=1> +<%= table() %> <TR> <TH COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Service</TH> <TH>Table</TH> diff --git a/httemplate/browse/queue.cgi b/httemplate/browse/queue.cgi index 6b5237240..af8989b82 100755 --- a/httemplate/browse/queue.cgi +++ b/httemplate/browse/queue.cgi @@ -1,21 +1,5 @@ +<!-- $Id: queue.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: queue.cgi,v 1.6 2001-10-31 16:52:42 ivan Exp $ --> - -use strict; -use vars qw( $cgi $p ); # $part_referral ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch); -use FS::CGI qw(header menubar popurl table); -use FS::queue; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); print header("Job Queue", menubar( 'Main Menu' => $p, diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index 21cb95f89..a881b9a00 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,20 +1,5 @@ +<!-- $Id: svc_acct_pop.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: svc_acct_pop.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $p $svc_acct_pop ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar table popurl); -use FS::svc_acct_pop; - -$cgi = new CGI; - -&cgisuidsetup($cgi); - -$p = popurl(2); print header('POP Listing', menubar( 'Main Menu' => $p, @@ -29,7 +14,7 @@ print header('POP Listing', menubar( </TR> END -foreach $svc_acct_pop ( sort { +foreach my $svc_acct_pop ( sort { #$a->getfield('popnum') <=> $b->getfield('popnum') $a->state cmp $b->state || $a->city cmp $b->city || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 20bb168df..564dccaba 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -68,7 +68,7 @@ mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* T <li>Edit the top-level Makefile: <ul> <li>Set <tt>DATASOURCE</tt> to your <a href="http://search.cpan.org/doc/TIMB/DBI-1.20/DBI.pm">DBI data source</a>, for example, <tt>DBI:Pg:host=localhost;dbname=freeside</tt> for PostgresSQL or <tt>DBI:mysql:freeside</tt> for MySQL. See the <a href="http://search.cpan.org/doc/TIMB/DBI-1.20/DBI.pm">DBI manpage</a> and the <a href="http://search.cpan.org/search?mode=module&query=DBD">manpage for your DBD</a> for the exact syntax of a DBI data source. - <li>Set <tt>DB_ADMIN_PASSWORD</tt> to the freeside database user's password. + <li>Set <tt>DB_PASSWORD</tt> to the freeside database user's password. </ul> <li>Add the freeside database to your database engine: <pre> diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi index a4dcda5e3..f3864e6c2 100755 --- a/httemplate/edit/agent.cgi +++ b/httemplate/edit/agent.cgi @@ -1,20 +1,7 @@ +<!-- $Id: agent.cgi,v 1.6 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: agent.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $agent $action $hashref $p $agent_type ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header menubar popurl ntable); -use FS::Record qw(qsearch qsearchs fields); -use FS::agent; -use FS::agent_type; - -$cgi = new CGI; - -&cgisuidsetup($cgi); +my $agent; if ( $cgi->param('error') ) { $agent = new FS::agent ( { map { $_, scalar($cgi->param($_)) } fields('agent') @@ -26,10 +13,8 @@ if ( $cgi->param('error') ) { } else { #adding $agent = new FS::agent {}; } -$action = $agent->agentnum ? 'Edit' : 'Add'; -$hashref = $agent->hashref; - -$p = popurl(2); +my $action = $agent->agentnum ? 'Edit' : 'Add'; +my $hashref = $agent->hashref; print header("$action Agent", menubar( 'Main Menu' => $p, @@ -54,7 +39,7 @@ print &ntable("#cccccc", 2, ''), <<END; <TD><SELECT NAME="typenum" SIZE=1> END -foreach $agent_type (qsearch('agent_type',{})) { +foreach my $agent_type (qsearch('agent_type',{})) { print "<OPTION VALUE=". $agent_type->typenum; print " SELECTED" if $hashref->{typenum} && ( $hashref->{typenum} == $agent_type->typenum ); diff --git a/httemplate/edit/agent_type.cgi b/httemplate/edit/agent_type.cgi index a2595bf41..c3ff30ff6 100755 --- a/httemplate/edit/agent_type.cgi +++ b/httemplate/edit/agent_type.cgi @@ -1,22 +1,7 @@ +<!-- $Id: agent_type.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: agent_type.cgi,v 1.6 2001-12-27 09:26:14 ivan Exp $ --> - -use strict; -use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::agent_type; -use FS::CGI qw(header menubar popurl); -use FS::agent_type; -use FS::part_pkg; -use FS::type_pkgs; - -$cgi = new CGI; - -&cgisuidsetup($cgi); +my($agent_type); if ( $cgi->param('error') ) { $agent_type = new FS::agent_type ( { map { $_, scalar($cgi->param($_)) } fields('agent') @@ -28,10 +13,9 @@ if ( $cgi->param('error') ) { } else { #adding $agent_type = new FS::agent_type {}; } -$action = $agent_type->typenum ? 'Edit' : 'Add'; -$hashref = $agent_type->hashref; +my $action = $agent_type->typenum ? 'Edit' : 'Add'; +my $hashref = $agent_type->hashref; -$p = popurl(2); print header("$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", @@ -50,7 +34,7 @@ print <<END; <BR><BR>Select which packages agents of this type may sell to customers<BR> END -foreach $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { +foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { print qq!<BR><INPUT TYPE="checkbox" NAME="pkgpart!, $part_pkg->getfield('pkgpart'), qq!" !, # ( 'CHECKED 'x scalar( diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi index 793ed1009..fd56b328a 100755 --- a/httemplate/edit/cust_bill_pay.cgi +++ b/httemplate/edit/cust_bill_pay.cgi @@ -1,36 +1,22 @@ +<!-- $Id: cust_bill_pay.cgi,v 1.5 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_bill_pay.cgi,v 1.4 2001-12-18 19:36:21 ivan Exp $ --> - -use strict; -use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker $cust_pay ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch fields); -use FS::cust_pay; -use FS::cust_bill; - - -$cgi = new CGI; -cgisuidsetup($cgi); +my($paynum, $amount, $invnum); if ( $cgi->param('error') ) { $paynum = $cgi->param('paynum'); $amount = $cgi->param('amount'); $invnum = $cgi->param('invnum'); } else { - ($query) = $cgi->keywords; + my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $paynum = $1; $amount = ''; $invnum = ''; } -$otaker = getotaker; +my $otaker = getotaker; -$p1 = popurl(1); +my $p1 = popurl(1); print header("Apply Payment", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), @@ -40,7 +26,8 @@ print <<END; <FORM ACTION="${p1}process/cust_bill_pay.cgi" METHOD=POST> END -die unless $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); +my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ); +die "payment $paynum not found!" unless $cust_pay; my $unapplied = $cust_pay->unapplied; diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index e61463e07..7c8a80c22 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,21 +1,8 @@ +<!-- $Id: cust_credit.cgi,v 1.8 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_credit.cgi,v 1.7 2001-12-26 15:07:06 ivan Exp $ --> - -use strict; -use vars qw( $cgi $query $custnum $otaker $p1 $_date $amount $reason ); -use Date::Format; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl small_custview); -use FS::Record qw(fields); -#use FS::cust_credit; my $conf = new FS::Conf; - -$cgi = new CGI; -cgisuidsetup($cgi); - +my($custnum, $amount, $reason); if ( $cgi->param('error') ) { #$cust_credit = new FS::cust_credit ( { # map { $_, scalar($cgi->param($_)) } fields('cust_credit') @@ -25,18 +12,18 @@ if ( $cgi->param('error') ) { #$refund = $cgi->param('refund'); $reason = $cgi->param('reason'); } else { - ($query) = $cgi->keywords; + my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $custnum = $1; $amount = ''; #$refund = 'yes'; $reason = ''; } -$_date = time; +my $_date = time; -$otaker = getotaker; +my $otaker = getotaker; -$p1 = popurl(1); +my $p1 = popurl(1); print header("Post Credit", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi index a00734949..3748202a5 100755 --- a/httemplate/edit/cust_credit_bill.cgi +++ b/httemplate/edit/cust_credit_bill.cgi @@ -1,21 +1,7 @@ +<!-- $Id: cust_credit_bill.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_credit_bill.cgi,v 1.6 2001-12-18 19:30:31 ivan Exp $ --> - -use strict; -use vars qw( $cgi $query $custnum $invnum $otaker $p1 $crednum $amount $reason $cust_credit ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch fields); -use FS::cust_credit; -use FS::cust_bill; - - -$cgi = new CGI; -cgisuidsetup($cgi); +my($crednum, $amount, $invnum); if ( $cgi->param('error') ) { #$cust_credit_bill = new FS::cust_credit_bill ( { # map { $_, scalar($cgi->param($_)) } fields('cust_credit_bill') @@ -25,7 +11,7 @@ if ( $cgi->param('error') ) { #$refund = $cgi->param('refund'); $invnum = $cgi->param('invnum'); } else { - ($query) = $cgi->keywords; + my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $crednum = $1; $amount = ''; @@ -33,9 +19,9 @@ if ( $cgi->param('error') ) { $invnum = ''; } -$otaker = getotaker; +my $otaker = getotaker; -$p1 = popurl(1); +my $p1 = popurl(1); print header("Apply Credit", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), @@ -45,7 +31,8 @@ print <<END; <FORM ACTION="${p1}process/cust_credit_bill.cgi" METHOD=POST> END -die unless $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); +my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ); +die "credit $crednum not found!" unless $cust_credit; my $credited = $cust_credit->credited; diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index d3251c2b9..fad4d9e6d 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,39 +1,22 @@ +<!-- $Id: cust_main.cgi,v 1.19 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_main.cgi,v 1.18 2001-12-28 14:40:35 ivan Exp $ --> - -use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum - $last $first $ss $company $address1 $address2 $city $zip - $daytime $night $fax @invoicing_list $invoicing_list $payinfo - $payname %payby %paybychecked $refnum $otaker $r ); -use vars qw ( $conf $saved_pkgpart $username $password $popnum $ulen $ulen2 ); -use vars qw ( $error ); -#use CGI::Switch; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -#use FS::Record qw(qsearch qsearchs fields); -use FS::Record qw(qsearch qsearchs fields dbdef); -use FS::CGI qw(header popurl itable table); -use FS::cust_main; -use FS::agent; -use FS::part_referral; -use FS::cust_main_county; #for misplaced logic below - use FS::part_pkg; + #use FS::part_pkg; #for false laziness below (now more properly lazy) - use FS::svc_acct_pop; + #use FS::svc_acct_pop; #for (other) false laziness below - use FS::agent; - use FS::type_pkgs; + #use FS::agent; + #use FS::type_pkgs; -$conf = new FS::Conf; +my $conf = new FS::Conf; #get record -$error = ''; +my $error = ''; +my($custnum, $username, $password, $popnum, $cust_main, $saved_pkgpart); if ( $cgi->param('error') ) { $error = $cgi->param('error'); $cust_main = new FS::cust_main ( { @@ -69,11 +52,11 @@ if ( $cgi->param('error') ) { $popnum = 0; } $cgi->delete_all(); -$action = $custnum ? 'Edit' : 'Add'; +my $action = $custnum ? 'Edit' : 'Add'; # top -$p1 = popurl(1); +my $p1 = popurl(1); print header("Customer $action", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $error, "</FONT>" if $error; @@ -86,12 +69,12 @@ print qq!<FORM ACTION="${p1}process/cust_main.cgi" METHOD=POST NAME="form1">!, # agent -$r = qq!<font color="#ff0000">*</font>!; +my $r = qq!<font color="#ff0000">*</font>!; -@agents = qsearch( 'agent', {} ); +my @agents = qsearch( 'agent', {} ); #die "No agents created!" unless @agents; die "You have not created any agents. You must create at least one agent before adding a customer. Go to ". popurl(2). "browse/agent.cgi and create one or more agents." unless @agents; -$agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first +my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first if ( scalar(@agents) == 1 ) { print qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$agentnum">!; } else { @@ -109,7 +92,7 @@ if ( scalar(@agents) == 1 ) { #referral -$refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; +my $refnum = $cust_main->refnum || $conf->config('referraldefault') || 0; if ( $custnum && ! $conf->exists('editreferrals') ) { print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!; } else { @@ -152,7 +135,7 @@ if ( $cust_main->referral_custnum ) { # contact info -($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( +my($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( $cust_main->last, $cust_main->first, $cust_main->ss, @@ -201,7 +184,7 @@ foreach ( sort { } print qq!</SELECT></TD><TH>${r}Zip</TH><TD><INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10></TD></TR>!; -($daytime,$night,$fax)=( +my($daytime,$night,$fax)=( $cust_main->daytime, $cust_main->night, $cust_main->fax, @@ -345,29 +328,29 @@ print "<BR>Billing information", &itable("#cccccc"), print qq! CHECKED! if $cust_main->tax eq "Y"; print qq!>Tax Exempt</TD></TR>!; print qq!<TR><TD><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"!; -@invoicing_list = $cust_main->invoicing_list; +my @invoicing_list = $cust_main->invoicing_list; print qq! CHECKED! if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) || grep { $_ eq 'POST' } @invoicing_list; print qq!>Postal mail invoice</TD></TR>!; -$invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); +my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); print qq!<TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="$invoicing_list"></TD></TR>!; print "<TR><TD>Billing type</TD></TR>", "</TABLE>", &table("#cccccc"), "<TR>"; -($payinfo, $payname)=( +my($payinfo, $payname)=( $cust_main->payinfo, $cust_main->payname, ); -%payby = ( +my %payby = ( 'CARD' => qq!Credit card<BR>${r}<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR>${r}Exp !. expselect("CARD"). qq!<BR>${r}Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="">!, 'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE=""><BR>${r}Exp !. expselect("BILL", "12-2037"). qq!<BR>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="">!, 'COMP' => qq!Complimentary<BR>${r}Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR>${r}Exp !. expselect("COMP"), ); -%paybychecked = ( +my %paybychecked = ( 'CARD' => qq!Credit card<BR>${r}<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR>${r}Exp !. expselect("CARD", $cust_main->paydate). qq!<BR>${r}Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname">!, 'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR>${r}Exp !. expselect("BILL", $cust_main->paydate). qq!<BR>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!, 'COMP' => qq!Complimentary<BR>${r}Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR>${r}Exp !. expselect("COMP", $cust_main->paydate), @@ -434,8 +417,8 @@ unless ( $custnum ) { #false laziness: (mostly) copied from edit/svc_acct.cgi #$ulen = $svc_acct->dbdef_table->column('username')->length; - $ulen = dbdef->table('svc_acct')->column('username')->length; - $ulen2 = $ulen+2; + my $ulen = dbdef->table('svc_acct')->column('username')->length; + my $ulen2 = $ulen+2; my $passwordmax = $conf->config('passwordmax') || 8; my $pmax2 = $passwordmax + 2; print <<END; @@ -454,7 +437,7 @@ END } } -$otaker = $cust_main->otaker; +my $otaker = $cust_main->otaker; print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!, qq!<BR><INPUT TYPE="submit" VALUE="!, $custnum ? "Apply Changes" : "Add Customer", qq!">!, diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi index f5dc32372..092a2d068 100755 --- a/httemplate/edit/cust_main_county-expand.cgi +++ b/httemplate/edit/cust_main_county-expand.cgi @@ -1,19 +1,7 @@ +<!-- $Id: cust_main_county-expand.cgi,v 1.6 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_main_county-expand.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar popurl); -use FS::cust_main_county; - -$cgi = new CGI; - -&cgisuidsetup($cgi); +my($taxnum, $delim, $expansion ); if ( $cgi->param('error') ) { $taxnum = $cgi->param('taxnum'); $delim = $cgi->param('delim'); @@ -27,11 +15,11 @@ if ( $cgi->param('error') ) { $expansion = ''; } -$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) +my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) or die "cust_main_county.taxnum $taxnum not found"; die "Can't expand entry!" if $cust_main_county->getfield('county'); -$p1 = popurl(1); +my $p1 = popurl(1); print header("Tax Rate (expand)", menubar( 'Main Menu' => popurl(2), )); diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index f88601281..69def0468 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -1,18 +1,5 @@ +<!-- $Id: cust_main_county.cgi,v 1.6 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_main_county.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $cust_main_county ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar popurl table); -use FS::cust_main_county; - -$cgi = new CGI; - -&cgisuidsetup($cgi); print header("Edit tax rates", menubar( 'Main Menu' => popurl(2), @@ -32,10 +19,10 @@ print qq!<FORM ACTION="!, popurl(1), </TR> END -foreach $cust_main_county ( sort { $a->country cmp $b->country - or $a->state cmp $b->state - or $a->county cmp $b->county - } qsearch('cust_main_county',{}) ) { +foreach my $cust_main_county ( sort { $a->country cmp $b->country + or $a->state cmp $b->state + or $a->county cmp $b->county + } qsearch('cust_main_county',{}) ) { my($hashref)=$cust_main_county->hashref; print <<END; <TR> diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 83f3cb872..2794e2218 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,20 +1,9 @@ +<!-- $Id: cust_pay.cgi,v 1.11 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_pay.cgi,v 1.10 2001-12-26 06:02:48 ivan Exp $ --> - -use strict; -use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid $quickpay ); -use Date::Format; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::Conf; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl ntable small_custview); my $conf = new FS::Conf; -$cgi = new CGI; -cgisuidsetup($cgi); - +my($link, $linknum, $paid, $payby, $payinfo, $quickpay); if ( $cgi->param('error') ) { $link = $cgi->param('link'); $linknum = $cgi->param('linknum'); @@ -41,9 +30,9 @@ if ( $cgi->param('error') ) { } else { die "illegal query ". $cgi->keywords; } -$_date = time; +my $_date = time; -$p1 = popurl(1); +my $p1 = popurl(1); print header("Post payment", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 73b190786..c11a194b2 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,27 +1,14 @@ +<!-- $Id: cust_pkg.cgi,v 1.6 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_pkg.cgi,v 1.5 2001-12-27 09:26:14 ivan Exp $ --> -use strict; -use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg - $cust_main $agent $type_pkgs $count %remove_pkg $pkgparts ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header popurl); -use FS::part_pkg; -use FS::type_pkgs; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -%pkg = (); -%comment = (); +my %pkg = (); +my %comment = (); foreach (qsearch('part_pkg', { 'disabled' => '' })) { $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } +my($custnum, %remove_pkg); if ( $cgi->param('error') ) { $custnum = $cgi->param('custnum'); %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); @@ -29,10 +16,10 @@ if ( $cgi->param('error') ) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $custnum = $1; - undef %remove_pkg; + %remove_pkg = (); } -$p1 = popurl(1); +my $p1 = popurl(1); print header("Add/Edit Packages", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), @@ -44,7 +31,7 @@ print qq!<FORM ACTION="${p1}process/cust_pkg.cgi" METHOD=POST>!; print qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!; #current packages -@cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); +my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); if (@cust_pkg) { print <<END; @@ -52,7 +39,7 @@ Current packages - select to remove (services are moved to a new package below) <BR><BR> END - my ($count) = 0 ; + my $count = 0 ; print qq!<TABLE>! ; foreach (@cust_pkg) { print '<TR>' if $count == 0; @@ -74,13 +61,13 @@ print <<END; Order new packages<BR><BR> END -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); -$agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); -$count = 0; -$pkgparts = 0; +my $count = 0; +my $pkgparts = 0; print qq!<TABLE>!; -foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { +foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $pkgparts++; my($pkgpart)=$type_pkgs->pkgpart; next unless exists $pkg{$pkgpart}; #skip disabled ones diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index 41d6666dc..939eff360 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -1,4 +1,4 @@ -<!-- $Id: part_bill_event.cgi,v 1.1 2002-01-29 16:33:16 ivan Exp $ --> +<!-- $Id: part_bill_event.cgi,v 1.2 2002-01-30 14:18:08 ivan Exp $ --> <% @@ -71,42 +71,57 @@ print '<TR><TD ALIGN="right">Action</TD><TD>'; #this is pretty kludgy right here. tie my %events, 'Tie::IxHash', - 'Charge a fee' => { - 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', - 'html' => 'Amount <INPUT TYPE="text" SIZE="7" NAME="charge"><BR>'. + 'fee' => { + 'name' => 'Late fee', + 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', + 'html' => 'Amount <INPUT TYPE="text" SIZE="7" NAME="charge"><BR>'. 'Reason <INPUT TYPE="text" NAME="reason">', + 'weight' => 10, }, - 'Suspend accounts' => { - 'code' => '$cust_main->suspend();', + 'suspend' => { + 'name' => 'Suspend', + 'code' => '$cust_main->suspend();', + 'weight' => 10, }, - 'Cancel accounts' => { - 'code' => '$cust_main->cancel();', + 'cancel' => { + 'name' => 'Cancel', + 'code' => '$cust_main->cancel();', + 'weight' => 10, }, - 'Add postal invoicing' => { + 'addpost' => { + 'name' => 'Add postal invoicing', 'code' => '$cust_main->invoicing_list_addpost();', - 'pad' => 10, + 'pad' => 20, + }, + + 'send' => { + 'name' => 'Send invoice (email/print)', + 'code' => '', + 'weight' => 30 }, 'Generate invoices' => { 'code' => '$cust_main->bill();', - 'pad' => 20, + 'pad' => 40, }, 'Apply unapplied payments and credits' => { 'code' => '$cust_main->apply_payments; $cust_main->apply_credits;', - 'pad' => 30, + 'pad' => 50, }, 'Collect on invoices' => { 'code' => '$cust_main->collect();', - 'pad' => 40, + 'pad' => 60, }, ; foreach my $event ( keys %events ) { - print ntable( "#cccccc", 2). qq!<TR><TD><INPUT TYPE="radio" NAME="eventcode" VALUE="!. + print ntable( "#cccccc", 2). + qq!<TR><TD><INPUT TYPE="radio" NAME="eventcode" VALUE="!. + $events{$event}{weight}. ":". encode_entities($events{$event}{code}). qq!">$event</TD>!; print '<TD>'. $events{$event}{html}. '</TD>' if exists $events{$event}{html}; print qq!</TR>!; @@ -121,7 +136,7 @@ print <<END; END print qq!<INPUT TYPE="submit" VALUE="!, - $hashref->{pkgpart} ? "Apply changes" : "Add invoice event", + $hashref->{eventpart} ? "Apply changes" : "Add invoice event", qq!">!; %> diff --git a/httemplate/edit/part_referral.cgi b/httemplate/edit/part_referral.cgi index 09344b956..18f6aa938 100755 --- a/httemplate/edit/part_referral.cgi +++ b/httemplate/edit/part_referral.cgi @@ -1,19 +1,7 @@ +<!-- $Id: part_referral.cgi,v 1.5 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: part_referral.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $part_referral $action $hashref $p1 $query ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::part_referral; -use FS::CGI qw(header menubar popurl); - -$cgi = new CGI; - -&cgisuidsetup($cgi); +my $part_referral; if ( $cgi->param('error') ) { $part_referral = new FS::part_referral ( { map { $_, scalar($cgi->param($_)) } fields('part_referral') @@ -25,10 +13,10 @@ if ( $cgi->param('error') ) { } else { #adding $part_referral = new FS::part_referral {}; } -$action = $part_referral->refnum ? 'Edit' : 'Add'; -$hashref = $part_referral->hashref; +my $action = $part_referral->refnum ? 'Edit' : 'Add'; +my $hashref = $part_referral->hashref; -$p1 = popurl(1); +my $p1 = popurl(1); print header("$action Referral", menubar( 'Main Menu' => popurl(2), 'View all referrals' => popurl(2). "browse/part_referral.cgi", diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index f2555a29f..39f49e14c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -1,4 +1,4 @@ -<!-- $Id: part_svc.cgi,v 1.13 2001-12-27 09:26:14 ivan Exp $ --> +<!-- $Id: part_svc.cgi,v 1.14 2002-01-30 14:18:08 ivan Exp $ --> <% my $part_svc; if ( $cgi->param('error') ) { #error @@ -51,7 +51,7 @@ 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>depreciated</B> (use svc_forward for new installations) Virtual domain mail aliasing. + <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_charge - One-time charges (Partially unimplemented) @@ -181,8 +181,8 @@ function fixup(what) { <INPUT TYPE="hidden" NAME="disabled" VALUE="<%= $hashref->{disabled} %>"> <INPUT TYPE="hidden" NAME="svcdb" VALUE="<%= $svcdb %>"> <% - print "$svcdb" unless $svcdb eq 'konq_kludge'; - print "<BR><TABLE BORDER=1><TH>Field</TH><TH COLSPAN=2>Modifier</TH>" unless $svcdb eq 'konq_kludge'; + #print "$svcdb<BR>" unless $svcdb eq 'konq_kludge'; + print table(). "<TH>Field</TH><TH COLSPAN=2>Modifier</TH>" unless $svcdb eq 'konq_kludge'; foreach my $field (@fields) { my $part_svc_column = $part_svc->part_svc_column($field); diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi index b93df48d1..93ce4f9f2 100755 --- a/httemplate/edit/process/agent.cgi +++ b/httemplate/edit/process/agent.cgi @@ -1,29 +1,17 @@ +<!-- $Id: agent.cgi,v 1.3 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: agent.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw ( $cgi $agentnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::agent; -use FS::CGI qw(popurl); +my $agentnum = $cgi->param('agentnum'); -$cgi = new CGI; +my $old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; -&cgisuidsetup($cgi); - -$agentnum = $cgi->param('agentnum'); - -$old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; - -$new = new FS::agent ( { +my $new = new FS::agent ( { map { $_, scalar($cgi->param($_)); } fields('agent') } ); +my $error; if ( $agentnum ) { $error=$new->replace($old); } else { diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi index 37a382e62..2d1159708 100755 --- a/httemplate/edit/process/agent_type.cgi +++ b/httemplate/edit/process/agent_type.cgi @@ -1,29 +1,16 @@ +<!-- $Id: agent_type.cgi,v 1.3 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: agent_type.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw ( $cgi $typenum $old $new $error $part_pkg ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::CGI qw( popurl); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::agent_type; -use FS::type_pkgs; -use FS::part_pkg; +my $typenum = $cgi->param('typenum'); +my $old = qsearchs('agent_type',{'typenum'=>$typenum}) if $typenum; -$cgi = new CGI; -&cgisuidsetup($cgi); - -$typenum = $cgi->param('typenum'); -$old = qsearchs('agent_type',{'typenum'=>$typenum}) if $typenum; - -$new = new FS::agent_type ( { +my $new = new FS::agent_type ( { map { $_, scalar($cgi->param($_)); } fields('agent_type') } ); +my $error; if ( $typenum ) { $error=$new->replace($old); } else { @@ -37,7 +24,7 @@ if ( $error ) { exit; } -foreach $part_pkg (qsearch('part_pkg',{})) { +foreach my $part_pkg (qsearch('part_pkg',{})) { my($pkgpart)=$part_pkg->getfield('pkgpart'); my($type_pkgs)=qsearchs('type_pkgs',{ diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi index f0d403331..16d30bd4c 100755 --- a/httemplate/edit/process/cust_bill_pay.cgi +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -1,22 +1,8 @@ +<!-- $Id: cust_bill_pay.cgi,v 1.2 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_bill_pay.cgi,v 1.1 2001-12-18 19:30:31 ivan Exp $ --> - -use strict; -use vars qw( $cgi $custnum $paynum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs fields); -use FS::cust_pay; -use FS::cust_bill_pay; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; -$paynum = $1; +my $paynum = $1; my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ) or die "No such paynum"; @@ -26,14 +12,14 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } ) my $custnum = $cust_main->custnum; -$new = new FS::cust_bill_pay ( { +my $new = new FS::cust_bill_pay ( { map { $_, scalar($cgi->param($_)); #} qw(custnum _date amount invnum) } fields('cust_bill_pay') } ); -$error=$new->insert; +my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 3bbd749ce..51fca74e3 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -1,32 +1,19 @@ +<!-- $Id: cust_credit.cgi,v 1.6 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_credit.cgi,v 1.5 2001-12-26 15:11:33 ivan Exp $ --> - -use strict; -use vars qw( $cgi $custnum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(popurl); -use FS::Record qw(fields); -use FS::cust_credit; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; -$custnum = $1; +my $custnum = $1; $cgi->param('otaker',getotaker); -$new = new FS::cust_credit ( { +my $new = new FS::cust_credit ( { map { $_, scalar($cgi->param($_)); #} qw(custnum _date amount otaker reason) } fields('cust_credit') } ); -$error=$new->insert; +my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index e84894b04..afe297308 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,23 +1,8 @@ +<!-- $Id: cust_credit_bill.cgi,v 1.3 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: cust_credit_bill.cgi,v 1.2 2001-12-18 19:30:31 ivan Exp $ --> - -use strict; -use vars qw( $cgi $custnum $crednum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs fields); -use FS::cust_credit; -use FS::cust_credit_bill; -use FS::cust_refund; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; -$crednum = $1; +my $crednum = $1; my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ) or die "No such crednum"; @@ -27,6 +12,7 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_credit->custnum } ) my $custnum = $cust_main->custnum; +my $new; if ($cgi->param('invnum') =~ /^Refund$/) { $new = new FS::cust_refund ( { 'reason' => $cust_credit->reason, @@ -45,7 +31,7 @@ if ($cgi->param('invnum') =~ /^Refund$/) { } ); } -$error=$new->insert; +my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 625a85052..fa50dc626 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,22 +1,7 @@ +<!-- $Id: cust_main.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -# $Id: cust_main.cgi,v 1.5 2001-10-20 12:18:00 ivan Exp $ -use strict; -use vars qw( $cgi $payby @invoicing_list $new $custnum $error ); -use vars qw( $cust_pkg $cust_svc $svc_acct ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw( popurl ); -use FS::Record qw( qsearch qsearchs fields ); -use FS::cust_main; -use FS::type_pkgs; -use FS::agent; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$error = ''; +my $error = ''; #unmunge stuff @@ -37,7 +22,8 @@ $cgi->param('ship_state', $1); $cgi->param('ship_county', $3 || ''); $cgi->param('ship_country', $4); -if ( $payby = $cgi->param('payby') ) { +my $payby = $cgi->param('payby'); +if ( $payby ) { $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); $cgi->param('paydate', $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) ); @@ -46,12 +32,12 @@ if ( $payby = $cgi->param('payby') ) { $cgi->param('otaker', &getotaker ); -@invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); +my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); #create new record object -$new = new FS::cust_main ( { +my $new = new FS::cust_main ( { map { $_, scalar($cgi->param($_)) # } qw(custnum agentnum last first ss company address1 address2 city county @@ -68,8 +54,8 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { } #perhaps this stuff should go to cust_main.pm -$cust_pkg = ''; -$svc_acct = ''; +my $cust_pkg = ''; +my $svc_acct = ''; if ( $new->custnum eq '' ) { if ( $cgi->param('pkgpart_svcpart') ) { @@ -142,7 +128,6 @@ if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "cust_main.cgi?". $cgi->query_string ); } else { - $custnum = $new->custnum; - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + print $cgi->redirect(popurl(3). "view/cust_main.cgi?". $new->custnum); } %> diff --git a/httemplate/edit/process/cust_main_county-collapse.cgi b/httemplate/edit/process/cust_main_county-collapse.cgi index 62c2ba753..4888b781f 100755 --- a/httemplate/edit/process/cust_main_county-collapse.cgi +++ b/httemplate/edit/process/cust_main_county-collapse.cgi @@ -1,23 +1,10 @@ +<!-- $Id: cust_main_county-collapse.cgi,v 1.2 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: cust_main_county-collapse.cgi,v 1.1 2001-08-17 11:05:31 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $taxnum $cust_main_county @expansion $expansion ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup datasrc); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(popurl); -use FS::cust_main_county; -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "Illegal taxnum!"; -$taxnum = $1; -$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) +my $taxnum = $1; +my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) or die ("Unknown taxnum!"); #really should do this in a .pm & start transaction diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index 5adffc62f..b16fab4fe 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -1,24 +1,12 @@ +<!-- $Id: cust_main_county-expand.cgi,v 1.4 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: cust_main_county-expand.cgi,v 1.3 2001-08-31 07:17:33 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $taxnum $cust_main_county @expansion $expansion ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup datasrc); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(popurl); -use FS::cust_main_county; -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); $cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!"; -$taxnum = $1; -$cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) +my $taxnum = $1; +my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) or die ("Unknown taxnum!"); +my @expansion; if ( $cgi->param('delim') eq 'n' ) { @expansion=split(/\n/,$cgi->param('expansion')); } elsif ( $cgi->param('delim') eq 's' ) { diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi index 158a0d09e..0f0246b73 100755 --- a/httemplate/edit/process/cust_main_county.cgi +++ b/httemplate/edit/process/cust_main_county.cgi @@ -1,17 +1,5 @@ +<!-- $Id: cust_main_county.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cust_main_county.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(qsearch qsearchs); -use FS::cust_main_county; - -$cgi = new CGI; -&cgisuidsetup($cgi); foreach ( $cgi->param ) { /^tax(\d+)$/ or die "Illegal form $_!"; diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 630e8fc1b..c75e53280 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -1,27 +1,15 @@ +<!-- $Id: cust_pay.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cust_pay.cgi,v 1.5 2001-12-26 05:19:01 ivan Exp $ --> - -use strict; -use vars qw( $cgi $link $linknum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(fields); -use FS::cust_pay; - -$cgi = new CGI; -&cgisuidsetup($cgi); $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); -$linknum = $1; +my $linknum = $1; $cgi->param('link') =~ /^(custnum|invnum)$/ or die "Illegal link: ". $cgi->param('link'); -$link = $1; +my $link = $1; -$new = new FS::cust_pay ( { +my $new = new FS::cust_pay ( { $link => $linknum, map { $_, scalar($cgi->param($_)); @@ -29,7 +17,7 @@ $new = new FS::cust_pay ( { #} fields('cust_pay') } ); -$error = $new->insert; +my $error = $new->insert; if ($error) { $cgi->param('error', $error); diff --git a/httemplate/edit/process/cust_pkg.cgi b/httemplate/edit/process/cust_pkg.cgi index ecaec9bcb..25b320150 100755 --- a/httemplate/edit/process/cust_pkg.cgi +++ b/httemplate/edit/process/cust_pkg.cgi @@ -1,28 +1,19 @@ +<!-- $Id: cust_pkg.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cust_pkg.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw( $cgi $custnum @remove_pkgnums @pkgparts $pkgpart $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::cust_pkg; - -$cgi = new CGI; # create form object -&cgisuidsetup($cgi); -$error = ''; +my $error = ''; #untaint custnum $cgi->param('custnum') =~ /^(\d+)$/; -$custnum = $1; +my $custnum = $1; -@remove_pkgnums = map { +my @remove_pkgnums = map { /^(\d+)$/ or die "Illegal remove_pkg value!"; $1; } $cgi->param('remove_pkg'); -foreach $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { +my @pkgparts; +foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { my $num_pkgs = $1; while ( $num_pkgs-- ) { diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 08bc9b723..2ba1cbeb0 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -1,23 +1,11 @@ +<!-- $Id: part_pkg.cgi,v 1.7 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: part_pkg.cgi,v 1.6 2001-12-27 09:26:14 ivan Exp $ --> -use strict; -use vars qw( $cgi $pkgpart $old $new $part_svc $error $dbh ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(qsearch qsearchs fields); -use FS::part_pkg; -use FS::pkg_svc; -use FS::cust_pkg; +my $dbh = dbh; -$cgi = new CGI; -$dbh = &cgisuidsetup($cgi); +my $pkgpart = $cgi->param('pkgpart'); -$pkgpart = $cgi->param('pkgpart'); - -$old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart; +my $old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart; #fixup plandata my $plandata = $cgi->param('plandata'); @@ -30,7 +18,7 @@ foreach (qw( setuptax recurtax disabled )) { $cgi->param($_, '') unless defined $cgi->param($_); } -$new = new FS::part_pkg ( { +my $new = new FS::part_pkg ( { map { $_, scalar($cgi->param($_)); } fields('part_pkg') @@ -41,7 +29,7 @@ $new = new FS::part_pkg ( { #most of the stuff below should move to part_pkg.pm -foreach $part_svc ( qsearch('part_svc', {} ) ) { +foreach my $part_svc ( qsearch('part_svc', {} ) ) { my $quantity = $cgi->param('pkg_svc'. $part_svc->svcpart) || 0; unless ( $quantity =~ /^(\d+)$/ ) { $cgi->param('error', "Illegal quantity" ); @@ -59,6 +47,7 @@ local $SIG{PIPE} = 'IGNORE'; local $FS::UID::AutoCommit = 0; +my $error; if ( $pkgpart ) { $error = $new->replace($old); } else { diff --git a/httemplate/edit/process/part_referral.cgi b/httemplate/edit/process/part_referral.cgi index ff94e3955..7e37db855 100755 --- a/httemplate/edit/process/part_referral.cgi +++ b/httemplate/edit/process/part_referral.cgi @@ -1,26 +1,15 @@ +<!-- $Id: part_referral.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: part_referral.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw( $cgi $refnum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::part_referral; -use FS::CGI qw(popurl); +my $refnum = $cgi->param('refnum'); -$cgi = new CGI; -&cgisuidsetup($cgi); - -$refnum = $cgi->param('refnum'); - -$new = new FS::part_referral ( { +my $new = new FS::part_referral ( { map { $_, scalar($cgi->param($_)); } fields('part_referral') } ); +my $error; if ( $refnum ) { my $old = qsearchs( 'part_referral', { 'refnum' =>$ refnum } ); die "(Old) Record not found!" unless $old; diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index c4f5172ad..29a954cc9 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -1,28 +1,16 @@ +<!-- $Id: quick-cust_pkg.cgi,v 1.4 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: quick-cust_pkg.cgi,v 1.3 2001-09-11 10:05:30 ivan Exp $ --> - -use strict; -use vars qw( $cgi $custnum $pkgpart $error ); #@remove_pkgnums @pkgparts -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::cust_pkg; - -$cgi = new CGI; # create form object -&cgisuidsetup($cgi); -$error = ''; #untaint custnum $cgi->param('custnum') =~ /^(\d+)$/ or eidiot 'illegal custnum '. $cgi->param('custnum'); -$custnum = $1; +my $custnum = $1; $cgi->param('pkgpart') =~ /^(\d+)$/ or eidiot 'illegal pkgpart '. $cgi->param('pkgpart'); -$pkgpart = $1; +my $pkgpart = $1; my @cust_pkg = (); -$error ||= FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, ); +my $error = FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, ); if ($error) { eidiot($error); diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index c500016e2..178d7d85a 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -1,21 +1,10 @@ +<!-- $Id: svc_acct.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_acct.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi $svcnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs fields); -use FS::svc_acct; - -$cgi = new CGI; -&cgisuidsetup($cgi); $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum = $1; +my $svcnum = $1; +my $old; if ( $svcnum ) { $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) or die "fatal: can't find account (svcnum $svcnum)!"; @@ -32,7 +21,7 @@ if ( $cgi->param('_password') eq '*HIDDEN*' ) { $cgi->param('_password',$old->getfield('_password')); } -$new = new FS::svc_acct ( { +my $new = new FS::svc_acct ( { map { $_, scalar($cgi->param($_)); #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir @@ -40,6 +29,7 @@ $new = new FS::svc_acct ( { } ( fields('svc_acct'), qw( pkgnum svcpart ) ) } ); +my $error; if ( $svcnum ) { $error = $new->replace($old); } else { diff --git a/httemplate/edit/process/svc_acct_pop.cgi b/httemplate/edit/process/svc_acct_pop.cgi index 2b870dc48..5d699f2f5 100755 --- a/httemplate/edit/process/svc_acct_pop.cgi +++ b/httemplate/edit/process/svc_acct_pop.cgi @@ -1,29 +1,17 @@ +<!-- $Id: svc_acct_pop.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_acct_pop.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw( $cgi $popnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::svc_acct_pop; -use FS::CGI qw(popurl); +my $popnum = $cgi->param('popnum'); -$cgi = new CGI; # create form object +my $old = qsearchs('svc_acct_pop',{'popnum'=>$popnum}) if $popnum; -&cgisuidsetup($cgi); - -$popnum = $cgi->param('popnum'); - -$old = qsearchs('svc_acct_pop',{'popnum'=>$popnum}) if $popnum; - -$new = new FS::svc_acct_pop ( { +my $new = new FS::svc_acct_pop ( { map { $_, scalar($cgi->param($_)); } fields('svc_acct_pop') } ); +my $error = ''; if ( $popnum ) { $error = $new->replace($old); } else { diff --git a/httemplate/edit/process/svc_acct_sm.cgi b/httemplate/edit/process/svc_acct_sm.cgi index 10afcc1f9..25cd88d5a 100755 --- a/httemplate/edit/process/svc_acct_sm.cgi +++ b/httemplate/edit/process/svc_acct_sm.cgi @@ -1,34 +1,23 @@ +<!-- $Id: svc_acct_sm.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_acct_sm.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi $svcnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::svc_acct_sm; -use FS::CGI qw(popurl); - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum =$1; +my $svcnum =$1; -$old = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) if $svcnum; +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] ); -$new = new FS::svc_acct_sm ( { +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 { diff --git a/httemplate/edit/process/svc_domain.cgi b/httemplate/edit/process/svc_domain.cgi index e52b68a15..0b7ec4928 100755 --- a/httemplate/edit/process/svc_domain.cgi +++ b/httemplate/edit/process/svc_domain.cgi @@ -1,31 +1,20 @@ +<!-- $Id: svc_domain.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_domain.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi $svcnum $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::svc_domain; -use FS::CGI qw(popurl); #remove this to actually test the domains! $FS::svc_domain::whois_hack = 1; -$cgi = new CGI; -&cgisuidsetup($cgi); - $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum = $1; +my $svcnum = $1; -$new = new FS::svc_domain ( { +my $new = new FS::svc_domain ( { map { $_, scalar($cgi->param($_)); #} qw(svcnum pkgnum svcpart domain action purpose) } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) ) } ); +my $error = ''; if ($cgi->param('svcnum')) { $error="Can't modify a domain!"; } else { diff --git a/httemplate/edit/process/svc_forward.cgi b/httemplate/edit/process/svc_forward.cgi index b013bd15f..5f0247fe5 100755 --- a/httemplate/edit/process/svc_forward.cgi +++ b/httemplate/edit/process/svc_forward.cgi @@ -1,29 +1,18 @@ +<!-- $Id: svc_forward.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_forward.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi $svcnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::svc_forward; -use FS::CGI qw(popurl); - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum =$1; +my $svcnum =$1; -$old = qsearchs('svc_forward',{'svcnum'=>$svcnum}) if $svcnum; +my $old = qsearchs('svc_forward',{'svcnum'=>$svcnum}) if $svcnum; -$new = new FS::svc_forward ( { +my $new = new FS::svc_forward ( { map { ($_, scalar($cgi->param($_))); } ( fields('svc_forward'), qw( pkgnum svcpart ) ) } ); +my $error = ''; if ( $svcnum ) { $error = $new->replace($old); } else { diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index ec4f66e20..681d8b5d9 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -1,28 +1,10 @@ +<!-- $Id: svc_acct.cgi,v 1.14 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: svc_acct.cgi,v 1.13 2001-12-12 19:42:21 ivan Exp $ --> - -use strict; -use vars qw( $conf $cgi @shells $action $svcnum $svc_acct $pkgnum $svcpart - $part_svc $svc $otaker $username $password $ulen $ulen2 - $pmax $pmax2 $p1 - $popnum $domsvc $uid $gid $finger $dir $shell $quota $slipip - %svc_domain ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl itable); -use FS::Record qw(qsearch qsearchs fields); -use FS::svc_acct; -use FS::svc_acct_pop qw(popselector); -use FS::Conf; -use FS::raddb; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -@shells = $conf->config('shells'); +my $conf = new FS::Conf; +my @shells = $conf->config('shells'); + +my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct); if ( $cgi->param('error') ) { $svc_acct = new FS::svc_acct ( { map { $_, scalar($cgi->param($_)) } fields('svc_acct') @@ -81,13 +63,14 @@ if ( $cgi->param('error') ) { } } -$action = $svcnum ? 'Edit' : 'Add'; +my $action = $svcnum ? 'Edit' : 'Add'; -$svc = $part_svc->getfield('svc'); +my $svc = $part_svc->getfield('svc'); -$otaker = getotaker; +my $otaker = getotaker; -$username = $svc_acct->username; +my $username = $svc_acct->username; +my $password; if ( $svc_acct->_password ) { if ( $conf->exists('showpasswords') ) { $password = $svc_acct->_password; @@ -98,13 +81,13 @@ if ( $svc_acct->_password ) { $password = ''; } -$ulen = $svc_acct->dbdef_table->column('username')->length; -$ulen2 = $ulen+2; +my $ulen = $svc_acct->dbdef_table->column('username')->length; +my $ulen2 = $ulen+2; -$pmax = $conf->config('passwordmax') || 8; -$pmax2 = $pmax+2; +my $pmax = $conf->config('passwordmax') || 8; +my $pmax2 = $pmax+2; -$p1 = popurl(1); +my $p1 = popurl(1); print header("$action $svc account"); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), @@ -131,7 +114,7 @@ print &itable("#cccccc",2), <<END; END #domain -$domsvc = $svc_acct->domsvc || 0; +my $domsvc = $svc_acct->domsvc || 0; if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) { print qq!<INPUT TYPE="hidden" NAME="domsvc" VALUE="$domsvc">!; } else { @@ -186,7 +169,7 @@ if ( $part_svc->part_svc_column('domsvc')->columnflag eq 'F' ) { } #pop -$popnum = $svc_acct->popnum || 0; +my $popnum = $svc_acct->popnum || 0; if ( $part_svc->part_svc_column('popnum')->columnflag eq "F" ) { print qq!<INPUT TYPE="hidden" NAME="popnum" VALUE="$popnum">!; } else { @@ -194,7 +177,7 @@ if ( $part_svc->part_svc_column('popnum')->columnflag eq "F" ) { qq!<TD>!. FS::svc_acct_pop::popselector($popnum). '</TD></TR>'; } -($uid,$gid,$finger,$dir)=( +my($uid,$gid,$finger,$dir)=( $svc_acct->uid, $svc_acct->gid, $svc_acct->finger, @@ -208,7 +191,7 @@ print <<END; <INPUT TYPE="hidden" NAME="dir" VALUE="$dir"> END -$shell = $svc_acct->shell; +my $shell = $svc_acct->shell; if ( $part_svc->part_svc_column('shell')->columnflag eq "F" ) { print qq!<INPUT TYPE="hidden" NAME="shell" VALUE="$shell">!; } else { @@ -221,7 +204,7 @@ if ( $part_svc->part_svc_column('shell')->columnflag eq "F" ) { print "</SELECT></TD></TR>"; } -($quota,$slipip)=( +my($quota,$slipip)=( $svc_acct->quota, $svc_acct->slipip, ); diff --git a/httemplate/edit/svc_acct_pop.cgi b/httemplate/edit/svc_acct_pop.cgi index 23caa794b..c984ef9e8 100755 --- a/httemplate/edit/svc_acct_pop.cgi +++ b/httemplate/edit/svc_acct_pop.cgi @@ -1,17 +1,7 @@ +<!-- $Id: svc_acct_pop.cgi,v 1.5 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: svc_acct_pop.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $svc_acct_pop $action $query $hashref $p1 ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs fields); -use FS::CGI qw(header menubar popurl); -use FS::svc_acct_pop; -$cgi = new CGI; -&cgisuidsetup($cgi); +my $svc_acct_pop; if ( $cgi->param('error') ) { $svc_acct_pop = new FS::svc_acct_pop ( { map { $_, scalar($cgi->param($_)) } fields('svc_acct_pop') @@ -23,10 +13,10 @@ if ( $cgi->param('error') ) { } else { #adding $svc_acct_pop = new FS::svc_acct_pop {}; } -$action = $svc_acct_pop->popnum ? 'Edit' : 'Add'; -$hashref = $svc_acct_pop->hashref; +my $action = $svc_acct_pop->popnum ? 'Edit' : 'Add'; +my $hashref = $svc_acct_pop->hashref; -$p1 = popurl(1); +my $p1 = popurl(1); print header("$action POP", menubar( 'Main Menu' => popurl(2), 'View all POPs' => popurl(2). "browse/svc_acct_pop.cgi", diff --git a/httemplate/edit/svc_acct_sm.cgi b/httemplate/edit/svc_acct_sm.cgi index baf0a7eb2..62a041da9 100755 --- a/httemplate/edit/svc_acct_sm.cgi +++ b/httemplate/edit/svc_acct_sm.cgi @@ -1,23 +1,10 @@ +<!-- $Id: svc_acct_sm.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: svc_acct_sm.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw( $conf $cgi $mydomain $action $svcnum $svc_acct_sm $pkgnum $svcpart - $part_svc $query %username %domain $p1 $domuser $domsvc $domuid ); -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_sm; -use FS::Conf; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); +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') @@ -25,8 +12,8 @@ if ( $cgi->param('error') ) { $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; + #$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + #die "No part_svc entry!" unless $part_svc; } else { my($query) = $cgi->keywords; if ( $query =~ /^(\d+)$/ ) { #editing @@ -40,8 +27,8 @@ if ( $cgi->param('error') ) { $pkgnum=$cust_svc->pkgnum; $svcpart=$cust_svc->svcpart; - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); - die "No part_svc entry!" unless $part_svc; + #$part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + #die "No part_svc entry!" unless $part_svc; } else { #adding @@ -51,7 +38,7 @@ if ( $cgi->param('error') ) { $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } - $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); + my $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; $svcnum=''; @@ -67,8 +54,10 @@ if ( $cgi->param('error') ) { } } -$action = $svc_acct_sm->svcnum ? 'Edit' : 'Add'; +my $action = $svc_acct_sm->svcnum ? 'Edit' : 'Add'; +my %username = (); +my %domain = (); if ($pkgnum) { #find all possible uids (and usernames) @@ -80,7 +69,6 @@ if ($pkgnum) { my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); my($custnum)=$cust_pkg->getfield('custnum'); - %username = (); foreach my $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); my($acct_svcpart); @@ -102,7 +90,6 @@ if ($pkgnum) { push @d_acct_svcparts,$d_part_svc->getfield('svcpart'); } - %domain = (); foreach $i_cust_pkg ( qsearch('cust_pkg',{'custnum'=>$custnum}) ) { my($cust_pkgnum)=$i_cust_pkg->getfield('pkgnum'); my($acct_svcpart); @@ -127,7 +114,7 @@ if ($pkgnum) { die "\$action eq Add, but \$pkgnum is null!\n"; } -$p1 = popurl(1); +my $p1 = popurl(1); print header("Mail Alias $action", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), @@ -151,7 +138,7 @@ print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!; #svcpart print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!; -($domuser,$domsvc,$domuid)=( +my($domuser,$domsvc,$domuid)=( $svc_acct_sm->domuser, $svc_acct_sm->domsvc, $svc_acct_sm->domuid, diff --git a/httemplate/edit/svc_domain.cgi b/httemplate/edit/svc_domain.cgi index 713b2ccd7..57ee941f9 100755 --- a/httemplate/edit/svc_domain.cgi +++ b/httemplate/edit/svc_domain.cgi @@ -1,19 +1,8 @@ +<!-- $Id: svc_domain.cgi,v 1.7 2002-01-30 14:18:08 ivan Exp $ --> <% -#<!-- $Id: svc_domain.cgi,v 1.6 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw( $cgi $action $svcnum $svc_domain $pkgnum $svcpart $part_svc - $svc $otaker $domain $p1 $kludge_action $purpose ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch qsearchs fields); -use FS::svc_domain; - -$cgi = new CGI; -&cgisuidsetup($cgi); +my($svcnum, $pkgnum, $svcpart, $kludge_action, $purpose, $part_svc, + $svc_domain); if ( $cgi->param('error') ) { $svc_domain = new FS::svc_domain ( { map { $_, scalar($cgi->param($_)) } fields('svc_domain') @@ -65,18 +54,18 @@ if ( $cgi->param('error') ) { ); } - } + } -$action = $svcnum ? 'Edit' : 'Add'; +my $action = $svcnum ? 'Edit' : 'Add'; -$svc = $part_svc->getfield('svc'); +my $svc = $part_svc->getfield('svc'); -$otaker = getotaker; +my $otaker = getotaker; -$domain = $svc_domain->domain; +my $domain = $svc_domain->domain; -$p1 = popurl(1); +my $p1 = popurl(1); print header("$action $svc", ''); print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), diff --git a/httemplate/edit/svc_forward.cgi b/httemplate/edit/svc_forward.cgi index 75cd9fc7f..cda577b76 100755 --- a/httemplate/edit/svc_forward.cgi +++ b/httemplate/edit/svc_forward.cgi @@ -1,23 +1,10 @@ +<!-- $Id: svc_forward.cgi,v 1.8 2002-01-30 14:18:08 ivan Exp $ --> <% -# <!-- $Id: svc_forward.cgi,v 1.7 2001-12-04 13:10:16 ivan Exp $ --> -use strict; -use vars qw( $conf $cgi $mydomain $action $svcnum $svc_forward $pkgnum $svcpart - $part_svc $query %email $p1 $srcsvc $dstsvc $dst ); -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_forward; -use FS::Conf; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); +my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_forward); if ( $cgi->param('error') ) { $svc_forward = new FS::svc_forward ( { map { $_, scalar($cgi->param($_)) } fields('svc_forward') @@ -28,7 +15,9 @@ if ( $cgi->param('error') ) { $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_forward=qsearchs('svc_forward',{'svcnum'=>$svcnum}) @@ -64,12 +53,12 @@ if ( $cgi->param('error') ) { $part_svc_column->columnvalue, ); } - - } + } -$action = $svc_forward->svcnum ? 'Edit' : 'Add'; +my $action = $svc_forward->svcnum ? 'Edit' : 'Add'; +my %email; if ($pkgnum) { #find all possible user svcnums (and emails) @@ -122,7 +111,7 @@ if ($pkgnum) { die "\$action eq Add, but \$pkgnum is null!\n"; } -($srcsvc,$dstsvc,$dst)=( +my($srcsvc,$dstsvc,$dst)=( $svc_forward->srcsvc, $svc_forward->dstsvc, $svc_forward->dst, @@ -130,7 +119,7 @@ if ($pkgnum) { #display -$p1 = popurl(1); +my $p1 = popurl(1); print header("Mail Forward $action", '', " onLoad=\"visualize()\""); diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi index 48da25562..731309585 100755 --- a/httemplate/misc/bill.cgi +++ b/httemplate/misc/bill.cgi @@ -1,27 +1,14 @@ +<!-- $Id: bill.cgi,v 1.5 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: bill.cgi,v 1.4 2001-10-15 12:16:42 ivan Exp $ --> - -use strict; -use vars qw( $cgi $query $custnum $cust_main $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -#use FS::CGI qw(popurl eidiot); -use FS::CGI qw(popurl idiot); -use FS::Record qw(qsearchs); -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); #untaint custnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d*)$/; -$custnum = $1; -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Can't find customer!\n" unless $cust_main; -$error = $cust_main->bill( +my $error = $cust_main->bill( # 'time'=>$time ); #&eidiot($error) if $error; diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi index 9b90967d9..3e2bd07db 100755 --- a/httemplate/misc/cancel-unaudited.cgi +++ b/httemplate/misc/cancel-unaudited.cgi @@ -1,28 +1,16 @@ -<% -#<!-- $Id: cancel-unaudited.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi $query $svcnum $svc_acct $cust_svc $error $dbh ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_svc; -use FS::svc_acct; - -$cgi = new CGI; -$dbh = &cgisuidsetup($cgi); +<!-- $Id: cancel-unaudited.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> + +my $dbh = dbh; #untaint svcnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; +my $svcnum = $1; -$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); die "Unknown svcnum!" unless $svc_acct; -$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); &eidiot(qq!This account has already been audited. Cancel the <A HREF="!. popurl(2). qq!view/cust_pkg.cgi?! . $cust_svc->getfield('pkgnum') . qq!pkgnum"> package</A> instead.!) @@ -36,7 +24,7 @@ local $SIG{TSTP} = 'IGNORE'; local $FS::UID::AutoCommit = 0; -$error = $svc_acct->cancel; +my $error = $svc_acct->cancel; &myeidiot($error) if $error; $error = $svc_acct->delete; &myeidiot($error) if $error; diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi index 8129463ae..1513ef05e 100755 --- a/httemplate/misc/cancel_pkg.cgi +++ b/httemplate/misc/cancel_pkg.cgi @@ -1,29 +1,16 @@ +<!-- $Id: cancel_pkg.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cancel_pkg.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw ( $cgi $query $pkgnum $cust_pkg $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(eidiot popurl); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl eidiot); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); - #untaint pkgnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -$error = $cust_pkg->cancel; +my $error = $cust_pkg->cancel; eidiot($error) if $error; -print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); +print $cgi->redirect($p. "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); %> 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 @@ +<!-- $Id: catchall.cgi,v 1.5 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: catchall.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> - -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!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), @@ -117,7 +103,7 @@ print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">!; #svcpart print qq!<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">!; -($domain,$catchall)=( +my($domain,$catchall)=( $svc_domain->domain, $svc_domain->catchall, ); diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi index d3e7c798f..18f6e8529 100755 --- a/httemplate/misc/delete-customer.cgi +++ b/httemplate/misc/delete-customer.cgi @@ -1,31 +1,20 @@ +<!-- $Id: delete-customer.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: delete-customer.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw( $cgi $conf $query $custnum $new_custnum $cust_main ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); -use FS::Record qw(qsearch qsearchs); -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); +my($custnum, $new_custnum); if ( $cgi->param('error') ) { $custnum = $cgi->param('custnum'); $new_custnum = $cgi->param('new_custnum'); } else { - ($query) = $cgi->keywords; + my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "Illegal query: $query"; $custnum = $1; $new_custnum = ''; } -$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) +my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; print header('Delete customer'); diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi index 21e220d18..739fb517f 100755 --- a/httemplate/misc/expire_pkg.cgi +++ b/httemplate/misc/expire_pkg.cgi @@ -1,21 +1,9 @@ +<!-- $Id: expire_pkg.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: expire_pkg.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $date $pkgnum $cust_pkg %hash $new $error ); -use Date::Parse; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); #untaint date & pkgnum +my $date; if ( $cgi->param('date') ) { str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date"; $date=$1; @@ -24,13 +12,13 @@ if ( $cgi->param('date') ) { } $cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -%hash = $cust_pkg->hash; +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my %hash = $cust_pkg->hash; $hash{expire}=$date; -$new = new FS::cust_pkg ( \%hash ); -$error = $new->replace($cust_pkg); +my $new = new FS::cust_pkg ( \%hash ); +my $error = $new->replace($cust_pkg); &eidiot($error) if $error; print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); diff --git a/httemplate/misc/link.cgi b/httemplate/misc/link.cgi index 801b92006..3bcb5d978 100755 --- a/httemplate/misc/link.cgi +++ b/httemplate/misc/link.cgi @@ -1,16 +1,7 @@ +<!-- $Id: link.cgi,v 1.5 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: link.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw ( %link_field $cgi $pkgnum $svcpart $query $part_svc $svc $svcdb - $link_field ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header); -use FS::Record qw(qsearchs); - -%link_field = ( +my %link_field = ( 'svc_acct' => 'username', 'svc_domain' => 'domain', 'svc_acct_sm' => '', @@ -18,19 +9,17 @@ use FS::Record qw(qsearchs); 'svc_wo' => '', ); -$cgi = new CGI; -cgisuidsetup($cgi); - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; +my($pkgnum, $svcpart) = ('', ''); foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart $pkgnum=$1 if /^pkgnum(\d+)$/; $svcpart=$1 if /^svcpart(\d+)$/; } -$part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); -$svc = $part_svc->getfield('svc'); -$svcdb = $part_svc->getfield('svcdb'); -$link_field = $link_field{$svcdb}; +my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); +my $svc = $part_svc->getfield('svc'); +my $svcdb = $part_svc->getfield('svcdb'); +my $link_field = $link_field{$svcdb}; print header("Link to existing $svc"), qq!<FORM ACTION="!, popurl(1), qq!process/link.cgi" METHOD=POST>!; diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index a6cb05230..aec7cb39c 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -1,26 +1,14 @@ +<!-- $Id: print-invoice.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: print-invoice.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw($conf $cgi $lpr $query $invnum $cust_bill $custnum ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl); -use FS::Record qw(qsearchs); -use FS::cust_bill; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$lpr = $conf->config('lpr'); +my $conf = new FS::Conf; +my $lpr = $conf->config('lpr'); #untaint invnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d*)$/; -$invnum = $1; -$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +my $invnum = $1; +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; open(LPR,"|$lpr") or die "Can't open $lpr: $!"; @@ -29,7 +17,7 @@ die "Can't find invoice!\n" unless $cust_bill; or die $! ? "Error closing $lpr: $!" : "Exit status $? from $lpr"; -$custnum = $cust_bill->getfield('custnum'); +my $custnum = $cust_bill->getfield('custnum'); print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index 6b1147633..cf6f8d751 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,26 +1,14 @@ +<!--$Id: catchall.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!--$Id: catchall.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw( $cgi $svcnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::svc_domain; -use FS::CGI qw(popurl); $FS::svc_domain::whois_hack=1; -$cgi = new CGI; -cgisuidsetup($cgi); - $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum =$1; +my $svcnum =$1; -$old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; +my $old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; -$new = new FS::svc_domain ( { +my $new = new FS::svc_domain ( { map { ($_, scalar($cgi->param($_))); } ( fields('svc_domain'), qw( pkgnum svcpart ) ) @@ -28,6 +16,7 @@ $new = new FS::svc_domain ( { $new->setfield('action' => 'M'); +my $error; if ( $svcnum ) { $error = $new->replace($old); } else { diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index 4be52004b..6f26c8107 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,23 +1,12 @@ +<!-- $Id: delete-customer.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: delete-customer.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl); -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); $cgi->param('custnum') =~ /^(\d+)$/; -$custnum = $1; +my $custnum = $1; +my $new_custnum; if ( $cgi->param('new_custnum') ) { $cgi->param('new_custnum') =~ /^(\d+)$/ or die "Illegal new customer number: ". $cgi->param('new_custnum'); @@ -25,10 +14,10 @@ if ( $cgi->param('new_custnum') ) { } else { $new_custnum = ''; } -$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) +my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -$error = $cust_main->delete($new_custnum); +my $error = $cust_main->delete($new_custnum); if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 6b34e8a5d..80a5de81f 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,24 +1,12 @@ +<!-- $Id: link.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: link.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::CGI qw(popurl idiot eidiot); -use FS::UID qw(cgisuidsetup); -use FS::cust_svc; -use FS::Record qw(qsearchs); - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('pkgnum') =~ /^(\d+)$/; -$pkgnum = $1; +my $pkgnum = $1; $cgi->param('svcpart') =~ /^(\d+)$/; -$svcpart = $1; +my $svcpart = $1; $cgi->param('svcnum') =~ /^(\d*)$/; -$svcnum = $1; +my $svcnum = $1; unless ( $svcnum ) { my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); @@ -29,15 +17,15 @@ unless ( $svcnum ) { $svcnum=$svc_acct->svcnum; } -$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; -$new = new FS::cust_svc ({ +my $new = new FS::cust_svc ({ 'svcnum' => $svcnum, 'pkgnum' => $pkgnum, 'svcpart' => $svcpart, }); -$error = $new->replace($old); +my $error = $new->replace($old); unless ($error) { #no errors, so let's view this customer. diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi index 602314436..efc2f9bba 100755 --- a/httemplate/misc/susp_pkg.cgi +++ b/httemplate/misc/susp_pkg.cgi @@ -1,26 +1,14 @@ +<!-- $Id: susp_pkg.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: susp_pkg.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw( $cgi $query $pkgnum $cust_pkg $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl eidiot); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); - #untaint pkgnum -($query) = $cgi->keywords; +my ($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -$error = $cust_pkg->suspend; +my $error = $cust_pkg->suspend; &eidiot($error) if $error; print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); diff --git a/httemplate/misc/unsusp_pkg.cgi b/httemplate/misc/unsusp_pkg.cgi index 8e1b5261b..00f3a08b3 100755 --- a/httemplate/misc/unsusp_pkg.cgi +++ b/httemplate/misc/unsusp_pkg.cgi @@ -1,26 +1,14 @@ +<!-- $Id: unsusp_pkg.cgi,v 1.3 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: unsusp_pkg.cgi,v 1.2 2001-08-21 02:31:56 ivan Exp $ --> -use strict; -use vars qw( $cgi $query $pkgnum $cust_pkg $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl eidiot); -use FS::Record qw(qsearchs); -use FS::cust_pkg; - -$cgi = new CGI; -&cgisuidsetup($cgi); - #untaint pkgnum -($query) = $cgi->keywords; +my ($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal pkgnum"; -$pkgnum = $1; +my $pkgnum = $1; -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -$error = $cust_pkg->unsuspend; +my $error = $cust_pkg->unsuspend; &eidiot($error) if $error; print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')); diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 41a4a546e..755745fde 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,20 +1,7 @@ +<!-- $Id: cust_bill.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cust_bill.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $invnum $query $sortby @cust_bill ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header menubar eidiot table ); -use FS::Record qw(qsearch qsearchs); -use FS::cust_bill; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); +my(@cust_bill, $sortby); if ( $cgi->keywords ) { my($query) = $cgi->keywords; if ( $query eq 'invnum' ) { @@ -55,7 +42,7 @@ if ( $cgi->keywords ) { } } else { $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; - $invnum = $2; + my $invnum = $2; @cust_bill = qsearchs('cust_bill', { 'invnum' => $invnum } ); $sortby = \*invnum_sort; } diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 65db0a815..f21dd7ed1 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,27 +1,7 @@ <% -#<!-- $Id: cust_main.cgi,v 1.20 2002-01-09 13:29:34 ivan Exp $ --> - -use strict; -#use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); -#use vars qw( $conf %all_pkgs $cgi @cust_main $sortby ); -use vars qw( $conf %all_pkgs $cgi @cust_main $sortby - $orderby $maxrecords $limit $offset ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use IO::Handle; -use String::Approx qw(amatch); -use FS::UID qw(dbh cgisuidsetup); -use FS::Conf; -use FS::Record qw(qsearch qsearchs dbdef jsearch); -use FS::CGI qw(header menubar eidiot popurl table); -use FS::cust_main; -use FS::cust_svc; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; -$maxrecords = $conf->config('maxsearchrecordsperpage'); + +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); #my $cache; @@ -59,16 +39,15 @@ $maxrecords = $conf->config('maxsearchrecordsperpage'); #) using (custnum) #END -$orderby = ''; #removeme - -$limit = ''; +my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; -$offset = $cgi->param('offset') || 0; +my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; my $total; +my(@cust_main, $sortby, $orderby); if ( $cgi->param('browse') ) { my $query = $cgi->param('browse'); if ( $query eq 'custnum' ) { @@ -135,10 +114,21 @@ if ( $cgi->param('browse') ) { } else { @cust_main=(); - &cardsearch if $cgi->param('card_on') && $cgi->param('card'); - &lastsearch if $cgi->param('last_on') && $cgi->param('last_text'); - &companysearch if $cgi->param('company_on') && $cgi->param('company_text'); - &referralsearch if $cgi->param('referral_custnum'); + $sortby = \*last_sort; + + push @cust_main, @{&cardsearch} + if $cgi->param('card_on') && $cgi->param('card'); + push @cust_main, @{&lastsearch} + if $cgi->param('last_on') && $cgi->param('last_text'); + push @cust_main, @{&companysearch} + if $cgi->param('company_on') && $cgi->param('company_text'); + push @cust_main, @{&referralsearch} + if $cgi->param('referral_custnum'); + + if ( $cgi->param('company_on') && $cgi->param('company_text') ) { + $sortby = \*company_sort; + push @cust_main, @{&companysearch}; + } @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me @@ -146,6 +136,7 @@ if ( $cgi->param('browse') ) { && ! $cgi->param('showcancelledcustomers') ); } +my %all_pkgs; if ( $conf->exists('hidecancelledpackages' ) ) { %all_pkgs = map { $_->custnum => [ $_->ncancelled_pkgs ] } @cust_main; } else { @@ -368,8 +359,7 @@ sub cardsearch { $card =~ /^(\d{13,16})$/ or eidiot "Illegal card number\n"; my($payinfo)=$1; - push @cust_main, qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}); - $sortby=\*last_sort; + [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}) ]; } sub referralsearch { @@ -385,12 +375,12 @@ sub referralsearch { } else { $depth = 1; } - push @cust_main, $cust_main->referral_cust_main($depth); - $sortby=\*last_sort; + [ $cust_main->referral_cust_main($depth) ]; } sub lastsearch { my(%last_type); + my @cust_main; foreach ( $cgi->param('last_type') ) { $last_type{$_}++; } @@ -432,12 +422,13 @@ sub lastsearch { } } - $sortby=\*last_sort; + \@cust_main; } sub companysearch { my(%company_type); + my @cust_main; foreach ( $cgi->param('company_type') ) { $company_type{$_}++ }; @@ -479,7 +470,7 @@ sub companysearch { } } - $sortby=\*company_sort; + \@cust_main; } %> diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index 68a17e7dc..715e63e24 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -1,27 +1,13 @@ +<!-- $Id: cust_pay.cgi,v 1.2 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cust_pay.cgi,v 1.1 2001-12-26 09:18:18 ivan Exp $ --> - -use strict; -use vars qw( $cgi $sortby @cust_pay ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header menubar idiot table ); -use FS::Record qw(qsearch ); -use FS::cust_pay; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo"; my $payinfo = $1; $cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby"; my $payby = $1; -@cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo, - 'payby' => $payby } ); -$sortby = \*date_sort; +my @cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo, + 'payby' => $payby } ); +my $sortby = \*date_sort; if (0) { #if ( scalar(@cust_pay) == 1 ) { diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index dabcf46fb..9705bd658 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,38 +1,22 @@ +<!-- $Id: cust_pkg.cgi,v 1.13 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: cust_pkg.cgi,v 1.12 2001-12-18 07:12:00 ivan Exp $ --> -use strict; -use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg - $conf $maxrecords $limit $offset ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(dbh cgisuidsetup); -use FS::Conf; -use FS::Record qw(qsearch qsearchs dbdef); -use FS::CGI qw(header eidiot popurl table); -use FS::cust_pkg; -use FS::pkg_svc; -use FS::cust_svc; -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$maxrecords = $conf->config('maxsearchrecordsperpage'); +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {}); -$limit = ''; +my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; -$offset = $cgi->param('offset') || 0; +my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; my $total; my $unconf = ''; -($query) = $cgi->keywords; +my($query) = $cgi->keywords; +my $sortby; if ( $query eq 'pkgnum' ) { $sortby=\*pkgnum_sort; @@ -86,7 +70,7 @@ $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; $total = $sth->fetchrow_arrayref->[0]; -@cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); +my @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); if ( scalar(@cust_pkg) == 1 ) { diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index c9d1eb6ca..8d5329618 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,36 +1,22 @@ +<!-- $Id: svc_acct.cgi,v 1.13 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: svc_acct.cgi,v 1.12 2001-12-11 21:26:58 ivan Exp $ --> -use strict; -use vars qw( $cgi @svc_acct $sortby $query $mydomain - $conf $maxrecords $limit $offset ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs dbdef); -use FS::CGI qw(header idiot popurl table); -use FS::svc_acct; -use FS::cust_main; +my $mydomain = ''; -$mydomain = ''; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$maxrecords = $conf->config('maxsearchrecordsperpage'); +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); my $orderby = ''; #removeme -$limit = ''; +my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; -$offset = $cgi->param('offset') || 0; +my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; my $total; -($query)=$cgi->keywords; +my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors my $unlinked = ''; @@ -45,6 +31,7 @@ if ( $query =~ /^UN_(.*)$/ ) { '; } +my(@svc_acct, $sortby); if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; $orderby = 'ORDER BY svcnum'; @@ -56,7 +43,7 @@ if ( $query eq 'svcnum' ) { $orderby = ( $unlinked ? 'AND' : 'WHERE' ). ' uid IS NOT NULL ORDER BY uid'; } else { $sortby=\*uid_sort; - &usernamesearch; + @svc_acct = @{&usernamesearch}; } if ( $query eq 'svcnum' || $query eq 'username' || $query eq 'uid' ) { @@ -245,9 +232,8 @@ sub usernamesearch { $cgi->param('username') =~ /^([\w\d\-]+)$/; #untaint username_text my($username)=$1; - @svc_acct=qsearch('svc_acct',{'username'=>$username}); + [ qsearch('svc_acct',{'username'=>$username}) ]; } - %> diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi index 5250b5ca1..1f1f770be 100755 --- a/httemplate/search/svc_acct_sm.cgi +++ b/httemplate/search/svc_acct_sm.cgi @@ -1,32 +1,18 @@ +<!-- $Id: svc_acct_sm.cgi,v 1.5 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_acct_sm.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw( $conf $cgi $mydomain $domuser $svc_domain $domsvc @svc_acct_sm ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl idiot header table); -use FS::Record qw(qsearch qsearchs); -use FS::Conf; -use FS::svc_domain; -use FS::svc_acct_sm; -use FS::svc_acct; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); $cgi->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/; -$domuser = $1; +my $domuser = $1; $cgi->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain"; -$svc_domain = qsearchs('svc_domain',{'domain'=>$1}) +my $svc_domain = qsearchs('svc_domain',{'domain'=>$1}) or die "Unknown domain"; -$domsvc = $svc_domain->svcnum; +my $domsvc = $svc_domain->svcnum; +my @svc_acct_sm; if ($domuser) { @svc_acct_sm=qsearch('svc_acct_sm',{ 'domuser' => $domuser, diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index b09c65a0b..4ec5eb053 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,26 +1,12 @@ +<!-- $Id: svc_domain.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: svc_domain.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw ( $cgi @svc_domain $sortby $query $conf $mydomain ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header eidiot popurl); -use FS::svc_domain; -use FS::cust_svc; -use FS::svc_acct; -use FS::svc_forward; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); - -($query)=$cgi->keywords; + +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); + +my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors +my(@svc_domain,$sortby); if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; @svc_domain=qsearch('svc_domain',{}); @@ -69,9 +55,7 @@ END # my(%saw); # if we've multiple domains with the same # svcnum, then we've a corrupt database - my($svc_domain); - my $p = popurl(2); - foreach $svc_domain ( + foreach my $svc_domain ( # sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain) sort $sortby (@svc_domain) ) { diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index bbcf87fc2..ef6d56611 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,31 +1,17 @@ +<!-- $Id: cust_bill.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: cust_bill.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); -use IO::File; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl menubar); -use FS::Record qw(qsearchs); -use FS::cust_bill; - -$cgi = new CGI; -&cgisuidsetup($cgi); #untaint invnum -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$invnum = $1; +my $invnum = $1; -$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Invoice #$invnum not found!" unless $cust_bill; -$custnum = $cust_bill->getfield('custnum'); +my $custnum = $cust_bill->getfield('custnum'); -$printed = $cust_bill->printed; +my $printed = $cust_bill->printed; -$p = popurl(2); print header('Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8710dd19d..9595a07e1 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,45 +1,18 @@ +<!-- $Id: cust_main.cgi,v 1.19 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: cust_main.cgi,v 1.18 2001-12-27 09:26:14 ivan Exp $ --> - -use strict; -use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral - @packages $package @history @bills $bill @credits $credit - $balance $item @agents @referrals @invoicing_list $n1 $conf - $signupurl ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs qsearch); -use FS::CGI qw(header menubar popurl table itable ntable); -use FS::cust_credit; -use FS::cust_pay; -use FS::cust_bill; -use FS::part_pkg; -use FS::cust_pkg; -use FS::part_referral; -use FS::agent; -use FS::cust_main; -use FS::cust_refund; -use FS::cust_bill_pay; -use FS::cust_credit_bill; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; + +my $conf = new FS::Conf; print header("Customer View", menubar( 'Main Menu' => popurl(2) )); die "No customer specified (bad URL)!" unless $cgi->keywords; -($query) = $cgi->keywords; # needs parens with my, ->keywords returns array +my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array $query =~ /^(\d+)$/; -$custnum = $1; -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Customer not found!" unless $cust_main; -$hashref = $cust_main->hashref; print qq!<A HREF="!, popurl(2), qq!edit/cust_main.cgi?$custnum">Edit this customer</A>!; @@ -159,7 +132,8 @@ print '<TD VALIGN="top">'; $custnum, '</TD></TR>', ; - @agents = qsearch( 'agent', {} ); + my @agents = qsearch( 'agent', {} ); + my $agent; unless ( scalar(@agents) == 1 ) { $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); print '<TR><TD ALIGN="right">Agent</TD><TD BGCOLOR="#ffffff">', @@ -167,7 +141,7 @@ print '<TD VALIGN="top">'; } else { $agent = $agents[0]; } - @referrals = qsearch( 'part_referral', {} ); + my @referrals = qsearch( 'part_referral', {} ); unless ( scalar(@referrals) == 1 ) { my $referral = qsearchs('part_referral', { 'refnum' => $cust_main->refnum @@ -202,7 +176,7 @@ print '<TD VALIGN="top">'; print '<BR>'; - @invoicing_list = $cust_main->invoicing_list; + my @invoicing_list = $cust_main->invoicing_list; print "Billing information (", qq!<A HREF="!, popurl(2), qq!misc/bill.cgi?$custnum">!, "Bill now</A>)", &ntable("#cccccc"), "<TR><TD>", &ntable("#cccccc",2), @@ -298,14 +272,15 @@ print qq!!, &table(), "\n", qq!</TR>\n!; #get package info +my @packages; if ( $conf->exists('hidecancelledpackages') ) { @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->ncancelled_pkgs); } else { @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs); } -$n1 = '<TR>'; -foreach $package (@packages) { +my $n1 = '<TR>'; +foreach my $package (@packages) { my $pkgnum = $package->pkgnum; my $pkg = $package->part_pkg->pkg; my $comment = $package->part_pkg->comment; @@ -362,12 +337,12 @@ print qq!<BR><BR><A NAME="history">Payment History!. # major problem: this whole thing is way too sloppy. # minor problem: the description lines need better formatting. -@history = (); #needed for mod_perl :) +my @history = (); #needed for mod_perl :) my %target = (); -@bills = qsearch('cust_bill',{'custnum'=>$custnum}); -foreach $bill (@bills) { +my @bills = qsearch('cust_bill',{'custnum'=>$custnum}); +foreach my $bill (@bills) { my($bref)=$bill->hashref; my $bpre = ( $bill->owed > 0 ) ? '<b><font size="+1" color="#ff0000"> Open ' @@ -418,9 +393,9 @@ foreach $bill (@bills) { } } -@credits = grep { $_->credited > 0 } +my @credits = grep { $_->credited > 0 } qsearch('cust_credit',{'custnum'=>$custnum}); -foreach $credit (@credits) { +foreach my $credit (@credits) { my($cref)=$credit->hashref; push @history, $cref->{_date} . "\t" . @@ -478,8 +453,8 @@ END #display payment history -$balance = 0; -foreach $item (sort keyfield_numerically @history) { +my $balance = 0; +foreach my $item (sort keyfield_numerically @history) { my($date,$desc,$charge,$payment,$credit,$refund,$target)=split(/\t/,$item); $charge ||= 0; $payment ||= 0; diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index c8b362cc3..0e6773713 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,54 +1,37 @@ +<!-- $Id: cust_pkg.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: cust_pkg.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> - -use strict; -use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg - $custnum $susp $cancel $expire $pkg $comment $setup $bill - $otaker ); -use Date::Format; -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header menubar ntable table); -use FS::Record qw(qsearch qsearchs); -use FS::part_svc; -use FS::cust_pkg; -use FS::part_pkg; -use FS::pkg_svc; -use FS::cust_svc; - -$cgi = new CGI; -cgisuidsetup($cgi); - -foreach $part_svc ( qsearch('part_svc',{}) ) { + +my %uiview = (); +my %uiadd = (); +foreach my $part_svc ( qsearch('part_svc',{}) ) { $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; } -($query) = $cgi->keywords; +my ($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$pkgnum = $1; +my $pkgnum = $1; #get package record -$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); die "No package!" unless $cust_pkg; -$part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); +my $part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); -$custnum = $cust_pkg->getfield('custnum'); +my $custnum = $cust_pkg->getfield('custnum'); print header('Package View', menubar( "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", 'Main Menu' => popurl(2) )); #print info -($susp,$cancel,$expire)=( +my ($susp,$cancel,$expire)=( $cust_pkg->getfield('susp'), $cust_pkg->getfield('cancel'), $cust_pkg->getfield('expire'), ); -($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment')); -($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill')); -$otaker = $cust_pkg->getfield('otaker'); +my($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment')); +my($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill')); +my $otaker = $cust_pkg->getfield('otaker'); print <<END; <SCRIPT> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 7cebdf8da..a4e377078 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,37 +1,19 @@ +<!-- $Id: svc_acct.cgi,v 1.10 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: svc_acct.cgi,v 1.9 2001-12-15 22:59:35 ivan Exp $ --> -use strict; -use vars qw( $conf $cgi $domain $query $svcnum $svc_acct $cust_svc $pkgnum - $cust_pkg $custnum $part_svc $p $svc_acct_pop $password - $mydomain $svc_domain ); -use CGI; -use CGI::Carp qw( fatalsToBrowser ); -use FS::UID qw( cgisuidsetup ); -use FS::CGI qw( header popurl menubar ntable); -use FS::Record qw( qsearchs fields ); -use FS::Conf; -use FS::svc_acct; -use FS::cust_svc; -use FS::cust_pkg; -use FS::part_svc; -use FS::svc_acct_pop; -use FS::raddb; +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; -$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +my $svcnum = $1; +my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); die "Unknown svcnum" unless $svc_acct; #false laziness w/all svc_*.cgi -$cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } ); -$pkgnum = $cust_svc->getfield('pkgnum'); +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->custnum; @@ -41,22 +23,22 @@ if ($pkgnum) { } #eofalse -$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); die "Unknown svcpart" unless $part_svc; +my $domain; if ( $svc_acct->domsvc ) { - $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); + my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); die "Unknown domain" unless $svc_domain; $domain = $svc_domain->domain; } else { - unless ( $mydomain = $conf->config('domain') ) { + unless ( $mydomain ) { die "No legacy domain config file and no svc_domain.svcnum record ". "for svc_acct.domsvc: ". $cust_svc->domsvc; } $domain = $mydomain; } -$p = popurl(2); print header('Account View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", @@ -84,7 +66,7 @@ print "<TR><TD ALIGN=\"right\">Domain</TD>". "<TD BGCOLOR=\"#ffffff\">". $domain, "</TD></TR>"; print "<TR><TD ALIGN=\"right\">Password</TD><TD BGCOLOR=\"#ffffff\">"; -$password = $svc_acct->_password; +my $password = $svc_acct->_password; if ( $password =~ /^\*\w+\* (.*)$/ ) { $password = $1; print "<I>(login disabled)</I> "; @@ -97,7 +79,7 @@ if ( $conf->exists('showpasswords') ) { print "</TR></TD>"; $password = ''; -$svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); +my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); print "<TR><TD ALIGN=\"right\">Access number</TD>". "<TD BGCOLOR=\"#ffffff\">". $svc_acct_pop->text. '</TD></TR>' if $svc_acct_pop; diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi index 366ee99f9..c8561caba 100755 --- a/httemplate/view/svc_acct_sm.cgi +++ b/httemplate/view/svc_acct_sm.cgi @@ -1,36 +1,18 @@ +<!-- $Id: svc_acct_sm.cgi,v 1.5 2002-01-30 14:18:09 ivan Exp $ --> <% -#<!-- $Id: svc_acct_sm.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw($conf $cgi $mydomain $query $svcnum $svc_acct_sm $cust_svc - $pkgnum $cust_pkg $custnum $part_svc $p $domsvc $domuid $domuser - $svc $svc_domain $domain $svc_acct $username ); -use CGI; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl menubar ); -use FS::Record qw(qsearchs); -use FS::Conf; -use FS::svc_acct_sm; -use FS::cust_svc; -use FS::cust_pkg; -use FS::part_svc; -use FS::svc_domain; -use FS::svc_acct; +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; -$svc_acct_sm = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}); +my $svcnum = $1; +my $svc_acct_sm = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}); die "Unknown svcnum" unless $svc_acct_sm; -$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -$pkgnum = $cust_svc->getfield('pkgnum'); +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'); @@ -39,10 +21,9 @@ if ($pkgnum) { $custnum = ''; } -$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) +my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) or die "Unkonwn svcpart"; -$p = popurl(2); print header('Mail Alias View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", @@ -54,18 +35,18 @@ print header('Mail Alias View', menubar( "Main menu" => $p, )); -($domsvc,$domuid,$domuser) = ( +my($domsvc,$domuid,$domuser) = ( $svc_acct_sm->domsvc, $svc_acct_sm->domuid, $svc_acct_sm->domuser, ); -$svc = $part_svc->svc; -$svc_domain = qsearchs('svc_domain',{'svcnum'=>$domsvc}) +my $svc = $part_svc->svc; +my $svc_domain = qsearchs('svc_domain',{'svcnum'=>$domsvc}) or die "Corrupted database: no svc_domain.svcnum matching domsvc $domsvc"; -$domain = $svc_domain->domain; -$svc_acct = qsearchs('svc_acct',{'uid'=>$domuid}) +my $domain = $svc_domain->domain; +my $svc_acct = qsearchs('svc_acct',{'uid'=>$domuid}) or die "Corrupted database: no svc_acct.uid matching domuid $domuid"; -$username = $svc_acct->username; +my $username = $svc_acct->username; print qq!<A HREF="${p}edit/svc_acct_sm.cgi?$svcnum">Edit this information</A>!, "<BR>Service #$svcnum", diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 4add200b9..c980b1c25 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,29 +1,15 @@ +<!-- $Id: svc_domain.cgi,v 1.6 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: svc_domain.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum - $cust_pkg $custnum $part_svc $p $svc_acct $email); -use CGI; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header menubar popurl menubar); -use FS::Record qw(qsearchs); -use FS::svc_domain; -use FS::cust_svc; -use FS::cust_pkg; -use FS::part_svc; - -$cgi = new CGI; -cgisuidsetup($cgi); - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; -$svc_domain = qsearchs('svc_domain',{'svcnum'=>$svcnum}); +my $svcnum = $1; +my $svc_domain = qsearchs('svc_domain',{'svcnum'=>$svcnum}); die "Unknown svcnum" unless $svc_domain; -$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -$pkgnum = $cust_svc->getfield('pkgnum'); +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'); @@ -32,18 +18,18 @@ if ($pkgnum) { $custnum = ''; } -$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); die "Unknown svcpart" unless $part_svc; +my $email = ''; if ($svc_domain->catchall) { - $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } ); + my $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } ); die "Unknown svcpart" unless $svc_acct; $email = $svc_acct->email; } -$domain = $svc_domain->domain; +my $domain = $svc_domain->domain; -$p = popurl(2); print header('Domain View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index bb9587062..fc465dbab 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -1,34 +1,17 @@ +<!-- $Id: svc_forward.cgi,v 1.5 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: svc_forward.cgi,v 1.4 2001-10-30 14:54:07 ivan Exp $ --> -use strict; -use vars qw($conf $cgi $query $svcnum $svc_forward $cust_svc - $pkgnum $cust_pkg $custnum $part_svc $p $srcsvc $dstsvc $dst - $svc $svc_acct $source $destination); -use CGI; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl menubar ); -use FS::Record qw(qsearchs); -use FS::Conf; -use FS::cust_svc; -use FS::cust_pkg; -use FS::part_svc; -use FS::svc_acct; -use FS::svc_forward; +my $conf = new FS::Conf; -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; -$svc_forward = qsearchs('svc_forward',{'svcnum'=>$svcnum}); +my $svcnum = $1; +my $svc_forward = qsearchs('svc_forward',{'svcnum'=>$svcnum}); die "Unknown svcnum" unless $svc_forward; -$cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -$pkgnum = $cust_svc->getfield('pkgnum'); +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'); @@ -37,10 +20,9 @@ if ($pkgnum) { $custnum = ''; } -$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) +my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) or die "Unkonwn svcpart"; -$p = popurl(2); print header('Mail Forward View', menubar( ( ( $pkgnum || $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", @@ -52,17 +34,18 @@ print header('Mail Forward View', menubar( "Main menu" => $p, )); -($srcsvc,$dstsvc,$dst) = ( +my($srcsvc,$dstsvc,$dst) = ( $svc_forward->srcsvc, $svc_forward->dstsvc, $svc_forward->dst, ); -$svc = $part_svc->svc; -$svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) +my $svc = $part_svc->svc; +my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; -$source = $svc_acct->email; +my $source = $svc_acct->email; +my $destination; if ($dstsvc) { - $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) + my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) or die "Corrupted database: no svc_acct.svcnum matching dstsvc $dstsvc"; $destination = $svc_acct->email; }else{ diff --git a/httemplate/view/svc_www.cgi b/httemplate/view/svc_www.cgi index ff9d57b5f..bc605be24 100644 --- a/httemplate/view/svc_www.cgi +++ b/httemplate/view/svc_www.cgi @@ -1,32 +1,16 @@ +<!-- $Id: svc_www.cgi,v 1.2 2002-01-30 14:18:09 ivan Exp $ --> <% -# <!-- $Id: svc_www.cgi,v 1.1 2001-12-15 22:56:07 ivan Exp $ --> -use strict; -use vars qw( $cgi $query $svcnum $svc_www $cust_svc $pkgnum - $cust_pkg $custnum $p $domain_record ); - #$part_svc $p $svc_acct $email -use CGI; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header menubar popurl menubar); -use FS::Record qw(qsearchs); -use FS::svc_www; -use FS::domain_record; -use FS::cust_svc; -#use FS::cust_pkg; -#use FS::part_svc; - -$cgi = new CGI; -cgisuidsetup($cgi); - -($query) = $cgi->keywords; +my($query) = $cgi->keywords; $query =~ /^(\d+)$/; -$svcnum = $1; -$svc_www = qsearchs( 'svc_www', { 'svcnum' => $svcnum } ) +my $svcnum = $1; +my $svc_www = qsearchs( 'svc_www', { 'svcnum' => $svcnum } ) or die "svc_www: Unknown svcnum $svcnum"; #false laziness w/all svc_*.cgi -$cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -$pkgnum = $cust_svc->getfield('pkgnum'); +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->custnum; @@ -36,12 +20,11 @@ if ($pkgnum) { } #eofalse -$domain_record = qsearchs( 'domain_record', { 'recnum' => $svc_www->recnum } ) +my $domain_record = qsearchs('domain_record', { 'recnum' => $svc_www->recnum } ) or die "svc_www: Unknown recnum". $svc_www->recnum; my $www = $domain_record->reczone; -$p = popurl(2); print header('Website View', menubar( ( ( $custnum ) ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", |