1 <% include('/elements/header-popup.html', "$action File Attachment") %>
3 <% include('/elements/error.html') %>
5 <FORM NAME="attach_edit" ACTION="<% popurl(1) %>process/cust_main_attach.cgi" METHOD=POST ENCTYPE="multipart/form-data">
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
7 <INPUT TYPE="hidden" NAME="attachnum" VALUE="<% $attachnum %>">
11 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
12 % if(defined $attach) {
13 % if($curuser->access_right("Download attachment")) {
14 <A HREF="<% $p.'view/attachment.html?'.$attachnum %>">Download this file</A><BR>
16 <TR><TD> Filename </TD>
17 <TD><INPUT TYPE="text" NAME="filename" SIZE=40 MAXLENGTH=255 VALUE="<% $attach->filename %>"<% $disabled %>></TD></TR>
18 <TR><TD> Description </TD>
19 <TD><INPUT TYPE="text" NAME="title" SIZE=40 MAXLENGTH=80 VALUE="<% $attach->title %>"<% $disabled %></TD></TR>
20 <TR><TD> MIME type </TD>
21 <TD><INPUT TYPE="text" NAME="mime_type" VALUE="<% $attach->mime_type %>"<% $disabled %></TD></TR>
22 <TR><TD> Size </TD><TD><% $attach->size %></TD></TR>
24 % else { # !defined $attach
25 <TR><TD> Filename </TD><TD><INPUT TYPE="file" SIZE=24 NAME="file"></TD></TR>
26 <TR><TD> Description </TD><TD><INPUT TYPE="text" NAME="title" SIZE=40 MAXLENGTH=80></TD></TR>
31 <INPUT TYPE="submit" NAME="submit"
32 VALUE="<% $attachnum ? "Apply Changes" : "Upload File" %>">
34 % if(defined $attach and $curuser->access_right('Delete attachment')) {
36 <INPUT TYPE="submit" NAME="delete" value="Delete File"
37 onclick="return(confirm('Delete this file?'));">
46 my $curuser = $FS::CurrentUser::CurrentUser;
50 if ( $cgi->param('error') ) {
51 #$comment = $cgi->param('comment');
52 } elsif ( $cgi->param('attachnum') =~ /^(\d+)$/ ) {
54 die "illegal query ". $cgi->keywords unless $attachnum;
55 $attach = qsearchs('cust_attachment', { 'attachnum' => $attachnum });
56 die "no such attachment: ". $attachnum unless $attach;
59 my $action = $attachnum ? 'Edit' : 'Add';
62 if(! $curuser->access_right("$action attachment")) {
63 $disabled = ' disabled="disabled"';
66 $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum";