From: ivan Date: Fri, 17 Apr 1998 05:37:07 +0000 (+0000) Subject: Initial revision X-Git-Tag: freeside_current~2^2~67 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=dd013679940cb0a4425eeff4df263e390d9c42e4;p=freeside.git Initial revision --- diff --git a/htdocs/edit/process/cust_credit.cgi b/htdocs/edit/process/cust_credit.cgi new file mode 100755 index 000000000..e660b4c78 --- /dev/null +++ b/htdocs/edit/process/cust_credit.cgi @@ -0,0 +1,70 @@ +#!/usr/bin/perl -Tw +# +# process/cust_credit.cgi: Add a credit (process form) +# +# Usage: post form to: +# http://server.name/path/cust_credit.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-05 -> 96-dec-08 +# +# post a refund if $new_paybatch +# ivan@voicenet.com 96-dec-08 +# +# refunds are no longer applied against a specific payment (paybatch) +# paybatch field removed +# ivan@voicenet.com 97-apr-22 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use FS::UID qw(cgisuidsetup getotaker); +use FS::cust_credit; + +my($req)=new CGI::Request; # create form object +cgisuidsetup($req->cgi); + +$req->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; +my($custnum)=$1; + +$req->param('otaker',getotaker); + +my($new) = create FS::cust_credit ( { + map { + $_, $req->param($_); + } qw(custnum _date amount otaker reason) +} ); + +my($error); +$error=$new->insert; +&idiot($error) if $error; + +#no errors, no refund, so view our credit. +$req->cgi->redirect("../../view/cust_main.cgi?$custnum#history"); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print < + + Error posting credit/refund + + +
+

Error posting credit/refund

+
+ Your update did not occur because of the following error: +

$error +

Hit the Back button in your web browser, correct this mistake, and press the Post button again. + + +END + +} + diff --git a/htdocs/edit/process/cust_main.cgi b/htdocs/edit/process/cust_main.cgi new file mode 100755 index 000000000..7664dfcb8 --- /dev/null +++ b/htdocs/edit/process/cust_main.cgi @@ -0,0 +1,102 @@ +#!/usr/bin/perl -Tw +# +# process/cust_main.cgi: Edit a customer (process form) +# +# Usage: post form to: +# http://server.name/path/cust_main.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-04 +# +# added referral check +# ivan@voicenet.com 97-jun-4 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-28 +# +# same as above (again) and clean up some stuff ivan@sisd.com 98-feb-23 +# +# Changes to allow page to work at a relative position in server +# Changed 'day' to 'daytime' because Pg6.3 reserves the day word +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_main; + +my($req)=new CGI::Request; # create form object + +&cgisuidsetup($req->cgi); + +#create new record object + +#unmunge agentnum +$req->param('agentnum', + (split(/:/, ($req->param('agentnum'))[0] ))[0] +); + +#unmunge tax +$req->param('tax','') unless defined($req->param('tax')); + +#unmunge refnum +$req->param('refnum', + (split(/:/, ($req->param('refnum'))[0] ))[0] +); + +#unmunge state/county +$req->param('state') =~ /^(\w+)( \((\w+)\))?$/; +$req->param('state', $1); +$req->param('county', $3 || ''); + +my($new) = create FS::cust_main ( { + map { + $_, $req->param("$_") || '' + } qw(custnum agentnum last first ss company address1 address2 city county + state zip country daytime night fax payby payinfo paydate payname tax + otaker refnum) +} ); + +if ( $new->custnum eq '' ) { + + my($error)=$new->insert; + &idiot($error) if $error; + +} else { #create old record object + + my($old) = qsearchs( 'cust_main', { 'custnum', $new->custnum } ); + &idiot("Old record not found!") unless $old; + my($error)=$new->replace($old); + &idiot($error) if $error; + +} + +my($custnum)=$new->custnum; +$req->cgi->redirect("../../view/cust_main.cgi?$custnum#cust_main"); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print < + + Error updating customer information + + +

+

Error updating customer information

+
+ Your update did not occur because of the following error: +

$error +

Hit the Back button in your web browser, correct this mistake, and submit the form again. + + +END + + exit; + +} + diff --git a/htdocs/edit/process/cust_pay.cgi b/htdocs/edit/process/cust_pay.cgi new file mode 100755 index 000000000..9ec97532b --- /dev/null +++ b/htdocs/edit/process/cust_pay.cgi @@ -0,0 +1,57 @@ +#!/usr/bin/perl -Tw +# +# process/cust_pay.cgi: Add a payment (process form) +# +# Usage: post form to: +# http://server.name/path/cust_pay.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-11 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use FS::UID qw(cgisuidsetup); +use FS::cust_pay qw(fields); + +my($req)=new CGI::Request; +&cgisuidsetup($req->cgi); + +$req->param('invnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my($invnum)=$1; + +my($new) = create FS::cust_pay ( { + map { + $_, $req->param($_); + } qw(invnum paid _date payby payinfo paybatch) +} ); + +my($error); +$error=$new->insert; + +if ($error) { #error! + CGI::Base::SendHeaders(); # one guess + print < + + Error posting payment + + +

