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