1 <% '',$cgi->redirect(popurl(2). "browse/cust_attachment.html?$browse_opts") %>
4 $cgi->param('action') =~ /^(Delete|Undelete|Purge) selected$/
5 or die "Illegal action";
8 my $browse_opts = join(';', map { $_.'='.$cgi->param($_) }
9 qw( orderby show_deleted )
13 unless $FS::CurrentUser::CurrentUser->access_right("$action attachment");
15 foreach my $attachnum (
16 map { /^attachnum(\d+)$/; $1; } grep /^attachnum\d+$/, $cgi->param
18 my $attach = qsearchs('cust_attachment', { 'attachnum' => $attachnum });
20 if ( $action eq 'Delete' and !$attach->disabled ) {
21 $attach->disabled(time);
22 $error = $attach->replace;
24 elsif ( $action eq 'Undelete' and $attach->disabled ) {
25 $attach->disabled('');
26 $error = $attach->replace;
28 elsif ( $action eq 'Purge' and $attach->disabled ) {
29 $error = $attach->delete;