1 <% include('/elements/header.html', {
2 'title' => "Customer View: ". $cust_main->name,
8 <% include('/elements/menubar.html',
10 'selected' => $viewname{$view},
11 'url_base' => $cgi->url. "?custnum=$custnum;show=",
18 <% include('/elements/init_overlib.html') %>
20 <SCRIPT TYPE="text/javascript">
21 function areyousure(href, message) {
22 if (confirm(message) == true)
23 window.location.href = href;
27 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
29 % if ( $curuser->access_right('Edit customer') ) {
30 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> |
33 % if ( $curuser->access_right('Cancel customer')
34 % && $cust_main->ncancelled_pkgs
37 <% include( '/elements/popup_link-cust_main.html',
38 { 'action' => $p. 'misc/cancel_cust.html',
39 'label' => 'Cancel this customer',
40 'actionlabel' => 'Confirm Cancellation',
42 'cust_main' => $cust_main,
49 % if ( $conf->exists('deletecustomers')
50 % && $curuser->access_right('Delete customer')
52 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> |
55 % unless ( $conf->exists('disable_customer_referrals') ) {
56 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> |
57 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
62 % if ( $curuser->access_right('Billing event reports')
63 % || $curuser->access_right('View customer billing events')
66 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
71 %my $signupurl = $conf->config('signupurl');
73 This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
77 <A NAME="cust_main"></A>
81 <% include('cust_main/contacts.html', $cust_main ) %>
83 <TD VALIGN="top" STYLE="padding-left: 54px">
84 <% include('cust_main/misc.html', $cust_main ) %>
85 % if ( $conf->config('payby-default') ne 'HIDE' ) {
88 <% include('cust_main/billing.html', $cust_main ) %>
97 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
99 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
102 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
104 <TD BGCOLOR="#ffffff">
105 <PRE><% encode_entities($cust_main->comments) %></PRE>
112 % my $notecount = scalar($cust_main->notes());
113 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
115 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
116 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
119 % if ( $curuser->access_right('Add customer note') &&
120 % ! $conf->exists('cust_main-disable_notes')
123 <% include( '/elements/popup_link-cust_main.html',
124 'label' => 'Add customer note',
125 'action' => $p. 'edit/cust_main_note.cgi',
126 'actionlabel' => 'Enter customer note',
127 'cust_main' => $cust_main,
137 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
142 % if(! $conf->config('disable_cust_attachment')
143 % and $curuser->access_right('Add attachment')) {
144 <% include( '/elements/popup_link-cust_main.html',
145 'label' => 'Attach file',
146 'action' => $p.'edit/cust_main_attach.cgi',
147 'actionlabel' => 'Upload file',
148 'cust_main' => $cust_main,
154 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
159 % if ( $view eq 'jumbo' ) {
161 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A><BR>
164 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
166 % if ( $conf->config('ticket_system') ) {
167 <% include('cust_main/tickets.html', $cust_main ) %>
173 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
175 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
178 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
180 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
181 <% include('cust_main/packages.html', $cust_main ) %>
186 % if ( $view eq 'jumbo' ) {
188 <A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
191 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
193 % if ( $conf->config('payby-default') ne 'HIDE' ) {
194 <% include('cust_main/payment_history.html', $cust_main ) %>
199 <% include('/elements/footer.html') %>
202 my $curuser = $FS::CurrentUser::CurrentUser;
205 unless $curuser->access_right('View customer');
207 my $conf = new FS::Conf;
210 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
213 die "No customer specified (bad URL)!" unless $cgi->keywords;
214 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
219 my $cust_main = qsearchs( {
220 'table' => 'cust_main',
221 'hashref' => { 'custnum' => $custnum },
222 'extra_sql' => ' AND '. $curuser->agentnums_sql,
224 die "Customer not found!" unless $cust_main;
226 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
227 tie my %views, 'Tie::IxHash',
228 'Basics' => 'basics',
229 'Notes' => 'notes', #notes and files?
231 $views{'Tickets'} = 'tickets'
232 if $conf->config('ticket_system');
233 $views{'Packages'} = 'packages';
234 $views{'Payment History'} = 'payment_history'
235 unless $conf->config('payby-default' eq 'HIDE');
236 #$views{'Change History'} = '';
237 $views{'Jumbo'} = 'jumbo';
239 my %viewname = reverse %views;
241 my $view = $cgi->param('show') || $curuser->default_customer_view;