+

Error posting payment

+
+ Your update did not occur because of the following error: +

$error +

Hit the Back button in your web browser, correct this mistake, and press the Post button again. + + +END +} else { #no errors! + $req->cgi->redirect("../../view/cust_bill.cgi?$invnum"); +} + diff --git a/htdocs/edit/process/cust_pkg.cgi b/htdocs/edit/process/cust_pkg.cgi new file mode 100755 index 000000000..6f5bc875a --- /dev/null +++ b/htdocs/edit/process/cust_pkg.cgi @@ -0,0 +1,73 @@ +#!/usr/bin/perl -Tw +# +# process/cust_pkg.cgi: Add/edit packages (process form) +# +# this is for changing packages around, not for editing things within the +# package +# +# Usage: post form to: +# http://server.name/path/cust_pkg.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 97-mar-21 - 97-mar-24 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-7 - 15 +# +# &cgisuidsetup($cgi) ivan@sisd.com 98-mar-7 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::cust_pkg; + +my($req)=new CGI::Request; # create form object + +&cgisuidsetup($req->cgi); + +#untaint custnum +$req->param('new_custnum') =~ /^(\d+)$/; +my($custnum)=$1; + +my(@remove_pkgnums) = map { + /^(\d+)$/ or die "Illegal remove_pkg value!"; + $1; +} $req->param('remove_pkg'); + +my(@pkgparts); +my($pkgpart); +foreach $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $req->params ) { + my($num_pkgs)=$req->param("pkg$pkgpart"); + while ( $num_pkgs-- ) { + push @pkgparts,$pkgpart; + } +} + +my($error) = FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); + +if ($error) { + CGI::Base::SendHeaders(); + print < + + Error updating packages + + +

+

Error updating packages

+
+ Your update did not occur because of the following error: +

$error +

Hit the Back button in your web browser, correct this mistake, and submit the form again. + + +END +} else { + $req->cgi->redirect("../../view/cust_main.cgi?$custnum#cust_pkg"); +} + diff --git a/htdocs/edit/process/svc_acct.cgi b/htdocs/edit/process/svc_acct.cgi new file mode 100755 index 000000000..8d77ba703 --- /dev/null +++ b/htdocs/edit/process/svc_acct.cgi @@ -0,0 +1,87 @@ +#!/usr/bin/perl -Tw +# +# process/svc_acct.cgi: Add/edit a customer (process form) +# +# Usage: post form to: +# http://server.name/path/svc_acct.cgi +# +# Note: Should br run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-18 +# +# Changed /u to /u2 +# ivan@voicenet.com 97-may-6 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-17 - 21 +# +# no FS::Search, FS::svc_acct creates FS::cust_svc record, used for adding +# and editing ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# Changed 'password' to '_password' because Pg6.3 reserves the password word +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::svc_acct; + +my($req) = new CGI::Request; # create form object +&cgisuidsetup($req->cgi); + +$req->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my($svcnum)=$1; + +my($old)=qsearchs('svc_acct',{'svcnum'=>$svcnum}) if $svcnum; + +#unmunge popnum +$req->param('popnum', (split(/:/, $req->param('popnum') ))[0] ); + +#unmunge passwd +if ( $req->param('_password') eq '*HIDDEN*' ) { + $req->param('_password',$old->getfield('_password')); +} + +my($new) = create FS::svc_acct ( { + map { + $_, $req->param($_); + } qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir + shell quota slipip) +} ); + +if ( $svcnum ) { + my($error) = $new->replace($old); + &idiot($error) if $error; +} else { + my($error) = $new->insert; + &idiot($error) if $error; + $svcnum = $new->getfield('svcnum'); +} + +#no errors, view account +$req->cgi->redirect("../../view/svc_acct.cgi?" . $svcnum ); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print < + + Error adding/updating account + + +

+

Error adding/updating account

+
+ Your update did not occur because of the following error: +

$error +

