summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
authorivan <ivan>2001-07-30 07:36:04 +0000
committerivan <ivan>2001-07-30 07:36:04 +0000
commit51984ac3d3da3006809c6866fdecd4ad83610731 (patch)
treeac16f533c25a1947eee7bee226fed5638c42bd94 /httemplate/misc
parent9c2016b3a564d439960420114ce6f4cab3bf723b (diff)
templates!!!
Diffstat (limited to 'httemplate/misc')
-rwxr-xr-xhttemplate/misc/bill.cgi62
-rwxr-xr-xhttemplate/misc/cancel-unaudited.cgi97
-rwxr-xr-xhttemplate/misc/cancel_pkg.cgi75
-rwxr-xr-xhttemplate/misc/delete-customer.cgi62
-rwxr-xr-xhttemplate/misc/expire_pkg.cgi65
-rwxr-xr-xhttemplate/misc/link.cgi89
-rwxr-xr-xhttemplate/misc/print-invoice.cgi55
-rwxr-xr-xhttemplate/misc/process/delete-customer.cgi50
-rwxr-xr-xhttemplate/misc/process/link.cgi80
-rwxr-xr-xhttemplate/misc/susp_pkg.cgi68
-rwxr-xr-xhttemplate/misc/unsusp_pkg.cgi65
11 files changed, 768 insertions, 0 deletions
diff --git a/httemplate/misc/bill.cgi b/httemplate/misc/bill.cgi
new file mode 100755
index 000000000..d09fc45dc
--- /dev/null
+++ b/httemplate/misc/bill.cgi
@@ -0,0 +1,62 @@
+<%
+#
+# $Id: bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# s/FS:Search/FS::Record/ and cgisuidsetup($cgi) ivan@sisd.com 98-mar-13
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# $Log: bill.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.5 1999/08/12 04:32:21 ivan
+# hidecancelledcustomers
+#
+# Revision 1.4 1999/01/19 05:14:02 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.3 1998/12/23 03:01:13 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:41 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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::Record qw(qsearchs);
+use FS::cust_main;
+
+$cgi = new CGI;
+&cgisuidsetup($cgi);
+
+#untaint custnum
+($query) = $cgi->keywords;
+$query =~ /^(\d*)$/;
+$custnum = $1;
+$cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
+die "Can't find customer!\n" unless $cust_main;
+
+$error = $cust_main->bill(
+# 'time'=>$time
+ );
+&eidiot($error) if $error;
+
+$error = $cust_main->collect(
+# 'invoice-time'=>$time,
+# 'batch_card'=> 'yes',
+ 'batch_card'=> 'no',
+ 'report_badcard'=> 'yes',
+ );
+&eidiot($error) if $error;
+
+print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum");
+
+%>
diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi
new file mode 100755
index 000000000..5bad5e737
--- /dev/null
+++ b/httemplate/misc/cancel-unaudited.cgi
@@ -0,0 +1,97 @@
+<%
+#
+# $Id: cancel-unaudited.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# Usage: cancel-unaudited.cgi svcnum
+# http://server.name/path/cancel-unaudited.cgi pkgnum
+#
+# ivan@voicenet.com 97-apr-23
+#
+# rewrote for new API
+# ivan@voicenet.com 97-jul-21
+#
+# Search->Record, cgisuidsetup($cgi) ivan@sids.com 98-mar-19
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# $Log: cancel-unaudited.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.8 2001/04/09 23:05:16 ivan
+# Transactions Part I!!!
+#
+# Revision 1.7 2000/06/15 12:30:37 ivan
+# bugfix from Jeff Finucane, thanks!
+#
+# Revision 1.6 1999/02/28 00:03:48 ivan
+# removed misleading comments
+#
+# Revision 1.5 1999/02/07 09:59:34 ivan
+# more mod_perl fixes, and bugfixes Peter Wemm sent via email
+#
+# Revision 1.4 1999/01/19 05:14:03 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.3 1998/12/23 03:02:05 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:42 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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);
+
+#untaint svcnum
+($query) = $cgi->keywords;
+$query =~ /^(\d+)$/;
+$svcnum = $1;
+
+$svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
+die "Unknown svcnum!" unless $svc_acct;
+
+$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.!)
+ if $cust_svc->pkgnum ne '' && $cust_svc->pkgnum ne '0';
+
+local $SIG{HUP} = 'IGNORE';
+local $SIG{INT} = 'IGNORE';
+local $SIG{QUIT} = 'IGNORE';
+local $SIG{TERM} = 'IGNORE';
+local $SIG{TSTP} = 'IGNORE';
+
+local $FS::UID::AutoCommit = 0;
+
+$error = $svc_acct->cancel;
+&myeidiot($error) if $error;
+$error = $svc_acct->delete;
+&myeidiot($error) if $error;
+
+$error = $cust_svc->delete;
+&myeidiot($error) if $error;
+
+$dbh->commit or die $dbh->errstr;
+
+print $cgi->redirect(popurl(2));
+
+sub myeidiot {
+ $dbh->rollback;
+ &eidiot(@_);
+}
+
+%>
diff --git a/httemplate/misc/cancel_pkg.cgi b/httemplate/misc/cancel_pkg.cgi
new file mode 100755
index 000000000..99a09bbe3
--- /dev/null
+++ b/httemplate/misc/cancel_pkg.cgi
@@ -0,0 +1,75 @@
+<%
+#
+# $Id: cancel_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# Usage: cancel_pkg.cgi pkgnum
+# http://server.name/path/cancel_pkg.cgi pkgnum
+#
+# IT DOESN'T RUN THE APPROPRIATE PROGRAMS YET!!!!
+#
+# probably should generalize this to do cancels, suspensions, unsuspensions, etc.
+#
+# ivan@voicenet.com 97-jan-2
+#
+# still kludgy, but now runs /dbin/cancel $pkgnum
+# ivan@voicenet.com 97-feb-27
+#
+# doesn't run if pkgnum doesn't match regex
+# ivan@voicenet.com 97-mar-6
+#
+# now redirects to enter comments
+# ivan@voicenet.com 97-may-8
+#
+# rewrote for new API
+# ivan@voicenet.com 97-jul-21
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# $Log: cancel_pkg.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.6 1999/04/08 10:35:02 ivan
+# import necessary subroutines from FS::CGI
+#
+# Revision 1.5 1999/02/28 00:03:49 ivan
+# removed misleading comments
+#
+# Revision 1.4 1999/01/19 05:14:04 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.3 1998/12/23 03:02:54 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:43 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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;
+$query =~ /^(\d+)$/ || die "Illegal pkgnum";
+$pkgnum = $1;
+
+$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
+
+$error = $cust_pkg->cancel;
+eidiot($error) if $error;
+
+print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
+
+%>
diff --git a/httemplate/misc/delete-customer.cgi b/httemplate/misc/delete-customer.cgi
new file mode 100755
index 000000000..cb5fc76b5
--- /dev/null
+++ b/httemplate/misc/delete-customer.cgi
@@ -0,0 +1,62 @@
+<%
+#
+# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# $Log: delete-customer.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.1 1999/04/15 16:44:36 ivan
+# delete customers
+#
+
+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;
+die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
+
+if ( $cgi->param('error') ) {
+ $custnum = $cgi->param('custnum');
+ $new_custnum = $cgi->param('new_custnum');
+} else {
+ ($query) = $cgi->keywords;
+ $query =~ /^(\d+)$/ or die "Illegal query: $query";
+ $custnum = $1;
+ $new_custnum = '';
+}
+$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
+ or die "Customer not found: $custnum";
+
+print $cgi->header ( '-expires' => 'now' ), header('Delete customer');
+
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+ "</FONT>"
+ if $cgi->param('error');
+
+print
+ qq!<form action="!, popurl(1), qq!process/delete-customer.cgi" method=post>!,
+ qq!<input type="hidden" name="custnum" value="$custnum">!;
+
+if ( qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } ) ) {
+ print "Move uncancelled packages to customer number ",
+ qq!<input type="text" name="new_custnum" value="$new_custnum"><br><br>!;
+}
+
+print <<END;
+This will <b>completely remove</b> all traces of this customer record.
+<br>Are you <b>absolutely sure</b> you want to delete this customer?
+<br><input type="submit" value="Yes">
+</form></body></html>
+END
+
+%>
diff --git a/httemplate/misc/expire_pkg.cgi b/httemplate/misc/expire_pkg.cgi
new file mode 100755
index 000000000..7afa94267
--- /dev/null
+++ b/httemplate/misc/expire_pkg.cgi
@@ -0,0 +1,65 @@
+<%
+#
+# $Id: expire_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# Usage: post form to:
+# http://server.name/path/expire_pkg.cgi
+#
+# based on susp_pkg
+# ivan@voicenet.com 97-jul-29
+#
+# ivan@sisd.com 98-mar-17 FS::Search->FS::Record
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# $Log: expire_pkg.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.4 1999/02/28 00:03:50 ivan
+# removed misleading comments
+#
+# Revision 1.3 1999/01/19 05:14:05 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.2 1998/12/17 09:12:44 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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
+
+if ( $cgi->param('date') ) {
+ str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
+ $date=$1;
+} else {
+ $date='';
+}
+
+$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum";
+$pkgnum = $1;
+
+$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
+%hash = $cust_pkg->hash;
+$hash{expire}=$date;
+$new = new FS::cust_pkg ( \%hash );
+$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
new file mode 100755
index 000000000..fee02ddb7
--- /dev/null
+++ b/httemplate/misc/link.cgi
@@ -0,0 +1,89 @@
+<%
+#
+# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# ivan@voicenet.com 97-feb-5
+#
+# rewrite ivan@sisd.com 98-mar-17
+#
+# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24
+#
+# $Log: link.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.7 1999/04/08 11:31:40 ivan
+# *** empty log message ***
+#
+# Revision 1.6 1999/02/28 00:03:51 ivan
+# removed misleading comments
+#
+# Revision 1.5 1999/01/19 05:14:06 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.4 1999/01/18 09:41:36 ivan
+# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
+# (good idea anyway)
+#
+# Revision 1.3 1998/12/23 03:03:39 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:45 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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 = (
+ 'svc_acct' => 'username',
+ 'svc_domain' => 'domain',
+ 'svc_acct_sm' => '',
+ 'svc_charge' => '',
+ 'svc_wo' => '',
+);
+
+$cgi = new CGI;
+cgisuidsetup($cgi);
+
+($query) = $cgi->keywords;
+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};
+
+print $cgi->header( '-expires' => 'now' ), header("Link to existing $svc"),
+ qq!<FORM ACTION="!, popurl(1), qq!process/link.cgi" METHOD=POST>!;
+
+if ( $link_field ) {
+ print <<END;
+ <INPUT TYPE="hidden" NAME="svcnum" VALUE="">
+ <INPUT TYPE="hidden" NAME="link_field" VALUE="$link_field">
+ $link_field of existing service: <INPUT TYPE="text" NAME="link_value">
+END
+} else {
+ print qq!Service # of existing service: <INPUT TYPE="text" NAME="svcnum" VALUE="">!;
+}
+
+print <<END;
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="$pkgnum">
+<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">
+<P><CENTER><INPUT TYPE="submit" VALUE="Link"></CENTER>
+ </FORM>
+ </BODY>
+</HTML>
+END
+
+%>
diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi
new file mode 100755
index 000000000..1d35bc0f2
--- /dev/null
+++ b/httemplate/misc/print-invoice.cgi
@@ -0,0 +1,55 @@
+<%
+#
+# $Id: print-invoice.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# just a kludge for now, since this duplicates in a way it shouldn't stuff from
+# Bill.pm (like $lpr) ivan@sisd.com 98-jun-16
+#
+# $Log: print-invoice.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.4 1999/01/19 05:14:07 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.3 1998/12/23 03:04:24 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:47 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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');
+
+#untaint invnum
+($query) = $cgi->keywords;
+$query =~ /^(\d*)$/;
+$invnum = $1;
+$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: $!";
+ print LPR $cust_bill->print_text; #( date )
+ close LPR
+ or die $! ? "Error closing $lpr: $!"
+ : "Exit status $? from $lpr";
+
+$custnum = $cust_bill->getfield('custnum');
+
+print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history");
+
+%>
diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi
new file mode 100755
index 000000000..b15ffef17
--- /dev/null
+++ b/httemplate/misc/process/delete-customer.cgi
@@ -0,0 +1,50 @@
+<%
+#
+# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# $Log: delete-customer.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.1 1999/04/15 16:44:36 ivan
+# delete customers
+#
+
+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;
+die "Customer deletions not enabled" unless $conf->exists('deletecustomers');
+
+$cgi->param('custnum') =~ /^(\d+)$/;
+$custnum = $1;
+if ( $cgi->param('new_custnum') ) {
+ $cgi->param('new_custnum') =~ /^(\d+)$/
+ or die "Illegal new customer number: ". $cgi->param('new_custnum');
+ $new_custnum = $1;
+} else {
+ $new_custnum = '';
+}
+$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
+ or die "Customer not found: $custnum";
+
+$error = $cust_main->delete($new_custnum);
+
+if ( $error ) {
+ $cgi->param('error', $error);
+ print $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string );
+} elsif ( $new_custnum ) {
+ print $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum");
+} else {
+ print $cgi->redirect(popurl(3));
+}
+%>
diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi
new file mode 100755
index 000000000..94afa289a
--- /dev/null
+++ b/httemplate/misc/process/link.cgi
@@ -0,0 +1,80 @@
+<%
+#
+# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# ivan@voicenet.com 97-feb-5
+#
+# rewrite ivan@sisd.com 98-mar-18
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24
+#
+# $Log: link.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.6 2000/07/17 17:59:33 ivan
+# oops
+#
+# Revision 1.5 1999/04/15 14:09:17 ivan
+# get rid of top-level my() variables
+#
+# Revision 1.4 1999/02/07 09:59:35 ivan
+# more mod_perl fixes, and bugfixes Peter Wemm sent via email
+#
+# Revision 1.3 1999/01/19 05:14:10 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.2 1998/12/17 09:15:00 ivan
+# s/CGI::Request/CGI.pm/;
+#
+
+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;
+$cgi->param('svcpart') =~ /^(\d+)$/;
+$svcpart = $1;
+$cgi->param('svcnum') =~ /^(\d*)$/;
+$svcnum = $1;
+
+unless ( $svcnum ) {
+ my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart});
+ my($svcdb) = $part_svc->getfield('svcdb');
+ $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1;
+ my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') });
+ eidiot("$link_field not found!") unless $svc_acct;
+ $svcnum=$svc_acct->svcnum;
+}
+
+$old = qsearchs('cust_svc',{'svcnum'=>$svcnum});
+die "svcnum not found!" unless $old;
+$new = new FS::cust_svc ({
+ 'svcnum' => $svcnum,
+ 'pkgnum' => $pkgnum,
+ 'svcpart' => $svcpart,
+});
+
+$error = $new->replace($old);
+
+unless ($error) {
+ #no errors, so let's view this customer.
+ print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum");
+} else {
+ idiot($error);
+}
+
+%>
diff --git a/httemplate/misc/susp_pkg.cgi b/httemplate/misc/susp_pkg.cgi
new file mode 100755
index 000000000..52e3ce788
--- /dev/null
+++ b/httemplate/misc/susp_pkg.cgi
@@ -0,0 +1,68 @@
+<%
+#
+# $Id: susp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# Usage: susp_pkg.cgi pkgnum
+# http://server.name/path/susp_pkg.cgi pkgnum
+#
+# probably should generalize this to do cancels, suspensions, unsuspensions, etc.
+#
+# ivan@voicenet.com 97-feb-27
+#
+# now redirects to enter comments
+# ivan@voicenet.com 97-may-8
+#
+# rewrote for new API
+# ivan@voicenet.com 97-jul-21
+#
+# FS::Search -> FS::Record ivan@sisd.com 98-mar-17
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# $Log: susp_pkg.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.6 1999/04/08 10:35:02 ivan
+# import necessary subroutines from FS::CGI
+#
+# Revision 1.5 1999/02/28 00:03:52 ivan
+# removed misleading comments
+#
+# Revision 1.4 1999/01/19 05:14:08 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.3 1998/12/23 03:04:56 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:48 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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;
+$query =~ /^(\d+)$/ || die "Illegal pkgnum";
+$pkgnum = $1;
+
+$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
+
+$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
new file mode 100755
index 000000000..d7d651b6d
--- /dev/null
+++ b/httemplate/misc/unsusp_pkg.cgi
@@ -0,0 +1,65 @@
+<%
+#
+# $Id: unsusp_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+#
+# Usage: susp_pkg.cgi pkgnum
+# http://server.name/path/susp_pkg.cgi pkgnum
+#
+# probably should generalize this to do cancels, suspensions, unsuspensions, etc.
+#
+# ivan@voicenet.com 97-feb-27
+#
+# now redirects to enter comments
+# ivan@voicenet.com 97-may-8
+#
+# rewrote for new API
+# ivan@voicenet.com 97-jul-21
+#
+# FS::Search -> FS::Record ivan@sisd.com 98-mar-17
+#
+# Changes to allow page to work at a relative position in server
+# bmccane@maxbaud.net 98-apr-3
+#
+# $Log: unsusp_pkg.cgi,v $
+# Revision 1.1 2001-07-30 07:36:04 ivan
+# templates!!!
+#
+# Revision 1.5 1999/02/28 00:03:53 ivan
+# removed misleading comments
+#
+# Revision 1.4 1999/01/19 05:14:09 ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.3 1998/12/23 03:05:25 ivan
+# $cgi->keywords instead of $cgi->query_string
+#
+# Revision 1.2 1998/12/17 09:12:49 ivan
+# s/CGI::(Request|Base)/CGI.pm/;
+#
+
+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;
+$query =~ /^(\d+)$/ || die "Illegal pkgnum";
+$pkgnum = $1;
+
+$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
+
+$error = $cust_pkg->unsuspend;
+&eidiot($error) if $error;
+
+print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
+
+%>