summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-11-13 09:22:02 -0800
committerIvan Kohler <ivan@freeside.biz>2016-11-13 09:22:02 -0800
commit60f03007647bdd937354846c83f33475abe1f150 (patch)
treebdc323558b0d6246bc9e3f791772a0f42ee82296
parent4a9bed3848f790e9113e14ee3cc16fcd54a151f2 (diff)
don't link to deleted attachments if there aren't any
-rwxr-xr-xhttemplate/view/cust_main/notes.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html
index 6250200..c02af38 100755
--- a/httemplate/view/cust_main/notes.html
+++ b/httemplate/view/cust_main/notes.html
@@ -30,7 +30,13 @@
<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>