Hit the Back button in your web browser, correct this mistake, and submit the form again. + + +END + exit; +} + diff --git a/htdocs/misc/bill.cgi b/htdocs/misc/bill.cgi new file mode 100755 index 000000000..d41f6d1c9 --- /dev/null +++ b/htdocs/misc/bill.cgi @@ -0,0 +1,66 @@ +#!/usr/bin/perl -Tw +# +# 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 + +use strict; +use CGI::Base qw(:DEFAULT :CGI); +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::Bill; + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint custnum +$QUERY_STRING =~ /^(\d*)$/; +my($custnum)=$1; +my($cust_main)=qsearchs('cust_main',{'custnum'=>$custnum}); +die "Can't find customer!\n" unless $cust_main; + +# ? +bless($cust_main,"FS::Bill"); + +my($error); + +$error = $cust_main->bill( +# 'time'=>$time + ); +&idiot($error) if $error; + +$error = $cust_main->collect( +# 'invoice-time'=>$time, +# 'batch_card'=> 'yes', + 'batch_card'=> 'no', + 'report_badcard'=> 'yes', + ); +&idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?$custnum#history"); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print < + + Error billing customer + + +

+

Error billing customer

+
+ Your update did not occur because of the following error: +

$error + + +END + + exit; + +} + diff --git a/htdocs/misc/cancel-unaudited.cgi b/htdocs/misc/cancel-unaudited.cgi new file mode 100755 index 000000000..929274f38 --- /dev/null +++ b/htdocs/misc/cancel-unaudited.cgi @@ -0,0 +1,85 @@ +#!/usr/bin/perl -Tw +# +# cancel-unaudited.cgi: Cancel an unaudited account +# +# Usage: cancel-unaudited.cgi svcnum +# http://server.name/path/cancel-unaudited.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# 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 + +use strict; +use CGI::Base qw(:DEFAULT :CGI); # CGI module +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_svc; +use FS::svc_acct; + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint svcnum +$QUERY_STRING =~ /^(\d+)$/; +my($svcnum)=$1; + +my($svc_acct) = qsearchs('svc_acct',{'svcnum'=>$svcnum}); +&idiot("Unknown svcnum!") unless $svc_acct; + +my($cust_svc) = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +&idiot(qq!This account has already been audited. Cancel the + package instead.!) + if $cust_svc->getfield('pkgnum') ne ''; + +local $SIG{HUP} = 'IGNORE'; +local $SIG{INT} = 'IGNORE'; +local $SIG{QUIT} = 'IGNORE'; +local $SIG{TERM} = 'IGNORE'; +local $SIG{TSTP} = 'IGNORE'; + +my($error); + +bless($svc_acct,"FS::svc_acct"); +$error = $svc_acct->cancel; +&idiot($error) if $error; +$error = $svc_acct->delete; +&idiot($error) if $error; + +bless($cust_svc,"FS::cust_svc"); +$error = $cust_svc->delete; +&idiot($error) if $error; + +$cgi->redirect("../"); + +sub idiot { + my($error)=@_; + SendHeaders(); + print < + + Error cancelling account + + +

+

Error cancelling account

+
+
+ There has been an error cancelling this acocunt: $error + + + +END + exit; +} + diff --git a/htdocs/misc/expire_pkg.cgi b/htdocs/misc/expire_pkg.cgi new file mode 100755 index 000000000..163516627 --- /dev/null +++ b/htdocs/misc/expire_pkg.cgi @@ -0,0 +1,71 @@ +#!/usr/bin/perl -Tw +# +# expire_pkg.cgi: Expire a package +# +# Usage: post form to: +# http://server.name/path/expire_pkg.cgi +# +# Note: Should be run setuid freeside as user nobody +# +# 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 + +use strict; +use Date::Parse; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +my($req) = new CGI::Request; +&cgisuidsetup($req->cgi); + +#untaint date & pkgnum + +my($date); +if ( $req->param('date') ) { + str2time($req->param('date')) =~ /^(\d+)$/ or die "Illegal date"; + $date=$1; +} else { + $date=''; +} + +$req->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum"; +my($pkgnum)=$1; + +my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +my(%hash)=$cust_pkg->hash; +$hash{expire}=$date; +my($new)=create FS::cust_pkg ( \%hash ); +my($error) = $new->replace($cust_pkg); +&idiot($error) if $error; + +$req->cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +sub idiot { + my($error)=@_; + SendHeaders(); + print < + + Error expiring package + + +
+

Error expiring package

