X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main_attach.cgi;h=0880c760ae5af1ecffdab18050c4477be78a3473;hp=43d2e292816d29d49317f3cbf063f44907cfc1f7;hb=c49cfd25a8f92c7a2f44b51d72506a21f6b8d09f;hpb=84c255838ffdeea5df83556b417bda29d8c71331 diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi index 43d2e2928..0880c760a 100755 --- a/httemplate/edit/cust_main_attach.cgi +++ b/httemplate/edit/cust_main_attach.cgi @@ -2,31 +2,42 @@ <% include('/elements/error.html') %> -
+ -

- % if(defined $attach) { -Filename
-MIME type -Size: <% $attach->size %>
+% if($curuser->access_right("Download attachment")) { +Download this file
+% } +% } +
+ + +% if ( defined $attach ) { + + + + + + + % } % else { # !defined $attach - -Filename
- + + % } - +
Filename >
Description
MIME type
Size <% $attach->size %>
Filename
Description

+% if(! $disabled) { "> - + VALUE="<% $attachnum ? emt("Apply changes") : emt("Upload File") %>"> +% } % if(defined $attach and $curuser->access_right('Delete attachment')) {
- + % }
@@ -36,24 +47,26 @@ Filename
<%init> my $curuser = $FS::CurrentUser::CurrentUser; + my $attachnum = ''; my $attach; -if ( $cgi->param('error') ) { - #$comment = $cgi->param('comment'); -} elsif ( $cgi->param('attachnum') =~ /^(\d+)$/ ) { + +if ( $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; } -$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; -my $custnum = $1; - my $action = $attachnum ? 'Edit' : 'Add'; -die "access denied" - unless $curuser->access_right("$action attachment"); +my $disabled=''; +if(! $curuser->access_right("$action attachment")) { + $disabled = ' disabled="disabled"'; +} + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1;