From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/view/cust_bill.cgi | 97 ++++++++++ httemplate/view/cust_main.cgi | 398 ++++++++++++++++++++++++++++++++++++++++ httemplate/view/cust_pkg.cgi | 210 +++++++++++++++++++++ httemplate/view/svc_acct.cgi | 181 ++++++++++++++++++ httemplate/view/svc_acct_sm.cgi | 132 +++++++++++++ httemplate/view/svc_domain.cgi | 106 +++++++++++ 6 files changed, 1124 insertions(+) create mode 100755 httemplate/view/cust_bill.cgi create mode 100755 httemplate/view/cust_main.cgi create mode 100755 httemplate/view/cust_pkg.cgi create mode 100755 httemplate/view/svc_acct.cgi create mode 100755 httemplate/view/svc_acct_sm.cgi create mode 100755 httemplate/view/svc_domain.cgi (limited to 'httemplate/view') diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi new file mode 100755 index 000000000..24d67ddc6 --- /dev/null +++ b/httemplate/view/cust_bill.cgi @@ -0,0 +1,97 @@ +<% +# +# $Id: cust_bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# this is a quick & ugly hack which does little more than add some formatting to the ascii output from /dbin/print-invoice +# +# ivan@voicenet.com 96-dec-05 +# +# added navigation bar +# ivan@voicenet.com 97-jan-30 +# +# now uses Invoice.pm +# ivan@voicenet.com 97-jun-30 +# +# what to do if cust_bill search errors? +# ivan@voicenet.com 97-jul-7 +# +# s/FS::Search/FS::Record/; $cgisuidsetup($cgi); ivan@sisd.com 98-mar-14 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# also print 'printed' field ivan@sisd.com 98-jul-10 +# +# $Log: cust_bill.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.8 1999/02/28 00:03:58 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/25 12:26:03 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:14:18 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:42 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/30 23:03:33 ivan +# bugfixes; fields isn't exported by derived classes +# +# Revision 1.3 1998/12/23 03:07:49 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.2 1998/12/17 09:57:20 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# + +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; +$query =~ /^(\d+)$/; +$invnum = $1; + +$cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Invoice #$invnum not found!" unless $cust_bill; +$custnum = $cust_bill->getfield('custnum'); + +$printed = $cust_bill->printed; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Invoice View', menubar( + "Main Menu" => $p, + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", +)), <Enter payments (check/cash) against this invoice +
Reprint this invoice +

(Printed $printed times) +
+END
+
+print $cust_bill->print_text;
+
+	#formatting
+	print <
+  
+
+END
+
+%>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
new file mode 100755
index 000000000..6c260bb7d
--- /dev/null
+++ b/httemplate/view/cust_main.cgi
@@ -0,0 +1,398 @@
+
+<%
+
+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 ); 
+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;
+
+$cgi = new CGI;
+&cgisuidsetup($cgi);
+
+$conf = new FS::Conf;
+
+print $cgi->header( '-expires' => 'now' ), 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
+$query =~ /^(\d+)$/;
+$custnum = $1;
+$cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
+die "Customer not found!" unless $cust_main;
+$hashref = $cust_main->hashref;
+
+print qq!Edit this customer!;
+print qq! |  Delete this customer!
+  if $conf->exists('deletecustomers');
+print '

'; + +print ''; + +print &itable(), ''; + +print ''; + + print "Billing address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->last, ', ', $cust_main->first, + 'SS#', + $cust_main->ss || ' ', '', + 'Company', + $cust_main->company, + '', + 'Address', + $cust_main->address1, + '', + ; + print ' ', + $cust_main->address2, '' + if $cust_main->address2; + print 'City', + $cust_main->city, + 'State', + $cust_main->state, + 'Zip', + $cust_main->zip, '', + 'Country', + $cust_main->country, + '', + ; + print 'Day Phone', + $cust_main->daytime || ' ', '', + 'Night Phone', + $cust_main->night || ' ', '', + 'Fax', + $cust_main->fax || ' ', '', + '', "" + ; + + if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + my $pre = $cust_main->ship_last ? 'ship_' : ''; + + print "
Service address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"), + '', + 'Company', + $cust_main->get("${$pre}company"), + '', + 'Address', + $cust_main->get("${$pre}address1"), + '', + ; + print ' ', + $cust_main->get("${$pre}address2"), '' + if $cust_main->get("${$pre}address2"); + print 'City', + $cust_main->get("${$pre}city"), + 'State', + $cust_main->get("${$pre}state"), + 'Zip', + $cust_main->get("${$pre}zip"), '', + 'Country', + $cust_main->get("${$pre}country"), + '', + ; + print 'Day Phone', + '', + $cust_main->get("${$pre}daytime") || ' ', '', + 'Night Phone'. + '', + $cust_main->get("${$pre}night") || ' ', '', + 'Fax', + $cust_main->get("${$pre}fax") || ' ', '', + '', "" + ; + + } + +print ''; + +print ''; + + print &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Customer number', + $custnum, '', + ; + + @agents = qsearch( 'agent', {} ); + unless ( scalar(@agents) == 1 ) { + $agent = qsearchs('agent',{ + 'agentnum' => $cust_main->agentnum + } ); + print 'Agent', + $agent->agentnum, ": ", $agent->agent, ''; + } + @referrals = qsearch( 'part_referral', {} ); + unless ( scalar(@referrals) == 1 ) { + my $referral = qsearchs('part_referral', { + 'refnum' => $cust_main->refnum + } ); + print 'Referral', + $referral->refnum, ": ", $referral->referral, ''; + } + print 'Order taker', + $cust_main->otaker, ''; + + print ''; + +print '
'; + + @invoicing_list = $cust_main->invoicing_list; + print "Billing information (", + qq!!, "Bill now)", + &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Tax exempt', + $cust_main->tax ? 'yes' : 'no', + '', + 'Postal invoices', + ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no', + '', + 'Email invoices', + join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no', + '', + 'Billing type', + ; + + if ( $cust_main->payby eq 'CARD' ) { + print 'Credit card', + 'Card number', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + 'Name on card', + $cust_main->payname, '' + ; + } elsif ( $cust_main->payby eq 'BILL' ) { + print 'Billing'; + print 'P.O. ', + $cust_main->payinfo, '', + if $cust_main->payinfo; + print 'Expiration', + $cust_main->paydate, '', + 'Attention', + $cust_main->payname, '', + ; + } elsif ( $cust_main->payby eq 'COMP' ) { + print 'Complimentary', + 'Authorized by', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + ; + } + + print ""; + +print ''; + +print qq!

Packages !, +# qq!
Click on package number to view/edit package.!, + qq!( Order and cancel packages (preserves services) )!, +; + +#display packages + +#formatting +print qq!!, &table(), "\n", + qq!Package!, + qq!DatesServices\n!, + qq!Setup!, + qq!Next bill!, + qq!Susp.Expire!, + qq!!, + qq!Cancel!, + qq!\n!; + +#get package info +if ( $conf->exists('hidecancelledpackages') ) { + @packages = $cust_main->ncancelled_pkgs; +} else { + @packages = $cust_main->all_pkgs; +} + +$n1 = ''; +foreach $package (@packages) { + my $pkgnum = $package->pkgnum; + my $pkg = $package->part_pkg->pkg; + my $comment = $package->part_pkg->comment; + my $pkgview = popurl(2). "view/cust_pkg.cgi?$pkgnum"; + my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + my $rowspan = scalar(@cust_svc) || 1; + + my $button_cgi = new CGI; + $button_cgi->param('clone', $package->part_pkg->pkgpart); + $button_cgi->param('pkgnum', $package->pkgnum); + my $button_url = popurl(2). "edit/part_pkg.cgi?". $button_cgi->query_string; + + #print $n1, qq!$pkgnum!, + print $n1, qq!$pkgnum!, + qq!!, + #qq!$pkg - $comment!, + qq!$pkg - $comment!, + qq! ( Edit | Customize pricing )!, + ; + for ( qw( setup bill susp expire cancel ) ) { + print "", ( $package->getfield($_) + ? time2str("%D", $package->getfield($_) ) + : ' ' + ), '', + ; + } + + my $n2 = ''; + foreach my $cust_svc ( @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my($svcnum) = $cust_svc->svcnum; + my($sview) = popurl(2). "view"; + print $n2,qq!$label!, + qq!$value!; + $n2=""; + } + $n1=""; +} +print ""; + +#formatting +print ""; + +#formatting +print qq!

Payment History!, + qq!!, + qq! ( Click on invoice to view invoice/enter payment. | !, + qq!!, + qq!Post credit / refund )!; + +#get payment history +# +# major problem: this whole thing is way too sloppy. +# minor problem: the description lines need better formatting. + +@history = (); #needed for mod_perl :) + +@bills = qsearch('cust_bill',{'custnum'=>$custnum}); +foreach $bill (@bills) { + my($bref)=$bill->hashref; + push @history, + $bref->{_date} . qq!\tInvoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)\t! . + $bref->{charged} . qq!\t\t\t!; + + my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); + my($payment); + foreach $payment (@payments) { + my($date,$invnum,$payby,$payinfo,$paid)=($payment->getfield('_date'), + $payment->getfield('invnum'), + $payment->getfield('payby'), + $payment->getfield('payinfo'), + $payment->getfield('paid'), + ); + push @history, + "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; + } +} + +@credits = qsearch('cust_credit',{'custnum'=>$custnum}); +foreach $credit (@credits) { + my($cref)=$credit->hashref; + push @history, + $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" . + $cref->{credited} . ") by " . $cref->{otaker} . " - " . + $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; + + my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); + my($refund); + foreach $refund (@refunds) { + my($rref)=$refund->hashref; + push @history, + $rref->{_date} . "\tRefund, Credit #" . $rref->{crednum} . " (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; + } +} + + #formatting + print &table(), < + Date + Description + Charge + Payment + In-house
Credit
+ Refund + Balance + +END + +#display payment history + +$balance = 0; +foreach $item (sort keyfield_numerically @history) { + my($date,$desc,$charge,$payment,$credit,$refund)=split(/\t/,$item); + $charge ||= 0; + $payment ||= 0; + $credit ||= 0; + $refund ||= 0; + $balance += $charge - $payment; + $balance -= $credit - $refund; + + print "",time2str("%D",$date),"", + "$desc", + "", + ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), + "", + "", + ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), + "", + "", + ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), + "", + "", + ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), + "", + "\$" . sprintf("%.2f",$balance), + "", + "\n"; +} + +#formatting +print ""; + +#end + +#formatting +print < + +END + +#subroutiens +sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0] ; } + +%> diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi new file mode 100755 index 000000000..5e733225b --- /dev/null +++ b/httemplate/view/cust_pkg.cgi @@ -0,0 +1,210 @@ +<% +# +# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: cust_pkg.cgi pkgnum +# http://server.name/path/cust_pkg.cgi?pkgnum +# +# 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 +# +# $Log: cust_pkg.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 1999/04/09 04:22:34 ivan +# also table() +# +# Revision 1.10 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:01 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/19 05:14:20 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:44 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/23 03:11:40 ivan +# *** empty log message *** +# +# Revision 1.3 1998/12/17 09:57:22 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/11/13 09:56:49 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +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',{}) ) { + $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; +$query =~ /^(\d+)$/; +$pkgnum = $1; + +#get package record +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +die "No package!" unless $cust_pkg; +$part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); + +$custnum = $cust_pkg->getfield('custnum'); +print $cgi->header( '-expires' => 'now' ), header('Package View', menubar( + "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", + 'Main Menu' => popurl(2) +)); + +#print info +($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'); + +print "Package information"; +print ' (unsuspend)' if ( $susp && ! $cancel ); +print ' (suspend)' unless ( $susp || $cancel ); +print ' (cancel)' unless $cancel; + +print &ntable("#cccccc"), '', &ntable("#cccccc",2), + 'Package number', + $pkgnum, '', + 'Package', + $pkg, '', + 'Comment', + $comment, '', + 'Setup date', + ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '', + 'Next bill date', + ( $bill ? time2str("%D",$bill) : " " ), '', +; +print 'Suspension date', + time2str("%D",$susp), '' if $susp; +print 'Expiration date', + time2str("%D",$expire), '' if $expire; +print 'Cancellation date', + time2str("%D",$cancel), '' if $cancel; +print 'Order taker', + $otaker, '', + '' +; + +# print < +# +#Expire (date): +# +#END + +unless ($cancel) { + + #services + print '
Service Information', &table(); + + #list of services this pkgpart includes + my $pkg_svc; + my %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; + my($label, $value, $svcdb) = $cust_svc->label; + print <(View) $svc: $value +END + } else { + print < + + (Add) $svc + or + (Link to existing) $svc + + +END + } + + } + warn "WARNING: Leftover services pkgnum $pkgnum!" if @cust_svc;; + } + + print "", + "Choose (View) to view or edit an existing service
", + "Choose (Add) to setup a new service
", + "Choose (Link to existing) to link to a legacy (pre-Freeside) service", + "
" + ; +} + +#formatting +print < + +END + +%> diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi new file mode 100755 index 000000000..f28bd9497 --- /dev/null +++ b/httemplate/view/svc_acct.cgi @@ -0,0 +1,181 @@ +<% +# +# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_acct.cgi svcnum +# http://server.name/path/svc_acct.cgi?svcnum +# +# ivan@voicenet.com 96-dec-17 +# +# added link to send info +# ivan@voicenet.com 97-jan-4 +# +# added navigation bar and ability to change username, etc. +# ivan@voicenet.com 97-jan-30 +# +# activate 800 service +# ivan@voicenet.com 97-feb-10 +# +# modified navbar code (should be a subroutine?), added link to cancel account (only if not audited) +# ivan@voicenet.com 97-apr-16 +# +# INCOMPLETELY rewrote some things for new API +# ivan@voicenet.com 97-jul-29 +# +# FS::Search became FS::Record, use strict, etc. ivan@sisd.com 98-mar-9 +# +# 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 +# +# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17 +# +# displays arbitrary radius attributes ivan@sisd.com 98-aug-16 +# +# $Log: svc_acct.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.12 2001/01/31 07:21:00 ivan +# fix tyops +# +# Revision 1.11 2000/12/03 20:25:20 ivan +# session monitor updates +# +# Revision 1.10 1999/04/14 11:27:06 ivan +# showpasswords config option to show passwords +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:02 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/19 05:14:21 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:45 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1999/01/18 09:22:36 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.4 1998/12/23 03:09:19 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 09:57:23 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/12/16 05:24:29 ivan +# use FS::Conf; +# + +use strict; +use vars qw( $conf $cgi $mydomain $query $svcnum $svc_acct $cust_svc $pkgnum + $cust_pkg $custnum $part_svc $p $svc_acct_pop $password ); +use CGI; +use CGI::Carp qw( fatalsToBrowser ); +use FS::UID qw( cgisuidsetup ); +use FS::CGI qw( header popurl menubar); +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; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +($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}); +$pkgnum = $cust_svc->getfield('pkgnum'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +die "Unknown svcpart" unless $part_svc; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Account View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)); + +#print qq!
Send account information!; + +print qq!Edit this information!, + "
Service #$svcnum", + "
Service: ", $part_svc->svc, "", + "

Username: ", $svc_acct->username, "" +; + +print "
Password: "; +$password = $svc_acct->_password; +if ( $password =~ /^\*\w+\* (.*)$/ ) { + $password = $1; + print "(login disabled) "; +} +if ( $conf->exists('showpasswords') ) { + print "$password"; +} else { + print "(hidden)"; +} +$password = ''; + +$svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); +print "
POP: ", $svc_acct_pop->city, ", ", $svc_acct_pop->state, + " (", $svc_acct_pop->ac, ")/", $svc_acct_pop->exch, "" + if $svc_acct_pop; + +if ($svc_acct->uid ne '') { + print "

Uid: ", $svc_acct->uid, "", + "
Gid: ", $svc_acct->gid, "", + "
Finger name: ", $svc_acct->finger, "", + "
Home directory: ", $svc_acct->dir, "", + "
Shell: ", $svc_acct->shell, "", + "
Quota: ", $svc_acct->quota, " (unimplemented)" + ; +} else { + print "

(No shell account)"; +} + +if ($svc_acct->slipip) { + print "

IP address: ", ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) ? "(Dynamic)" : $svc_acct->slipip ,""; + my($attribute); + foreach $attribute ( grep /^radius_/, fields('svc_acct') ) { + #warn $attribute; + $attribute =~ /^radius_(.*)$/; + my($pattribute) = ($1); + $pattribute =~ s/_/-/g; + print "
Radius $pattribute: ". $svc_acct->getfield($attribute), ""; + } +} else { + print "

(No SLIP/PPP account)"; +} + +print ""; + +%> diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi new file mode 100755 index 000000000..9c6ca6e5c --- /dev/null +++ b/httemplate/view/svc_acct_sm.cgi @@ -0,0 +1,132 @@ +<% +# +# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_acct_sm.cgi svcnum +# http://server.name/path/svc_acct_sm.cgi?svcnum +# +# based on view/svc_acct.cgi +# +# ivan@voicenet.com 97-jan-5 +# +# added navigation bar +# ivan@voicenet.com 97-jan-30 +# +# rewrite ivan@sisd.com 98-mar-15 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17 +# +# $Log: svc_acct_sm.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 2000/07/17 10:58:42 ivan +# better error messages if svc_acct or svc_domain records are missing +# +# Revision 1.10 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.9 1999/02/28 00:04:03 ivan +# removed misleading comments +# +# Revision 1.8 1999/02/09 09:23:00 ivan +# visual and bugfixes +# +# Revision 1.7 1999/02/07 09:59:42 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:14:22 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:46 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/23 03:09:52 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 09:57:24 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/12/16 05:24:30 ivan +# use FS::Conf; +# + +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; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +$mydomain = $conf->config('domain'); + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$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'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) + or die "Unkonwn svcpart"; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Mail Alias View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)); + +($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}) + or die "Corrupted database: no svc_domain.svcnum matching domsvc $domsvc"; +$domain = $svc_domain->domain; +$svc_acct = qsearchs('svc_acct',{'uid'=>$domuid}) + or die "Corrupted database: no svc_acct.uid matching domuid $domuid"; +$username = $svc_acct->username; + +print qq!Edit this information!, + "
Service #$svcnum", + "
Service: $svc", + qq!
Mail to !, ( ($domuser eq '*') ? "(anything)" : $domuser ) , qq!\@$domain forwards to $username\@$mydomain mailbox.!, + '' +; + +%> diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi new file mode 100755 index 000000000..f852400da --- /dev/null +++ b/httemplate/view/svc_domain.cgi @@ -0,0 +1,106 @@ +<% +# +# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# Usage: svc_domain svcnum +# http://server.name/path/svc_domain.cgi?svcnum +# +# 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 +# +# $Log: svc_domain.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.11 2000/12/03 15:14:00 ivan +# bugfixes from Jeff Finucane , thanks! +# +# Revision 1.10 1999/08/27 22:18:44 ivan +# point to patrick instead of internic! +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:04 ivan +# removed misleading comments +# +# Revision 1.7 1999/02/23 08:09:25 ivan +# beginnings of one-screen new customer entry and some other miscellania +# +# Revision 1.6 1999/01/19 05:14:23 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.5 1999/01/18 09:41:47 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.4 1998/12/23 03:10:19 ivan +# $cgi->keywords instead of $cgi->query_string +# +# Revision 1.3 1998/12/17 09:57:25 ivan +# s/CGI::(Base|Request)/CGI.pm/; +# +# Revision 1.2 1998/11/13 09:56:50 ivan +# change configuration file layout to support multiple distinct databases (with +# own set of config files, export, etc.) +# + +use strict; +use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum + $cust_pkg $custnum $part_svc $p ); +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; +$query =~ /^(\d+)$/; +$svcnum = $1; +$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'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); +die "Unkonwn svcpart" unless $part_svc; + +$domain = $svc_domain->domain; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Domain View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)), + "Service #$svcnum", + "
Service: ", $part_svc->svc, "", + "
Domain name: $domain.", + qq!

View whois information.!, + '', +; +%> -- cgit v1.2.1 From 2066bf9d3ebb4e53c49ab8b4b447c4eb88e425a4 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 10:41:44 +0000 Subject: shipping address additions --- httemplate/view/cust_main.cgi | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6c260bb7d..752896847 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,6 +1,7 @@ - <% +# +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 ); @@ -94,36 +95,36 @@ print ''; &ntable("#cccccc",2), 'Contact name', '', - $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"), + $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"), '', 'Company', - $cust_main->get("${$pre}company"), + $cust_main->get("${pre}company"), '', 'Address', - $cust_main->get("${$pre}address1"), + $cust_main->get("${pre}address1"), '', ; print ' ', - $cust_main->get("${$pre}address2"), '' - if $cust_main->get("${$pre}address2"); + $cust_main->get("${pre}address2"), '' + if $cust_main->get("${pre}address2"); print 'City', - $cust_main->get("${$pre}city"), + $cust_main->get("${pre}city"), 'State', - $cust_main->get("${$pre}state"), + $cust_main->get("${pre}state"), 'Zip', - $cust_main->get("${$pre}zip"), '', + $cust_main->get("${pre}zip"), '', 'Country', - $cust_main->get("${$pre}country"), + $cust_main->get("${pre}country"), '', ; print 'Day Phone', '', - $cust_main->get("${$pre}daytime") || ' ', '', + $cust_main->get("${pre}daytime") || ' ', '', 'Night Phone'. '', - $cust_main->get("${$pre}night") || ' ', '', + $cust_main->get("${pre}night") || ' ', '', 'Fax', - $cust_main->get("${$pre}fax") || ' ', '', + $cust_main->get("${pre}fax") || ' ', '', '', "" ; -- cgit v1.2.1 From 3dddb60bd783aaf5fa1fda90a351f1e877b7e19b Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 05:52:56 +0000 Subject: add customer comments fields --- httemplate/view/cust_main.cgi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 752896847..8b6fb0c09 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -210,7 +210,16 @@ print '
'; print ''; -print qq!

