<% include('/elements/header-popup.html', "$action File Attachment") %> <% include('/elements/error.html') %>


<% include('/elements/table.html') %> % if(defined $attach) { % if($curuser->access_right("Download attachment")) { Download this file
% } Filename > Description MIME type Size <% $attach->size %> % } % else { # !defined $attach Filename Description % }
% if(! $disabled) { "> % } % if(defined $attach and $curuser->access_right('Delete attachment')) {
% }
<%init> my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" if !$curuser->access_right('View attachments'); my $attachnum = ''; my $attach; if ( $cgi->param('error') ) { #$comment = $cgi->param('comment'); } elsif ( $cgi->param('attachnum') =~ /^(\d+)$/ ) { $attachnum = $1; die "illegal query ". $cgi->keywords unless $attachnum; $attach = qsearchs('cust_attachment', { 'attachnum' => $attachnum }); die "no such attachment: ". $attachnum unless $attach; } my $action = $attachnum ? 'Edit' : 'Add'; my $disabled=''; if(! $curuser->access_right("$action attachment")) { $disabled = ' disabled="disabled"'; } $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; my $custnum = $1;