X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main_attach.cgi;h=0880c760ae5af1ecffdab18050c4477be78a3473;hb=f48ffc61601d08024aeff19ecd07d7420fc4e5b3;hp=7c9e407d96e603c0a53fadd88493a3f2842504b9;hpb=283ea2b5137ae3ec36882b492e6de024b0ce6027;p=freeside.git diff --git a/httemplate/edit/cust_main_attach.cgi b/httemplate/edit/cust_main_attach.cgi index 7c9e407d9..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) { "> - -% if(defined $attach) { + VALUE="<% $attachnum ? emt("Apply changes") : emt("Upload File") %>"> +% } +% if(defined $attach and $curuser->access_right('Delete attachment')) {
- + % }
@@ -35,24 +46,27 @@ 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 $FS::CurrentUser::CurrentUser->access_right("$action customer note"); +my $disabled=''; +if(! $curuser->access_right("$action attachment")) { + $disabled = ' disabled="disabled"'; +} + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1;