+
+
+ There has been an error expiring this package: $error + + + +END + exit; +} + diff --git a/htdocs/misc/susp_pkg.cgi b/htdocs/misc/susp_pkg.cgi new file mode 100755 index 000000000..7b23caeb2 --- /dev/null +++ b/htdocs/misc/susp_pkg.cgi @@ -0,0 +1,68 @@ +#!/usr/bin/perl -Tw +# +# susp_pkg.cgi: Suspend a package +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# 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 + +use strict; +use CGI::Base qw(:DEFAULT :CGI); # CGI module +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint pkgnum +$QUERY_STRING =~ /^(\d+)$/ || die "Illegal pkgnum"; +my($pkgnum)=$1; + +my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +bless($cust_pkg,'FS::cust_pkg'); +my($error)=$cust_pkg->suspend; +&idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +sub idiot { + my($error)=@_; + SendHeaders(); + print < + + Error suspending package + + +
+

Error suspending package

+
+
+ There has been an error suspending this package: $error + + + +END + exit; +} + diff --git a/htdocs/misc/unsusp_pkg.cgi b/htdocs/misc/unsusp_pkg.cgi new file mode 100755 index 000000000..2f340c6fa --- /dev/null +++ b/htdocs/misc/unsusp_pkg.cgi @@ -0,0 +1,68 @@ +#!/usr/bin/perl -Tw +# +# susp_pkg.cgi: Unsuspend a package +# +# Usage: susp_pkg.cgi pkgnum +# http://server.name/path/susp_pkg.cgi pkgnum +# +# Note: Should be run setuid freeside as user nobody +# +# 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 + +use strict; +use CGI::Base qw(:DEFAULT :CGI); # CGI module +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_pkg; + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +#untaint pkgnum +$QUERY_STRING =~ /^(\d+)$/ || die "Illegal pkgnum"; +my($pkgnum)=$1; + +my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + +bless($cust_pkg,'FS::cust_pkg'); +my($error)=$cust_pkg->unsuspend; +&idiot($error) if $error; + +$cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum')); + +sub idiot { + my($error)=@_; + SendHeaders(); + print < + + Error unsuspending package + + +
+

Error unsuspending package

+
+
+ There has been an error unsuspending this package: $error + + + +END + exit; +} + diff --git a/htdocs/search/cust_bill.cgi b/htdocs/search/cust_bill.cgi new file mode 100755 index 000000000..5be84b79e --- /dev/null +++ b/htdocs/search/cust_bill.cgi @@ -0,0 +1,46 @@ +#!/usr/bin/perl -Tw +# +# cust_bill.cgi: Search for invoices (process form) +# +# Usage: post form to: +# http://server.name/path/cust_bill.cgi +# +# Note: Should be run setuid freeside as user nobody. +# +# ivan@voicenet.com 97-apr-4 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); + +my($req)=new CGI::Request; +cgisuidsetup($req->cgi); + +$req->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; +my($invnum)=$2; + +if ( qsearchs('cust_bill',{'invnum'=>$invnum}) ) { + $req->cgi->redirect("../view/cust_bill.cgi?$invnum"); #redirect +} else { #error + CGI::Base::SendHeaders(); # one guess + print < + + Invoice Search Error + + +
+

Invoice Search Error

+
+ Invoice not found. +
+ + +END + +} + diff --git a/htdocs/view/cust_pkg.cgi b/htdocs/view/cust_pkg.cgi new file mode 100755 index 000000000..04e38326a --- /dev/null +++ b/htdocs/view/cust_pkg.cgi @@ -0,0 +1,181 @@ +#!/usr/bin/perl -Tw +# +# cust_pkg.cgi: View a package +# +# Usage: cust_pkg.cgi pkgnum +# http://server.name/path/cust_pkg.cgi?pkgnum +# +# Note: Should be run setuid freeside as user nobody. +# +# ivan@voicenet.com 96-dec-15 +# +# services section needs to be cleaned up, needs to display extraneous +# entries in cust_pkg! +# ivan@voicenet.com 96-dec-31 +# +# added navigation bar +# ivan@voicenet.com 97-jan-30 +# +# changed and fixed up suspension and cancel stuff, now you can't add +# services to a cancelled package +# ivan@voicenet.com 97-feb-27 +# +# rewrote for new API, still needs to be cleaned up! +# ivan@voicenet.com 97-jul-29 +# +# no FS::Search ivan@sisd.com 98-mar-7 + +use strict; +use Date::Format; +use CGI::Base qw(:DEFAULT :CGI); # CGI module +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs); + +my($cgi) = new CGI::Base; +$cgi->get; +&cgisuidsetup($cgi); + +my(%uiview,%uiadd); +my($part_svc); +foreach $part_svc ( qsearch('part_svc',{}) ) { + $uiview{$part_svc->svcpart}="../view/". $part_svc->svcdb . ".cgi"; + $uiadd{$part_svc->svcpart}="../edit/". $part_svc->svcdb . ".cgi"; +} + +SendHeaders(); # one guess. +print < + + Package View + + +
+

