This commit was generated by cvs2svn to compensate for changes in r6255,
[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 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
8 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
9 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_draggable.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/iframecontentmws.js"></SCRIPT>
11
12 <SCRIPT TYPE="text/javascript">
13 function areyousure(href, message) {
14   if (confirm(message) == true)
15     window.location.href = href;
16 }
17 </SCRIPT>
18
19 % if ( $curuser->access_right('Cancel customer')
20 %        && $cust_main->ncancelled_pkgs
21 %      ) {
22
23   <% cust_cancel_link($cust_main) %> | 
24
25 % } 
26
27 % if ( $conf->exists('deletecustomers')
28 %        && $curuser->access_right('Delete customer')
29 %      ) {
30   <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> | 
31 % } 
32
33 % unless ( $conf->exists('disable_customer_referrals') ) { 
34   <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
35   <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
36 % } 
37
38 <BR><BR>
39
40 % if (    $curuser->access_right('Billing event reports') 
41 %      || $curuser->access_right('View customer billing events')
42 %    ) {
43
44   <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
45   <BR><BR>
46
47 % }
48
49 %my $signupurl = $conf->config('signupurl');
50 %if ( $signupurl ) {
51   This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
52 % } 
53
54
55 <A NAME="cust_main"></A>
56 <TABLE BORDER=0>
57 <TR>
58   <TD VALIGN="top">
59     <% include('cust_main/contacts.html', $cust_main ) %>
60   </TD>
61   <TD VALIGN="top" STYLE="padding-left: 54px">
62     <% include('cust_main/misc.html', $cust_main ) %>
63 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
64
65       <BR>
66       <% include('cust_main/billing.html', $cust_main ) %>
67 % } 
68
69   </TD>
70 </TR>
71 </TABLE>
72 %
73 %if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
74 %
75
76 <BR>
77 Comments
78 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
79 <TR>
80   <TD BGCOLOR="#ffffff">
81     <PRE><% encode_entities($cust_main->comments) %></PRE>
82   </TD>
83 </TR>
84 </TABLE></TABLE>
85 % } 
86 <BR><BR>
87 % my $notecount = scalar($cust_main->notes());
88 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
89
90 <A NAME="cust_main_note"><FONT SIZE="+2">Notes</FONT></A><BR>
91 %   if ( $curuser->access_right('Add customer note') &&
92 %        ! $conf->exists('cust_main-disable_notes')
93 %      ) {
94
95   <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_main_note.cgi?custnum=<% $cust_main->custnum %>', 616, 386, 'cust_main_note_popup' ), CAPTION, 'Enter customer note', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">Add customer note</A>
96
97 %   }
98
99 <BR>
100
101 %   if ($notecount) {
102
103 <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">
104   <div><br>[iframe not supported]<br><br></div>
105 </iframe>
106
107 %   }else{ # make firefox happy wrt POSTDATA
108
109 <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">
110   <div><br>[iframe not supported]<br><br></div>
111 </iframe>
112
113 %   }
114
115 % }
116
117
118 % if ( $conf->config('ticket_system') ) { 
119
120   <BR><BR>
121   <% include('cust_main/tickets.html', $cust_main ) %>
122 % } 
123
124
125 <BR><BR>
126
127 % #XXX enable me# if ( $curuser->access_right('View customer packages') { 
128 <% include('cust_main/packages.html', $cust_main ) %>
129 % #}
130
131 % if ( $conf->config('payby-default') ne 'HIDE' ) { 
132   <% include('cust_main/payment_history.html', $cust_main ) %>
133 % } 
134
135
136 <% include('/elements/footer.html') %>
137 <%init>
138
139 my $curuser = $FS::CurrentUser::CurrentUser;
140
141 die "access denied"
142   unless $curuser->access_right('View customer');
143
144 my $conf = new FS::Conf;
145
146 die "No customer specified (bad URL)!" unless $cgi->keywords;
147 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
148 $query =~ /^(\d+)$/;
149 my $custnum = $1;
150 my $cust_main = qsearchs( {
151   'table'     => 'cust_main',
152   'hashref'   => { 'custnum' => $custnum },
153   'extra_sql' => ' AND '. $curuser->agentnums_sql,
154 });
155 die "Customer not found!" unless $cust_main;
156
157 </%init>
158 <%once>
159
160
161 sub cust_cancel_link { cust_popup_link( 'misc/cancel_cust.html',
162                                         'Cancel&nbsp;this&nbsp;customer',
163                                         'Confirm Cancellation',
164                                         '#ff0000',
165                                         @_,
166                                       );
167 }
168
169 #false laziness w/view/cust_main/packages.html
170
171 sub cust_popup_link {
172   my($action, $label, $actionlabel, $color, $cust_main) = @_;
173   $action .= '?'. $cust_main->custnum;
174   popup_link($action, $label, $actionlabel, $color);
175 }
176
177 sub popup_link {
178   my($action, $label, $actionlabel, $color) = @_;
179   $color ||= '#333399';
180   qq!<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('$p$action', 540, 336, 'pkg_or_svc_action_popup' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '' ); return false;">$label</A>!;
181
182 # CLOSETEXT, '', 
183 #WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3,
184 #BGCOLOR, '#ff0000', CGCOLOR, '#ff0000'
185 }
186
187 </%once>