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