[freeside-commits] freeside/httemplate/view attachment.html, 1.1, 1.2 cust_main.cgi, 1.121, 1.122

Mark Wells mark at wavetail.420.am
Mon Aug 10 16:04:59 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/view
In directory wavetail.420.am:/tmp/cvs-serv15451/httemplate/view

Modified Files:
	attachment.html cust_main.cgi 
Log Message:
Improve handling of deleted attachments

Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main.cgi,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- cust_main.cgi	9 Aug 2009 09:05:37 -0000	1.121
+++ cust_main.cgi	10 Aug 2009 23:04:57 -0000	1.122
@@ -108,7 +108,7 @@
 </TABLE></TABLE>
 <BR><BR>
 % }
-
+<A NAME="notes">
 % my $notecount = scalar($cust_main->notes());
 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
 
@@ -152,6 +152,16 @@
 %>
 % }
 <% include('cust_main/attachments.html', 'custnum' => $cust_main->custnum ) %>
+% if($cgi->param('show_deleted')) {
+<A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
+           ($view ? ";show=$view" : '') . '#notes' 
+           %>"><I>(Show active attachments)</I></A>
+% }
+% elsif($curuser->access_right('View deleted attachments')) {
+<A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
+           ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
+           %>"><I>(Show deleted attachments)</I></A>
+% }
 <BR>
 
 % }

Index: attachment.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/attachment.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- attachment.html	9 Aug 2009 09:05:37 -0000	1.1
+++ attachment.html	10 Aug 2009 23:04:57 -0000	1.2
@@ -1,16 +1,16 @@
+<% $attach->body %>
 <%init>
 my ($query) = $cgi->keywords;
 $query =~ /^(\d+)$/;
 my $attachnum = $1 or die 'Invalid attachment number';
 $FS::CurrentUser::CurrentUser->access_right('Download attachment') or die 'access denied';
 
-my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die 'Attachment not found: $attachnum';
+my $attach = qsearchs('cust_attachment', { attachnum => $attachnum }) or die "Attachment not found: $attachnum";
+die 'access denied' if $attach->disabled;
 
 $m->clear_buffer;
 $r->content_type($attach->mime_type || 'text/plain');
 $r->headers_out->add('Content-Disposition' => 'attachment;filename=' . $attach->filename);
 
-binmode STDOUT;
-print STDOUT $attach->body;
 
 </%init>



More information about the freeside-commits mailing list