X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fview%2Fcust_main.cgi;h=9595a07e1e720134bbcb6249bf6fa12565c402d8;hb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39;hp=6c260bb7d37fa47114536e64796e4915d809bb0c;hpb=51984ac3d3da3006809c6866fdecd4ad83610731;p=freeside.git
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 6c260bb7d..9595a07e1 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -1,49 +1,43 @@
-
+
<%
-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(
+my $conf = new FS::Conf;
+
+print header("Customer View", menubar(
'Main Menu' => popurl(2)
));
die "No customer specified (bad URL)!" unless $cgi->keywords;
-($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
+my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
$query =~ /^(\d+)$/;
-$custnum = $1;
-$cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
+my $custnum = $1;
+my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
die "Customer not found!" unless $cust_main;
-$hashref = $cust_main->hashref;
print qq!Edit this customer!;
print qq! | Delete this customer!
if $conf->exists('deletecustomers');
+
+unless ( $conf->exists('disable_customer_referrals') ) {
+ print qq! | !,
+ qq!Refer a new customer!;
+
+ print qq! | !,
+ qq!View this customer's referrals!;
+}
+
print '
';
+my $signupurl = $conf->config('signupurl');
+if ( $signupurl ) {
+print "This customer's signup URL: ".
+ "$signupurl?ref=$custnum
";
+}
+
print '';
print &itable(), '
';
@@ -94,36 +88,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") || ' ', '',
'', ""
;
@@ -138,15 +132,16 @@ print '';
$custnum, ' | ',
;
- @agents = qsearch( 'agent', {} );
+ my @agents = qsearch( 'agent', {} );
+ my $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', {} );
+ my @referrals = qsearch( 'part_referral', {} );
unless ( scalar(@referrals) == 1 ) {
my $referral = qsearchs('part_referral', {
'refnum' => $cust_main->refnum
@@ -157,13 +152,33 @@ 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->company. ' ('.
+ $referring_cust_main->last. ', '. $referring_cust_main->first.
+ ')'
+ : $referring_cust_main->last. ', '. $referring_cust_main->first
+ ).
+ '';
+ }
+ print ' |
';
+
print '';
print '
';
- @invoicing_list = $cust_main->invoicing_list;
+ my @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',
@@ -209,7 +224,36 @@ print ' ';
print ' |
';
-print qq!
Packages !,
+if ( defined $cust_main->dbdef_table->column('comments')
+ && $cust_main->comments )
+{
+ print "
Comments", &ntable("#cccccc"), "",
+ &ntable("#cccccc",2),
+ ' |
', $cust_main->comments,
+ ' |
';
+}
+
+print '';
+
+print '
'.
+ '