signup.cgi fix for hidden agentnum tags with trailling "/ >"
[freeside.git] / httemplate / view / cust_main.cgi
1 <% include("/elements/header.html","Customer View: ". $cust_main->name ) %>
2
3 % if ( $curuser->access_right('Edit customer') ) { 
4   <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> | 
5 % } 
6
7 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
8 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
9 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_draggable.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/iframecontentmws.js"></SCRIPT>
11
12 <SCRIPT TYPE="text/javascript">
13 function areyousure(href, message) {
14   if (confirm(message) == true)
15     window.location.href = href;
16 }
17 </SCRIPT>
18
19 <SCRIPT TYPE="text/javascript">
20 %
21 %my $ban = '';
22 %if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
23 %  $ban = '<BR><P ALIGN="center">'.
24 %         '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\\\'s ';
25 %  if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
26 %    $ban .= 'credit card';
27 %  } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
28 %    $ban .= 'ACH account';
29 %  }
30 %}
31 %
32
33
34 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> ';
35
36 </SCRIPT>
37 % if ( $curuser->access_right('Cancel customer')
38 %        && $cust_main->ncancelled_pkgs
39 %      ) {
40
41   <% include( '/elements/popup_link-cust_main.html',
42               { 'action'      => $p. 'misc/cancel_cust.html',
43                 'label'       => 'Cancel&nbsp;this&nbsp;customer',
44                 'actionlabel' => 'Confirm Cancellation',
45                 'color'       => '#ff0000',
46                 'cust_main'   => $cust_main,
47               }
48             )
49   %> | 
50
51 % } 
52 % if ( $conf->exists('deletecustomers')
53 %        && $curuser->access_right('Delete customer')
54 %      ) {
55 %
56
57   <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> | 
58 % } 
59 % unless ( $conf->exists('disable_customer_referrals') ) { 
60
61   <A HREF="<% popurl(2) %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
62   <A HREF="<% popurl(2) %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
63 % } 
64
65
66
67 <BR><BR>
68 %
69 %my $signupurl = $conf->config('signupurl');
70 %if ( $signupurl ) {
71 %
72
73   This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
74 % } 
75
76
77 <A NAME="cust_main"></A>
78 <TABLE BORDER=0>
79 <TR>
80   <TD VALIGN="top">
81     <% include('cust_main/contacts.html', $cust_main ) %>
82   </TD>
83   <TD VALIGN="top" STYLE="padding-left: 54px">
84     <% include('cust_main/misc.html', $cust_main ) %>
85 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
86
87       <BR>
88       <% include('cust_main/billing.html', $cust_main ) %>
89 % } 
90
91   </TD>
92 </TR>
93 </TABLE>
94 %
95 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
96 %
97
98 <BR>
99 Comments
100 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
101 <TR>
102   <TD BGCOLOR="#ffffff">
103     <PRE><% encode_entities($cust_main->comments) %></PRE>
104   </TD>
105 </TR>
106 </TABLE></TABLE>
107 % } 
108 <BR><BR>
109 % my $notecount = scalar($cust_main->notes());
110 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
111
112 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
113 %   if ( $curuser->access_right('Add customer note') &&
114 %        ! $conf->exists('cust_main-disable_notes')
115 %      ) {
116
117   <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_main_note.cgi?custnum=<% $cust_main->custnum %>', 616, 386, 'cust_main_note_popup' ), CAPTION, 'Enter customer note', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">Add customer note</A>
118
119 %   }
120
121 <BR>
122
123 %   if ($notecount) {
124
125 <iframe src="<% $p %>view/cust_main/notes.html?custnum=<% $cust_main->custnum %>" height="186" width="616" name="cust_main_notes" frameborder="0" marginborder="0" marginheight="0" scrolling="auto">
126   <div><br>[iframe not supported]<br><br></div>
127 </iframe>
128
129 %   }else{ # make firefox happy wrt POSTDATA
130
131 <iframe src="<% $p %>view/cust_main/notes.html?custnum=<% $cust_main->custnum %>" height="24" width="616" name="cust_main_notes" frameborder="0" marginborder="0" marginheight="0" scrolling="auto">
132   <div><br>[iframe not supported]<br><br></div>
133 </iframe>
134
135 %   }
136
137 % }
138
139
140 % if ( $conf->config('ticket_system') ) { 
141
142   <BR><BR>
143   <% include('cust_main/tickets.html', $cust_main ) %>
144 % } 
145
146
147 <BR><BR>
148
149 % #XXX enable me# if ( $curuser->access_right('View customer packages') { 
150 <% include('cust_main/packages.html', $cust_main ) %>
151 % #}
152
153 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
154   <% include('cust_main/payment_history.html', $cust_main ) %>
155 % } 
156
157
158 <% include('/elements/footer.html') %>
159 <%init>
160
161 my $curuser = $FS::CurrentUser::CurrentUser;
162
163 die "access denied"
164   unless $curuser->access_right('View customer');
165
166 my $conf = new FS::Conf;
167
168 die "No customer specified (bad URL)!" unless $cgi->keywords;
169 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
170 $query =~ /^(\d+)$/;
171 my $custnum = $1;
172 my $cust_main = qsearchs({
173   'table'     => 'cust_main',
174   'hashref'   => {'custnum'=>$custnum},
175   'extra_sql' => ' AND '. $curuser->agentnums_sql,
176 });
177 die "Customer not found!" unless $cust_main;
178
179 </%init>