[freeside-commits] freeside/httemplate/misc cust_attachment.cgi, NONE, 1.1

Mark Wells mark at wavetail.420.am
Wed Nov 18 01:09:36 PST 2009


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

Added Files:
	cust_attachment.cgi 
Log Message:
cust_attachment improvement, RT#4964 and #6225

--- NEW FILE: cust_attachment.cgi ---
<% '',$cgi->redirect(popurl(2). "browse/cust_attachment.html?$browse_opts") %>
<%init>

$cgi->param('action') =~ /^(Delete|Undelete|Purge) selected$/
  or die "Illegal action";
my $action = $1;

my $browse_opts = join(';', map { $_.'='.$cgi->param($_) } 
    qw( orderby show_deleted )
    );

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right("$action attachment");

foreach my $attachnum (
    map { /^attachnum(\d+)$/; $1; } grep /^attachnum\d+$/, $cgi->param
  ) {
  my $attach = qsearchs('cust_attachment', { 'attachnum' => $attachnum });
  my $error;
  if ( $action eq 'Delete' and !$attach->disabled ) {
    $attach->disabled(time);
    $error = $attach->replace;
  }
  elsif ( $action eq 'Undelete' and $attach->disabled ) {
    $attach->disabled('');
    $error = $attach->replace;
  }
  elsif ( $action eq 'Purge' and $attach->disabled ) {
    $error = $attach->delete;
  }
  die $error if $error;
}

</%init>



More information about the freeside-commits mailing list