Package View

+
+ +END + +#untaint pkgnum +$QUERY_STRING =~ /^(\d+)$/; +my($pkgnum)=$1; + +#get package record +my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +die "No package!" unless $cust_pkg; +my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); + +#nav bar +my($custnum)=$cust_pkg->getfield('custnum'); +print qq!
View this customer!, + qq! (#$custnum) | Main menu

!; + +#print info +my($susp,$cancel,$expire)=( + $cust_pkg->getfield('susp'), + $cust_pkg->getfield('cancel'), + $cust_pkg->getfield('expire'), +); +print "
Package #$pkgnum"; +print qq!
Package Information!; +print qq! | Service Information! unless $cancel; +print qq!

\n!; + +my($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment')); +print qq!
Package Information!, + qq!!; +print qq!
Edit this information
!; +print "

Package: $pkg - $comment"; + +my($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill')); +print "
Setup: ", $setup ? time2str("%D",$setup) : "(Not setup)" ,""; +print "
Next bill: ", $bill ? time2str("%D",$bill) : "" ,""; + +if ($susp) { + print "
Suspended: ", time2str("%D",$susp), ""; + print qq! Unsuspend! unless $cancel; +} else { + print qq!
Suspend! unless $cancel; +} + +if ($expire) { + print "
Expire: ", time2str("%D",$expire), ""; +} + print < + +Expire (date): + +END + +if ($cancel) { + print "
Cancelled: ", time2str("%D",$cancel), ""; +} else { + print qq!
Cancel now!; +} + +#otaker +my($otaker)=$cust_pkg->getfield('otaker'); +print "

Order taken by $otaker"; + +unless ($cancel) { + + #services + print <

Service Information +
Click on service to view/edit/add service.

+
Do NOT pick the "Link to existing" option unless you are auditing!!!
+
+ +END + + #list of services this pkgpart includes + my($pkg_svc,%pkg_svc); + foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) { + $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity if $pkg_svc->quantity; + } + + #list of records from cust_svc + my($svcpart); + foreach $svcpart (sort {$a <=> $b} keys %pkg_svc) { + + my($svc)=qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); + + my(@cust_svc)=qsearch('cust_svc',{'pkgnum'=>$pkgnum, + 'svcpart'=>$svcpart, + }); + + my($enum); + for $enum ( 1 .. $pkg_svc{$svcpart} ) { + + my($cust_svc); + if ( $cust_svc=shift @cust_svc ) { + my($svcnum)=$cust_svc->svcnum; + print < +END + } else { + print < + + +END + } + + } + warn "WARNING: Leftover services pkgnum $pkgnum!" if @cust_svc;; + } + + print "
Service(View) $svc
+ (Add) $svc + or + (Link to existing) $svc +
"; + +} + +#formatting +print < + +END + diff --git a/htdocs/view/svc_domain.cgi b/htdocs/view/svc_domain.cgi new file mode 100755 index 000000000..78ff6ac0b --- /dev/null +++ b/htdocs/view/svc_domain.cgi @@ -0,0 +1,76 @@ +#!/usr/bin/perl -Tw +# +# View svc_domain records +# +# Usage: svc_domain svcnum +# http://server.name/path/svc_domain.cgi?svcnum +# +# Note: Should be run setuid freeside as user nobody. +# +# ivan@voicenet.com 97-jan-6 +# +# rewrite ivan@sisd.com 98-mar-14 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Base qw(:DEFAULT :CGI); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); + +my($cgi) = new CGI::Base; +$cgi->get; +cgisuidsetup($cgi); + +#untaint svcnum +$QUERY_STRING =~ /^(\d+)$/; +my($svcnum)=$1; +my($svc_domain)=qsearchs('svc_domain',{'svcnum'=>$svcnum}); +die "Unknown svcnum" unless $svc_domain; +my($domain)=$svc_domain->domain; + +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'); +} + +my($part_svc)=qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +die "Unkonwn svcpart" unless $part_svc; + +SendHeaders(); # one guess. +print < + + Domain View + + +

Domain View

+ +
+View this package (#$pkgnum) | +View this customer (#$custnum) | +Main menu

+ Service #$svcnum +
+END + +print "
"; +print "Service: ", $part_svc->svc, ""; +print "
"; + +print qq!Domain name $domain.!; +print qq!

View whois information.!; + +print "


"; + + #formatting + print < + +END +