1.7 has no per_agent config
[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 <% include('/elements/init_overlib.html') %>
8
9 <SCRIPT TYPE="text/javascript">
10 function areyousure(href, message) {
11   if (confirm(message) == true)
12     window.location.href = href;
13 }
14 </SCRIPT>
15
16 % if ( $curuser->access_right('Cancel customer')
17 %        && $cust_main->ncancelled_pkgs
18 %      ) {
19
20   <% include( '/elements/popup_link-cust_main.html',
21               { 'action'      => $p. 'misc/cancel_cust.html',
22                 'label'       => 'Cancel&nbsp;this&nbsp;customer',
23                 'actionlabel' => 'Confirm Cancellation',
24                 'color'       => '#ff0000',
25                 'cust_main'   => $cust_main,
26                 'width'       => 616, #make room for reasons
27               }
28             )
29   %> | 
30
31 % }
32
33 % if ( $conf->exists('deletecustomers')
34 %        && $curuser->access_right('Delete customer')
35 %      ) {
36   <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> | 
37 % } 
38
39 % unless ( $conf->exists('disable_customer_referrals') ) { 
40   <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
41   <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
42 % } 
43
44 <BR><BR>
45
46 %my $signupurl = $conf->config('signupurl');
47 %if ( $signupurl ) {
48   This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
49 % } 
50
51
52 <A NAME="cust_main"></A>
53 <TABLE BORDER=0>
54 <TR>
55   <TD VALIGN="top">
56     <% include('cust_main/contacts.html', $cust_main ) %>
57   </TD>
58   <TD VALIGN="top" STYLE="padding-left: 54px">
59     <% include('cust_main/misc.html', $cust_main ) %>
60 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
61
62       <BR>
63       <% include('cust_main/billing.html', $cust_main ) %>
64 % } 
65
66   </TD>
67 </TR>
68 </TABLE>
69 %
70 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
71 %
72
73 <BR>
74 Comments
75 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
76 <TR>
77   <TD BGCOLOR="#ffffff">
78     <PRE><% encode_entities($cust_main->comments) %></PRE>
79   </TD>
80 </TR>
81 </TABLE></TABLE>
82 % } 
83 <BR><BR>
84 % my $notecount = scalar($cust_main->notes());
85 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
86
87 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
88 %   if ( $curuser->access_right('Add customer note') &&
89 %        ! $conf->exists('cust_main-disable_notes')
90 %      ) {
91
92   <% include( '/elements/popup_link-cust_main.html',
93                 'label'       => 'Add customer note',
94                 'action'      => $p. 'edit/cust_main_note.cgi',
95                 'actionlabel' => 'Enter customer note',
96                 'cust_main'   => $cust_main,
97                 'width'       => 616,
98                 'height'      => 408,
99             )
100   %>
101
102 %   }
103
104 <BR>
105
106 <% include('cust_main/notes.html', 'custnum' => $cust_main->custnum ) %>
107
108 % }
109
110
111 % if ( $conf->config('ticket_system') ) { 
112
113   <BR><BR>
114   <% include('cust_main/tickets.html', $cust_main ) %>
115 % } 
116
117
118 <BR><BR>
119
120 % #XXX enable me# if ( $curuser->access_right('View customer packages') { 
121 <% include('cust_main/packages.html', $cust_main ) %>
122 % #}
123
124 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
125   <% include('cust_main/payment_history.html', $cust_main ) %>
126 % } 
127
128
129 <% include('/elements/footer.html') %>
130 <%init>
131
132 my $curuser = $FS::CurrentUser::CurrentUser;
133
134 die "access denied"
135   unless $curuser->access_right('View customer');
136
137 my $conf = new FS::Conf;
138
139 die "No customer specified (bad URL)!" unless $cgi->keywords;
140 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
141 $query =~ /^(\d+)$/;
142 my $custnum = $1;
143 my $cust_main = qsearchs( {
144   'table'     => 'cust_main',
145   'hashref'   => { 'custnum' => $custnum },
146   'extra_sql' => ' AND '. $curuser->agentnums_sql,
147 });
148 die "Customer not found!" unless $cust_main;
149
150 </%init>