+% #XXX enable me# if ( $curuser->access_right('View customer packages') {
+<% include('cust_main/packages.html', $cust_main ) %>
+% #}
+
+% if ( $conf->config('payby-default') ne 'HIDE' ) {
+ <% include('cust_main/payment_history.html', $cust_main ) %>
+% }
+
+
+<% include('/elements/footer.html') %>
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right('View customer');
+
+my $conf = new FS::Conf;
+
+die "No customer specified (bad URL)!" unless $cgi->keywords;
+my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
+$query =~ /^(\d+)$/;
+my $custnum = $1;
+my $cust_main = qsearchs( {
+ 'table' => 'cust_main',
+ 'hashref' => { 'custnum' => $custnum },
+ 'extra_sql' => ' AND '. $curuser->agentnums_sql,
+});
+die "Customer not found!" unless $cust_main;
+
+</%init>
+<%once>
+
+
+sub cust_cancel_link { cust_popup_link( 'misc/cancel_cust.html',
+ 'Cancel this customer',
+ 'Confirm Cancellation',
+ '#ff0000',
+ @_,
+ );
+}
+
+#false laziness w/view/cust_main/packages.html
+
+sub cust_popup_link {
+ my($action, $label, $actionlabel, $color, $cust_main) = @_;
+ $action .= '?'. $cust_main->custnum;
+ popup_link($action, $label, $actionlabel, $color);
+}
+
+sub popup_link {
+ my($action, $label, $actionlabel, $color) = @_;
+ $color ||= '#333399';
+ 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>!;
+
+# CLOSETEXT, '',
+#WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3,
+#BGCOLOR, '#ff0000', CGCOLOR, '#ff0000'
+}