import torrus 1.0.9
[freeside.git] / httemplate / edit / process / cust_main_attach.cgi
index 98f4d09..2911357 100644 (file)
@@ -25,8 +25,6 @@ $cgi->param('attachnum') =~ /^(\d*)$/
 my $attachnum = $1;
 
 my $curuser = $FS::CurrentUser::CurrentUser;
-my $otaker = $curuser->name;
-$otaker = $curuser->username if ($otaker eq "User, Legacy");
 
 my $delete = $cgi->param('delete');
 my $undelete = $cgi->param('undelete');
@@ -36,7 +34,7 @@ my $new = new FS::cust_attachment ( {
   attachnum => $attachnum,
   custnum   => $custnum,
   _date     => time,
-  otaker    => $otaker,
+  usernum   => $curuser->usernum,
   disabled  => '',
 });
 my $old;
@@ -53,6 +51,7 @@ if($attachnum) {
       ('_date', 'otaker', 'body', 'disabled');
     $new->filename($cgi->param('filename') || $old->filename);
     $new->mime_type($cgi->param('mime_type') || $old->mime_type);
+    $new->title($cgi->param('title'));
     if($delete and not $old->disabled) {
       $new->disabled(time);
     }
@@ -67,6 +66,7 @@ else { # This is a new attachment, so require a file.
   if($filename) {
     $new->filename($filename);
     $new->mime_type($cgi->uploadInfo($filename)->{'Content-Type'});
+    $new->title($cgi->param('title'));
     
     local $/;
     my $fh = $cgi->upload('file');