% my $notecount = scalar($cust_main->notes(0));
% if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
-% unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
-<P>
- <A NAME="cust_main_note"><FONT SIZE="+2"><% mt('Notes') |h %></FONT></A>
-</P>
-
-% }
-
-% if ( $curuser->access_right('Add customer note') &&
-% ! $conf->exists('cust_main-disable_notes')
-% ) {
-
- <& /elements/popup_link-cust_main.html,
- 'label' => emt('Add customer note'),
- 'action' => $p. 'edit/cust_main_note.cgi',
- 'actionlabel' => emt('Enter customer note'),
- 'cust_main' => $cust_main,
- 'width' => 616,
- 'height' => 538, #575
- &>
-
-% }
-<BR>
-
% # actually display notes
<& notes/notes.html, 'cust_main' => $cust_main &>
<BR>
% if( $curuser->access_right('View attachments') ) {
% # List attachments
<& notes/attachments.html, 'cust_main' => $cust_main &>
-% # "Attach file" link
-% if(! $conf->config('disable_cust_attachment')
-% and $curuser->access_right('Add attachment')) {
-<& /elements/popup_link-cust_main.html,
- 'label' => emt('Attach file'),
- 'action' => $p.'edit/cust_main_attach.cgi',
- 'actionlabel' => emt('Upload file'),
- 'cust_main' => $cust_main,
- 'width' => 480,
- 'height' => 296,
-&>
-% }
-
% if ($cgi->param('show_deleted')) {
<A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
($view ? ";show=$view" : '') . '#notes'
%>"><I>(<% mt('Show active attachments') |h %>)</I></A>
-% } elsif($curuser->access_right('View deleted attachments')) {
+% } elsif ( $curuser->access_right('View deleted attachments')
+% && FS::Record->scalar_sql(
+% 'SELECT 1 FROM cust_attachment WHERE custnum = ? '.
+% ' AND disabled IS NOT NULL AND disabled > 0 LIMIT 1',
+% $custnum )
+% )
+% {
<A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
($view ? ";show=$view" : '') . ';show_deleted=1#notes'
%>"><I>(<% mt('Show deleted attachments') |h %>)</I></A>
% if ( $curuser->access_right('View email logs')
% and FS::cust_msg->count("custnum = $custnum")) {
<BR>
-% if (!$cgi->param('order_by')) {
-% my $order_by = '_date';
-% $order_by .= ' DESC' if $curuser->option('history_order') eq 'newest';
-% $cgi->param('order_by', $order_by);
-% }
-<& /search/cust_msg.html,
- nohtmlheader => 1,
- html_init => mt('Mail sent to this customer: '),
-&>
+<& notes/email.html, 'cust_main' => $cust_main &>
+<BR>
% }
<%init>