1 <% include('/elements/header.html', {
2 'title' => "Customer: ". $cust_main->name,
7 % my @part_tag = $cust_main->part_tag;
8 % if ( $conf->config('cust_tag-location') eq 'top' && @part_tag ) {
9 <TABLE STYLE="margin-bottom:8px" CELLSPACING=2>
10 % foreach my $part_tag ( @part_tag ) {
14 <% length($part_tag->tagcolor)
15 ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
17 %>><% $part_tag->tagname.': '. $part_tag->tagdesc |h %></FONT>
25 <% include('/elements/menubar.html',
27 'selected' => $viewname{$view},
28 'url_base' => $cgi->url. "?custnum=$custnum;show=",
35 <% include('/elements/init_overlib.html') %>
37 <SCRIPT TYPE="text/javascript">
38 function areyousure(href, message) {
39 if (confirm(message) == true)
40 window.location.href = href;
44 % if ( $view eq 'basics' || $view eq 'jumbo' ) {
46 % if ( $curuser->access_right('Edit customer') ) {
47 <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> |
50 % if ( $curuser->access_right('Cancel customer')
51 % && $cust_main->ncancelled_pkgs
54 <% include( '/elements/popup_link-cust_main.html',
55 { 'action' => $p. 'misc/cancel_cust.html',
56 'label' => 'Cancel this customer',
57 'actionlabel' => 'Confirm Cancellation',
59 'cust_main' => $cust_main,
60 'width' => 616, #make room for reasons
67 % if ( $conf->exists('deletecustomers')
68 % && $curuser->access_right('Delete customer')
70 <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> |
73 % unless ( $conf->exists('disable_customer_referrals') ) {
74 <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> |
75 <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
80 % if ( $curuser->access_right('Billing event reports')
81 % || $curuser->access_right('View customer billing events')
84 <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
89 %my $signupurl = $conf->config('signupurl');
91 This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
95 <A NAME="cust_main"></A>
99 <% include('cust_main/contacts.html', $cust_main ) %>
101 <TD VALIGN="top" STYLE="padding-left: 54px">
102 <% include('cust_main/misc.html', $cust_main ) %>
103 % if ( $conf->config('payby-default') ne 'HIDE' ) {
106 <% include('cust_main/billing.html', $cust_main ) %>
115 % if ( $view eq 'notes' || $view eq 'jumbo' ) {
117 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
120 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
122 <TD BGCOLOR="#ffffff">
123 <PRE><% encode_entities($cust_main->comments) %></PRE>
130 % my $notecount = scalar($cust_main->notes());
131 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
133 % unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
135 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
138 % if ( $curuser->access_right('Add customer note') &&
139 % ! $conf->exists('cust_main-disable_notes')
142 <% include( '/elements/popup_link-cust_main.html',
143 'label' => 'Add customer note',
144 'action' => $p. 'edit/cust_main_note.cgi',
145 'actionlabel' => 'Enter customer note',
146 'cust_main' => $cust_main,
148 'height' => 538, #575
156 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
161 % if(! $conf->config('disable_cust_attachment')
162 % and $curuser->access_right('Add attachment')) {
163 <% include( '/elements/popup_link-cust_main.html',
164 'label' => 'Attach file',
165 'action' => $p.'edit/cust_main_attach.cgi',
166 'actionlabel' => 'Upload file',
167 'cust_main' => $cust_main,
173 % if( $curuser->access_right('View attachments') ) {
174 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
175 % if ($cgi->param('show_deleted')) {
176 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
177 ($view ? ";show=$view" : '') . '#notes'
178 %>"><I>(Show active attachments)</I></A>
180 % elsif($curuser->access_right('View deleted attachments')) {
181 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
182 ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
183 %>"><I>(Show deleted attachments)</I></A>
190 % if ( $view eq 'jumbo' ) {
192 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A><BR>
195 % if ( $view eq 'tickets' || $view eq 'jumbo' ) {
197 % if ( $conf->config('ticket_system') ) {
198 <% include('cust_main/tickets.html', $cust_main ) %>
204 % if ( $view eq 'jumbo' ) { #XXX enable me && $curuser->access_right('View customer packages') {
206 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
209 % if ( $view eq 'packages' || $view eq 'jumbo' ) {
211 % #XXX enable me# if ( $curuser->access_right('View customer packages') {
212 <% include('cust_main/packages.html', $cust_main ) %>
217 % if ( $view eq 'jumbo' ) {
219 <A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR>
222 % if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
224 % if ( $conf->config('payby-default') ne 'HIDE' ) {
225 <% include('cust_main/payment_history.html', $cust_main ) %>
230 % if ( $view eq 'change_history' ) { # || $view eq 'jumbo'
231 <% include('cust_main/change_history.html', $cust_main ) %>
234 <% include('/elements/footer.html') %>
237 my $curuser = $FS::CurrentUser::CurrentUser;
240 unless $curuser->access_right('View customer');
242 my $conf = new FS::Conf;
245 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
248 die "No customer specified (bad URL)!" unless $cgi->keywords;
249 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
254 my $cust_main = qsearchs( {
255 'table' => 'cust_main',
256 'hashref' => { 'custnum' => $custnum },
257 'extra_sql' => ' AND '. $curuser->agentnums_sql,
259 die "Customer not found!" unless $cust_main;
261 #false laziness w/pref/pref.html and Conf.pm (cust_main-default_view)
262 tie my %views, 'Tie::IxHash',
263 'Basics' => 'basics',
264 'Notes' => 'notes', #notes and files?
266 $views{'Tickets'} = 'tickets'
267 if $conf->config('ticket_system');
268 $views{'Packages'} = 'packages';
269 $views{'Payment History'} = 'payment_history'
270 unless $conf->config('payby-default' eq 'HIDE');
271 $views{'Change History'} = 'change_history'
272 if $curuser->access_right('View customer history');
273 $views{'Jumbo'} = 'jumbo';
275 my %viewname = reverse %views;
277 my $view = $cgi->param('show') || $curuser->default_customer_view;