clean up overlib usage for customer notes
[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               }
27             )
28   %> | 
29
30 % } 
31
32 % if ( $conf->exists('deletecustomers')
33 %        && $curuser->access_right('Delete customer')
34 %      ) {
35   <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> | 
36 % } 
37
38 % unless ( $conf->exists('disable_customer_referrals') ) { 
39   <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
40   <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
41 % } 
42
43 <BR><BR>
44
45 % if (    $curuser->access_right('Billing event reports') 
46 %      || $curuser->access_right('View customer billing events')
47 %    ) {
48
49   <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
50   <BR><BR>
51
52 % }
53
54 %my $signupurl = $conf->config('signupurl');
55 %if ( $signupurl ) {
56   This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
57 % } 
58
59
60 <A NAME="cust_main"></A>
61 <TABLE BORDER=0>
62 <TR>
63   <TD VALIGN="top">
64     <% include('cust_main/contacts.html', $cust_main ) %>
65   </TD>
66   <TD VALIGN="top" STYLE="padding-left: 54px">
67     <% include('cust_main/misc.html', $cust_main ) %>
68 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
69
70       <BR>
71       <% include('cust_main/billing.html', $cust_main ) %>
72 % } 
73
74   </TD>
75 </TR>
76 </TABLE>
77 %
78 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
79 %
80
81 <BR>
82 Comments
83 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
84 <TR>
85   <TD BGCOLOR="#ffffff">
86     <PRE><% encode_entities($cust_main->comments) %></PRE>
87   </TD>
88 </TR>
89 </TABLE></TABLE>
90 % } 
91 <BR><BR>
92 % my $notecount = scalar($cust_main->notes());
93 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
94
95 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
96 %   if ( $curuser->access_right('Add customer note') &&
97 %        ! $conf->exists('cust_main-disable_notes')
98 %      ) {
99
100   <% include( '/elements/popup_link-cust_main.html',
101                 'label'       => 'Add customer note',
102                 'action'      => $p. 'edit/cust_main_note.cgi',
103                 'actionlabel' => 'Enter customer note',
104                 'cust_main'   => $cust_main,
105                 'width'       => 616,
106                 'height'      => 408,
107             )
108   %>
109
110 %   }
111
112 <BR>
113
114 %   if ($notecount) {
115
116 <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">
117   <div><br>[iframe not supported]<br><br></div>
118 </iframe>
119
120 %   }else{ # make firefox happy wrt POSTDATA
121
122 <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">
123   <div><br>[iframe not supported]<br><br></div>
124 </iframe>
125
126 %   }
127
128 % }
129
130
131 % if ( $conf->config('ticket_system') ) { 
132
133   <BR><BR>
134   <% include('cust_main/tickets.html', $cust_main ) %>
135 % } 
136
137
138 <BR><BR>
139
140 % #XXX enable me# if ( $curuser->access_right('View customer packages') { 
141 <% include('cust_main/packages.html', $cust_main ) %>
142 % #}
143
144 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
145   <% include('cust_main/payment_history.html', $cust_main ) %>
146 % } 
147
148
149 <% include('/elements/footer.html') %>
150 <%init>
151
152 my $curuser = $FS::CurrentUser::CurrentUser;
153
154 die "access denied"
155   unless $curuser->access_right('View customer');
156
157 my $conf = new FS::Conf;
158
159 die "No customer specified (bad URL)!" unless $cgi->keywords;
160 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
161 $query =~ /^(\d+)$/;
162 my $custnum = $1;
163 my $cust_main = qsearchs( {
164   'table'     => 'cust_main',
165   'hashref'   => { 'custnum' => $custnum },
166   'extra_sql' => ' AND '. $curuser->agentnums_sql,
167 });
168 die "Customer not found!" unless $cust_main;
169
170 </%init>