don't use a table with WIDTH="100%", it shoves the custnum and "billing information...
[freeside.git] / httemplate / view / cust_main.cgi
1 <!-- mason kludge -->
2 <%
3
4 my $conf = new FS::Conf;
5
6 my %uiview = ();
7 my %uiadd = ();
8 foreach my $part_svc ( qsearch('part_svc',{}) ) {
9   $uiview{$part_svc->svcpart} = $p. "view/". $part_svc->svcdb . ".cgi";
10   $uiadd{$part_svc->svcpart}= $p. "edit/". $part_svc->svcdb . ".cgi";
11 }
12
13 %>
14
15 <%= include("/elements/header.html","Customer View", menubar(
16   'Main Menu' => $p,
17 )) %>
18
19 <%
20
21 die "No customer specified (bad URL)!" unless $cgi->keywords;
22 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
23 $query =~ /^(\d+)$/;
24 my $custnum = $1;
25 my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
26 die "Customer not found!" unless $cust_main;
27
28 print qq!<A HREF="${p}edit/cust_main.cgi?$custnum">Edit this customer</A>!;
29
30 %>
31
32 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws.js"></SCRIPT>
33 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_iframe.js"></SCRIPT>
34 <SCRIPT TYPE="text/javascript" SRC="../elements/overlibmws_draggable.js"></SCRIPT>
35
36 <SCRIPT TYPE="text/javascript">
37 function areyousure(href, message) {
38   if (confirm(message) == true)
39     window.location.href = href;
40 }
41 </SCRIPT>
42
43 <SCRIPT TYPE="text/javascript">
44
45 <%
46 my $ban = '';
47 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
48   $ban = '<BR><P ALIGN="center">'.
49          '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\\\'s ';
50   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
51     $ban .= 'credit card';
52   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
53     $ban .= 'ACH account';
54   }
55 }
56 %>
57
58 var confirm_cancel = '<FORM METHOD="POST" ACTION="<%= $p %>misc/cust_main-cancel.cgi"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>"> <BR><P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B> <%= $ban%><BR><P ALIGN="CENTER"> <INPUT TYPE="submit" VALUE="Cancel customer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don\'t cancel" onClick="cClick()"> </FORM> ';
59
60 </SCRIPT>
61
62 <% if ( $cust_main->ncancelled_pkgs ) { %>
63
64   | <A HREF="javascript:void(0);" onClick="overlib(confirm_cancel, CAPTION, 'Confirm cancellation', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' ); return false; ">Cancel this customer</A>
65
66 <% } %>
67
68 <%
69
70 print qq! | <A HREF="${p}misc/delete-customer.cgi?$custnum">!.
71       'Delete this customer</A>'
72   if $conf->exists('deletecustomers');
73
74 unless ( $conf->exists('disable_customer_referrals') ) {
75   print qq! | <A HREF="!, popurl(2),
76         qq!edit/cust_main.cgi?referral_custnum=$custnum">!,
77         qq!Refer a new customer</A>!;
78
79   print qq! | <A HREF="!, popurl(2),
80         qq!search/cust_main.cgi?referral_custnum=$custnum">!,
81         qq!View this customer's referrals</A>!;
82 }
83
84 print '<BR><BR>';
85
86 my $signupurl = $conf->config('signupurl');
87 if ( $signupurl ) {
88 print "This customer's signup URL: ".
89       "<a href=\"$signupurl?ref=$custnum\">$signupurl?ref=$custnum</a><BR><BR>";
90 }
91
92 %>
93
94 <A NAME="cust_main"></A>
95 <TABLE BORDER=0>
96 <TR>
97   <TD VALIGN="top">
98     <%= include('cust_main/contacts.html', $cust_main ) %>
99   </TD>
100   <TD VALIGN="top" STYLE="padding-left: 54px">
101     <%= include('cust_main/misc.html', $cust_main ) %>
102     <% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
103       <BR>
104       <%= include('cust_main/billing.html', $cust_main ) %>
105     <% } %>
106   </TD>
107 </TR>
108 </TABLE>
109
110 <%
111 if ( defined $cust_main->dbdef_table->column('comments')
112      && $cust_main->comments =~ /[^\s\n\r]/              ) {
113 %>
114 <BR>
115 Comments
116 <%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
117 <TR>
118   <TD BGCOLOR="#ffffff">
119     <PRE><%= encode_entities($cust_main->comments) %></PRE>
120   </TD>
121 </TR>
122 </TABLE></TABLE>
123 <% } %>
124
125 <% if ( $conf->config('ticket_system') ) { %>
126   <BR>
127   <%= include('cust_main/tickets.html', $cust_main ) %>
128 <% } %>
129
130 <BR><BR>
131 <%= include('cust_main/packages.html', $cust_main ) %>
132
133 <% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
134   <%= include('cust_main/payment_history.html', $cust_main ) %>
135 <% } %>
136
137 </BODY></HTML>
138