Packages !, +if ( defined $cust_main->dbdef_table->column('comments') ) { + print "
Comments", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + '
', $cust_main->comments,
+        '
'; +} + +print ''; + +print qq!
Packages !, # qq!
Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, ; -- cgit v1.2.1 From cad8a048ce2d89814d1d3b0783310191bc76684e Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 13 Aug 2001 23:15:35 +0000 Subject: don't display empty comment box --- httemplate/view/cust_main.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8b6fb0c09..088e2bb2f 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -210,7 +210,9 @@ print '
'; print ''; -if ( defined $cust_main->dbdef_table->column('comments') ) { +if ( defined $cust_main->dbdef_table->column('comments') + && $cust_main->comments ) +{ print "
Comments", &ntable("#cccccc"), "", &ntable("#cccccc",2), '
', $cust_main->comments,
-- 
cgit v1.2.1


From 8a8c9386cbd3383b0134aae8e32b5995f8886fb2 Mon Sep 17 00:00:00 2001
From: jeff 
Date: Sun, 19 Aug 2001 15:53:36 +0000
Subject: added user interface for svc_forward and vpopmail support

---
 httemplate/view/svc_acct.cgi    | 15 +++++--
 httemplate/view/svc_domain.cgi  | 19 +++++++--
 httemplate/view/svc_forward.cgi | 91 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 117 insertions(+), 8 deletions(-)
 create mode 100755 httemplate/view/svc_forward.cgi

(limited to 'httemplate/view')

diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi
index f28bd9497..caa8ef00e 100755
--- a/httemplate/view/svc_acct.cgi
+++ b/httemplate/view/svc_acct.cgi
@@ -1,6 +1,6 @@
 <%
 #
-# $Id: svc_acct.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
+# $Id: svc_acct.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $
 #
 # Usage: svc_acct.cgi svcnum
 #        http://server.name/path/svc_acct.cgi?svcnum
@@ -33,7 +33,10 @@
 # displays arbitrary radius attributes ivan@sisd.com 98-aug-16
 #
 # $Log: svc_acct.cgi,v $
-# Revision 1.1  2001-07-30 07:36:04  ivan
+# Revision 1.2  2001-08-19 15:53:36  jeff
+# added user interface for svc_forward and vpopmail support
+#
+# Revision 1.1  2001/07/30 07:36:04  ivan
 # templates!!!
 #
 # Revision 1.12  2001/01/31 07:21:00  ivan
@@ -73,7 +76,7 @@
 #
 
 use strict;
-use vars qw( $conf $cgi $mydomain $query $svcnum $svc_acct $cust_svc $pkgnum
+use vars qw( $conf $cgi $svc_domain $query $svcnum $svc_acct $cust_svc $pkgnum
              $cust_pkg $custnum $part_svc $p $svc_acct_pop $password );
 use CGI;
 use CGI::Carp qw( fatalsToBrowser );
@@ -91,7 +94,6 @@ $cgi = new CGI;
 &cgisuidsetup($cgi);
 
 $conf = new FS::Conf;
-$mydomain = $conf->config('domain');
 
 ($query) = $cgi->keywords;
 $query =~ /^(\d+)$/;
@@ -112,6 +114,9 @@ if ($pkgnum) {
 $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
 die "Unknown svcpart" unless $part_svc;
 
+$svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
+die "Unknown domain" unless $svc_domain;
+
 $p = popurl(2);
 print $cgi->header( '-expires' => 'now' ), header('Account View', menubar(
   ( ( $pkgnum || $custnum )
@@ -132,6 +137,8 @@ print qq!Edit this information!,
       "

Username: ", $svc_acct->username, "" ; +print "
Domain: ", $svc_domain->domain, ""; + print "
Password: "; $password = $svc_acct->_password; if ( $password =~ /^\*\w+\* (.*)$/ ) { diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index f852400da..5728e7dec 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,6 +1,6 @@ <% # -# $Id: svc_domain.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# $Id: svc_domain.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $ # # Usage: svc_domain svcnum # http://server.name/path/svc_domain.cgi?svcnum @@ -13,7 +13,10 @@ # bmccane@maxbaud.net 98-apr-3 # # $Log: svc_domain.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan +# Revision 1.2 2001-08-19 15:53:36 jeff +# added user interface for svc_forward and vpopmail support +# +# Revision 1.1 2001/07/30 07:36:04 ivan # templates!!! # # Revision 1.11 2000/12/03 15:14:00 ivan @@ -52,7 +55,7 @@ use strict; use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum - $cust_pkg $custnum $part_svc $p ); + $cust_pkg $custnum $part_svc $p $svc_acct $email); use CGI; use FS::UID qw(cgisuidsetup); use FS::CGI qw(header menubar popurl menubar); @@ -82,7 +85,13 @@ if ($pkgnum) { } $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); -die "Unkonwn svcpart" unless $part_svc; +die "Unknown svcpart" unless $part_svc; + +if ($svc_domain->catchall) { + $svc_acct = qsearchs('svc_acct',{'svcnum'=> $svc_domain->catchall } ); + die "Unknown svcpart" unless $svc_acct; + $email = $svc_acct->email; +} $domain = $svc_domain->domain; @@ -100,6 +109,8 @@ print $cgi->header( '-expires' => 'now' ), header('Domain View', menubar( "Service #$svcnum", "
Service: ", $part_svc->svc, "", "
Domain name: $domain.", + qq!
Catch all email (change):!, + $email ? "$email." : "(none)", qq!

View whois information.!, '', ; diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi new file mode 100755 index 000000000..7930ab5ec --- /dev/null +++ b/httemplate/view/svc_forward.cgi @@ -0,0 +1,91 @@ +<% +# +# $Id: svc_forward.cgi,v 1.1 2001-08-19 15:53:36 jeff Exp $ +# +# Usage: svc_forward.cgi svcnum +# http://server.name/path/svc_forward.cgi?svcnum +# +# based on view/svc_acct.cgi +# +# $Log: svc_forward.cgi,v $ +# Revision 1.1 2001-08-19 15:53:36 jeff +# added user interface for svc_forward and vpopmail support +# +# + +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; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; + +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$svcnum = $1; +$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'); +if ($pkgnum) { + $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); + $custnum=$cust_pkg->getfield('custnum'); +} else { + $cust_pkg = ''; + $custnum = ''; +} + +$part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ) + or die "Unkonwn svcpart"; + +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header('Mail Forward View', menubar( + ( ( $pkgnum || $custnum ) + ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum", + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + ) + : ( "Cancel this (unaudited) account" => + "${p}misc/cancel-unaudited.cgi?$svcnum" ) + ), + "Main menu" => $p, +)); + +($srcsvc,$dstsvc,$dst) = ( + $svc_forward->srcsvc, + $svc_forward->dstsvc, + $svc_forward->dst, +); +$svc = $part_svc->svc; +$svc_acct = qsearchs('svc_acct',{'svcnum'=>$srcsvc}) + or die "Corrupted database: no svc_acct.svcnum matching srcsvc $srcsvc"; +$source = $svc_acct->email; +if ($dstsvc) { + $svc_acct = qsearchs('svc_acct',{'svcnum'=>$dstsvc}) + or die "Corrupted database: no svc_acct.svcnum matching dstsvc $dstsvc"; + $destination = $svc_acct->email; +}else{ + $destination = $dst; +} + +print qq!Edit this information!, + "
Service #$svcnum", + "
Service: $svc", + qq!
Mail to $source forwards to $destination mailbox.!, + '' +; + +%> -- cgit v1.2.1 From 3d671921441ba8422650b54435a1959ad1d4c71d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Aug 2001 02:31:57 +0000 Subject: remove $Log$ messages. whew. --- httemplate/view/cust_bill.cgi | 51 +-------------------------- httemplate/view/cust_pkg.cgi | 59 +------------------------------- httemplate/view/svc_acct.cgi | 76 +---------------------------------------- httemplate/view/svc_acct_sm.cgi | 57 +------------------------------ httemplate/view/svc_domain.cgi | 54 +---------------------------- httemplate/view/svc_forward.cgi | 14 +------- 6 files changed, 6 insertions(+), 305 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 24d67ddc6..12fe8578a 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,54 +1,5 @@ <% -# -# $Id: cust_bill.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# this is a quick & ugly hack which does little more than add some formatting to the ascii output from /dbin/print-invoice -# -# ivan@voicenet.com 96-dec-05 -# -# added navigation bar -# ivan@voicenet.com 97-jan-30 -# -# now uses Invoice.pm -# ivan@voicenet.com 97-jun-30 -# -# what to do if cust_bill search errors? -# ivan@voicenet.com 97-jul-7 -# -# s/FS::Search/FS::Record/; $cgisuidsetup($cgi); ivan@sisd.com 98-mar-14 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# also print 'printed' field ivan@sisd.com 98-jul-10 -# -# $Log: cust_bill.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.8 1999/02/28 00:03:58 ivan -# removed misleading comments -# -# Revision 1.7 1999/01/25 12:26:03 ivan -# yet more mod_perl stuff -# -# Revision 1.6 1999/01/19 05:14:18 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.5 1999/01/18 09:41:42 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.4 1998/12/30 23:03:33 ivan -# bugfixes; fields isn't exported by derived classes -# -# Revision 1.3 1998/12/23 03:07:49 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.2 1998/12/17 09:57:20 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# +# use strict; use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index 5e733225b..b354318d4 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -1,62 +1,5 @@ <% -# -# $Id: cust_pkg.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: cust_pkg.cgi pkgnum -# http://server.name/path/cust_pkg.cgi?pkgnum -# -# 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 -# -# $Log: cust_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.11 1999/04/09 04:22:34 ivan -# also table() -# -# Revision 1.10 1999/04/09 03:52:55 ivan -# explicit & for table/itable/ntable -# -# Revision 1.9 1999/04/08 12:00:19 ivan -# aesthetic update -# -# Revision 1.8 1999/02/28 00:04:01 ivan -# removed misleading comments -# -# Revision 1.7 1999/01/19 05:14:20 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.6 1999/01/18 09:41:44 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.5 1998/12/23 03:11:40 ivan -# *** empty log message *** -# -# Revision 1.3 1998/12/17 09:57:22 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# -# Revision 1.2 1998/11/13 09:56:49 ivan -# change configuration file layout to support multiple distinct databases (with -# own set of config files, export, etc.) -# +# use strict; use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index caa8ef00e..3a222710f 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,79 +1,5 @@ <% -# -# $Id: svc_acct.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $ -# -# Usage: svc_acct.cgi svcnum -# http://server.name/path/svc_acct.cgi?svcnum -# -# ivan@voicenet.com 96-dec-17 -# -# added link to send info -# ivan@voicenet.com 97-jan-4 -# -# added navigation bar and ability to change username, etc. -# ivan@voicenet.com 97-jan-30 -# -# activate 800 service -# ivan@voicenet.com 97-feb-10 -# -# modified navbar code (should be a subroutine?), added link to cancel account (only if not audited) -# ivan@voicenet.com 97-apr-16 -# -# INCOMPLETELY rewrote some things for new API -# ivan@voicenet.com 97-jul-29 -# -# FS::Search became FS::Record, use strict, etc. ivan@sisd.com 98-mar-9 -# -# 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 -# -# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17 -# -# displays arbitrary radius attributes ivan@sisd.com 98-aug-16 -# -# $Log: svc_acct.cgi,v $ -# Revision 1.2 2001-08-19 15:53:36 jeff -# added user interface for svc_forward and vpopmail support -# -# Revision 1.1 2001/07/30 07:36:04 ivan -# templates!!! -# -# Revision 1.12 2001/01/31 07:21:00 ivan -# fix tyops -# -# Revision 1.11 2000/12/03 20:25:20 ivan -# session monitor updates -# -# Revision 1.10 1999/04/14 11:27:06 ivan -# showpasswords config option to show passwords -# -# Revision 1.9 1999/04/08 12:00:19 ivan -# aesthetic update -# -# Revision 1.8 1999/02/28 00:04:02 ivan -# removed misleading comments -# -# Revision 1.7 1999/01/19 05:14:21 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.6 1999/01/18 09:41:45 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.5 1999/01/18 09:22:36 ivan -# changes to track email addresses for email invoicing -# -# Revision 1.4 1998/12/23 03:09:19 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.3 1998/12/17 09:57:23 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# -# Revision 1.2 1998/12/16 05:24:29 ivan -# use FS::Conf; -# +# use strict; use vars qw( $conf $cgi $svc_domain $query $svcnum $svc_acct $cust_svc $pkgnum diff --git a/httemplate/view/svc_acct_sm.cgi b/httemplate/view/svc_acct_sm.cgi index 9c6ca6e5c..ff665d312 100755 --- a/httemplate/view/svc_acct_sm.cgi +++ b/httemplate/view/svc_acct_sm.cgi @@ -1,60 +1,5 @@ <% -# -# $Id: svc_acct_sm.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# Usage: svc_acct_sm.cgi svcnum -# http://server.name/path/svc_acct_sm.cgi?svcnum -# -# based on view/svc_acct.cgi -# -# ivan@voicenet.com 97-jan-5 -# -# added navigation bar -# ivan@voicenet.com 97-jan-30 -# -# rewrite ivan@sisd.com 98-mar-15 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17 -# -# $Log: svc_acct_sm.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.11 2000/07/17 10:58:42 ivan -# better error messages if svc_acct or svc_domain records are missing -# -# Revision 1.10 1999/04/08 12:00:19 ivan -# aesthetic update -# -# Revision 1.9 1999/02/28 00:04:03 ivan -# removed misleading comments -# -# Revision 1.8 1999/02/09 09:23:00 ivan -# visual and bugfixes -# -# Revision 1.7 1999/02/07 09:59:42 ivan -# more mod_perl fixes, and bugfixes Peter Wemm sent via email -# -# Revision 1.6 1999/01/19 05:14:22 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.5 1999/01/18 09:41:46 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.4 1998/12/23 03:09:52 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.3 1998/12/17 09:57:24 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# -# Revision 1.2 1998/12/16 05:24:30 ivan -# use FS::Conf; -# +# use strict; use vars qw($conf $cgi $mydomain $query $svcnum $svc_acct_sm $cust_svc diff --git a/httemplate/view/svc_domain.cgi b/httemplate/view/svc_domain.cgi index 5728e7dec..cc60df68a 100755 --- a/httemplate/view/svc_domain.cgi +++ b/httemplate/view/svc_domain.cgi @@ -1,57 +1,5 @@ <% -# -# $Id: svc_domain.cgi,v 1.2 2001-08-19 15:53:36 jeff Exp $ -# -# Usage: svc_domain svcnum -# http://server.name/path/svc_domain.cgi?svcnum -# -# 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 -# -# $Log: svc_domain.cgi,v $ -# Revision 1.2 2001-08-19 15:53:36 jeff -# added user interface for svc_forward and vpopmail support -# -# Revision 1.1 2001/07/30 07:36:04 ivan -# templates!!! -# -# Revision 1.11 2000/12/03 15:14:00 ivan -# bugfixes from Jeff Finucane , thanks! -# -# Revision 1.10 1999/08/27 22:18:44 ivan -# point to patrick instead of internic! -# -# Revision 1.9 1999/04/08 12:00:19 ivan -# aesthetic update -# -# Revision 1.8 1999/02/28 00:04:04 ivan -# removed misleading comments -# -# Revision 1.7 1999/02/23 08:09:25 ivan -# beginnings of one-screen new customer entry and some other miscellania -# -# Revision 1.6 1999/01/19 05:14:23 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.5 1999/01/18 09:41:47 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.4 1998/12/23 03:10:19 ivan -# $cgi->keywords instead of $cgi->query_string -# -# Revision 1.3 1998/12/17 09:57:25 ivan -# s/CGI::(Base|Request)/CGI.pm/; -# -# Revision 1.2 1998/11/13 09:56:50 ivan -# change configuration file layout to support multiple distinct databases (with -# own set of config files, export, etc.) -# +# use strict; use vars qw( $cgi $query $svcnum $svc_domain $domain $cust_svc $pkgnum diff --git a/httemplate/view/svc_forward.cgi b/httemplate/view/svc_forward.cgi index 7930ab5ec..e40935bc4 100755 --- a/httemplate/view/svc_forward.cgi +++ b/httemplate/view/svc_forward.cgi @@ -1,17 +1,5 @@ <% -# -# $Id: svc_forward.cgi,v 1.1 2001-08-19 15:53:36 jeff Exp $ -# -# Usage: svc_forward.cgi svcnum -# http://server.name/path/svc_forward.cgi?svcnum -# -# based on view/svc_acct.cgi -# -# $Log: svc_forward.cgi,v $ -# Revision 1.1 2001-08-19 15:53:36 jeff -# added user interface for svc_forward and vpopmail support -# -# +# use strict; use vars qw($conf $cgi $query $svcnum $svc_forward $cust_svc -- cgit v1.2.1 From aa7b51c0794f6a61e522fbba978f6c64446d8696 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 28 Aug 2001 14:34:14 +0000 Subject: customer-to-customer referrals! --- httemplate/view/cust_main.cgi | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 088e2bb2f..cba702670 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -43,8 +43,18 @@ print qq! Delete this customer! if $conf->exists('deletecustomers'); -print '

'; +unless ( $conf->exists('disable_customer_referrals') ) { + print qq! | !, + qq!Refer a new customer!; + + print qq! | !, + qq!View this customer's referrals!; +} + +print '

'; print '
'; print &itable(), ''; @@ -158,6 +168,22 @@ print ''; print 'Order taker', $cust_main->otaker, ''; + print 'Referring Customer'; + my $referring_cust_main = ''; + if ( $cust_main->referral_custnum + && ( $referring_cust_main = + qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) + ) + ) { + print ''. + $cust_main->referral_custnum. ': '. + ( $referring_cust_main->company + || $referring_cust_main->last. ', '. $referring_cust_main->first ). + ''; + } + print ''; + print ''; print '
'; -- cgit v1.2.1 From 6412f71a3557249225abf5eb2096ebad1729c585 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 1 Sep 2001 21:52:20 +0000 Subject: add cust_credit_bill relating multiple invoices to credits --- httemplate/view/cust_main.cgi | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index cba702670..492183d11 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -357,9 +357,15 @@ foreach $bill (@bills) { @credits = qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; + my($credited)=$credit->credited; push @history, - $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" . - $cref->{credited} . ") by " . $cref->{otaker} . " - " . + $cref->{_date} . "\t" . + ($credited ? + (qq!!) : + "") . + "Credit #" . + $cref->{crednum} . ", (Balance \$" . + $credited . ")" . ($credited ? "" : "") . $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); -- cgit v1.2.1 From dbfb0ae501d5acba37f9348476d94b99a4c92450 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 07:49:52 +0000 Subject: things are starting to work again, sorta. --- httemplate/view/cust_main.cgi | 76 ++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 26 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 492183d11..6ece5c2be 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -20,6 +20,8 @@ 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); @@ -329,6 +331,8 @@ print qq!

Payment History!, # major problem: this whole thing is way too sloppy. # minor problem: the description lines need better formatting. +# SHOULD SHOW UNAPPLIED PAYMENTS (now show unapplied credits) + @history = (); #needed for mod_perl :) @bills = qsearch('cust_bill',{'custnum'=>$custnum}); @@ -340,46 +344,66 @@ foreach $bill (@bills) { qq! (Balance \$! . $bill->owed . qq!)\t! . $bref->{charged} . qq!\t\t\t!; - my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); - my($payment); - foreach $payment (@payments) { - my($date,$invnum,$payby,$payinfo,$paid)=($payment->getfield('_date'), - $payment->getfield('invnum'), - $payment->getfield('payby'), - $payment->getfield('payinfo'), - $payment->getfield('paid'), + my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); +# my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); +# my($payment); +# foreach $payment (@payments) { + foreach my $cust_bill_pay (@cust_bill_pay) { + my $payment = $cust_bill_pay->cust_pay; + my($date,$invnum,$payby,$payinfo,$paid)=($payment->_date, + $cust_bill_pay->invnum, + $payment->payby, + $payment->payinfo, + $cust_bill_pay->amount, ); push @history, "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; } + + my(@cust_credit_bill)= + qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); + foreach my $cust_credit_bill (@cust_credit_bill) { + my $cust_credit = $cust_credit_bill->cust_credit; + my($date, $invnum, $crednum, $amount, $reason ) = ( + $cust_credit->_date, + $cust_credit_bill->invnum, + $cust_credit_bill->crednum, + $cust_credit_bill->amount, + $cust_credit->reason, + ); + push @history, + "$date\tCredit #$crednum, Invoice #$invnum $reason\t\t\t$amount\t"; + } } -@credits = qsearch('cust_credit',{'custnum'=>$custnum}); +@credits = grep $_->credited, qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; - my($credited)=$credit->credited; push @history, $cref->{_date} . "\t" . - ($credited ? - (qq!!) : - "") . - "Credit #" . + qq!!. + 'Unapplied credit #' . $cref->{crednum} . ", (Balance \$" . - $credited . ")" . ($credited ? "" : "") . + $credit->credited . ") ". $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; +} - my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); - my($refund); - foreach $refund (@refunds) { - my($rref)=$refund->hashref; - push @history, - $rref->{_date} . "\tRefund, Credit #" . $rref->{crednum} . " (" . - $rref->{payby} . " " . $rref->{payinfo} . ") by " . - $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . - $rref->{refund}; - } +my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); +my($refund); +foreach $refund (@refunds) { + my($rref)=$refund->hashref; + my($refundnum) = ( + $refund->refundnum, + ); + + push @history, + $rref->{_date} . "\tRefund #$refundnum, (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; } + #formatting print &table(), < -- cgit v1.2.1 From fbcb45dfe5a1bce7981fe4527176b9fdf2ec54b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Sep 2001 22:07:39 +0000 Subject: fix more bugs --- httemplate/view/cust_bill.cgi | 12 ++++++--- httemplate/view/cust_main.cgi | 59 +++++++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 26 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 12fe8578a..1e024f377 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $invnum $cust_bill $custnum $printed $p ); @@ -29,9 +29,13 @@ $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header('Invoice View', menubar( "Main Menu" => $p, "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", -)), <Enter payments (check/cash) against this invoice -
Reprint this invoice +)); + +print qq!Enter payments (check/cash) against this invoice | ! + if $cust_bill->owed > 0; + +print <Reprint this invoice

(Printed $printed times)
 END
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 6ece5c2be..a32abc0e1 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -1,5 +1,5 @@
 <%
-#
+#
 
 use strict;
 use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral 
@@ -192,7 +192,7 @@ print '
'; @invoicing_list = $cust_main->invoicing_list; print "Billing information (", - qq!!, "Bill now)", + qq!!, "Bill now)", &ntable("#cccccc"), "", &ntable("#cccccc",2), 'Tax exempt', $cust_main->tax ? 'yes' : 'no', @@ -269,9 +269,9 @@ print qq!!, &table(), "\n", #get package info if ( $conf->exists('hidecancelledpackages') ) { - @packages = $cust_main->ncancelled_pkgs; + @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->ncancelled_pkgs); } else { - @packages = $cust_main->all_pkgs; + @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs); } $n1 = ''; @@ -320,28 +320,31 @@ print ""; print ""; #formatting -print qq!

Payment History!, - qq!!, - qq! ( Click on invoice to view invoice/enter payment. | !, - qq!!, - qq!Post credit / refund )!; +print qq!

Payment History!. + qq! ( !. + qq!!. + qq!Post payment | !. + qq!!. + qq!Post credit )!; #get payment history # # major problem: this whole thing is way too sloppy. # minor problem: the description lines need better formatting. -# SHOULD SHOW UNAPPLIED PAYMENTS (now show unapplied credits) - @history = (); #needed for mod_perl :) @bills = qsearch('cust_bill',{'custnum'=>$custnum}); foreach $bill (@bills) { my($bref)=$bill->hashref; + my $bpre = ( $bill->owed > 0 ) + ? ' Open ' + : ''; + my $bpost = ( $bill->owed > 0 ) ? '' : ''; push @history, $bref->{_date} . qq!\tInvoice #! . $bref->{invnum} . - qq! (Balance \$! . $bill->owed . qq!)\t! . + $bref->{invnum} . qq!">${bpre}Invoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . $bref->{charged} . qq!\t\t\t!; my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); @@ -356,6 +359,7 @@ foreach $bill (@bills) { $payment->payinfo, $cust_bill_pay->amount, ); + $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) if $payby eq 'CARD'; push @history, "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; } @@ -364,33 +368,34 @@ foreach $bill (@bills) { qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); foreach my $cust_credit_bill (@cust_credit_bill) { my $cust_credit = $cust_credit_bill->cust_credit; - my($date, $invnum, $crednum, $amount, $reason ) = ( + my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( $cust_credit->_date, $cust_credit_bill->invnum, $cust_credit_bill->crednum, $cust_credit_bill->amount, $cust_credit->reason, + time2str("%D", $cust_credit_bill->_date), ); push @history, - "$date\tCredit #$crednum, Invoice #$invnum $reason\t\t\t$amount\t"; + "$date\tCredit #$crednum: $reason
". + "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; } } -@credits = grep $_->credited, qsearch('cust_credit',{'custnum'=>$custnum}); +@credits = grep { $_->credited > 0 } + qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; push @history, $cref->{_date} . "\t" . qq!!. - 'Unapplied credit #' . - $cref->{crednum} . ", (Balance \$" . - $credit->credited . ") ". - $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; + 'Unapplied credit #' . + $cref->{crednum} . ": ". + $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; } my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); -my($refund); -foreach $refund (@refunds) { +foreach my $refund (@refunds) { my($rref)=$refund->hashref; my($refundnum) = ( $refund->refundnum, @@ -403,6 +408,16 @@ foreach $refund (@refunds) { $rref->{refund}; } +my @unapplied_payments = + grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); +foreach my $payment (@unapplied_payments) { + push @history, + $payment->_date. "\t". + ''. + 'Unapplied payment #' . + $payment->paynum . "". + "\t\t" . $payment->unapplied . "\t\t"; +} #formatting print &table(), < Date: Tue, 4 Sep 2001 14:44:07 +0000 Subject: new admin documentation, quick one-pkg order --- httemplate/view/cust_main.cgi | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a32abc0e1..b3ea336e9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -153,11 +153,11 @@ print ''; @agents = qsearch( 'agent', {} ); unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ - 'agentnum' => $cust_main->agentnum - } ); + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); print 'Agent', $agent->agentnum, ": ", $agent->agent, ''; + } else { + $agent = $agents[0]; } @referrals = qsearch( 'part_referral', {} ); unless ( scalar(@referrals) == 1 ) { @@ -249,6 +249,21 @@ if ( defined $cust_main->dbdef_table->column('comments') print ''; +print '
'. + '
'. + qq!!. + '
'; + print qq!
Packages !, # qq!
Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, -- cgit v1.2.1 From 89301379ac6f1e2ebab203e458849001d3f8fb49 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 09:56:27 +0000 Subject: fix quick order --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index b3ea336e9..174c08760 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -252,7 +252,7 @@ print ''; print '
'. ''. qq!!. - '