]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Form.pm
Einkaufs-/Verkaufsrechnungen: Verwendung freier Fälligkeitsdaten gefixt
[mfinanz.git] / SL / Form.pm
index bfc8827eb3abd672374f6f3de04d38bd737b80c7..33e0fcbc2cf91e85a9415ed962fd795445569b5d 100644 (file)
@@ -1102,7 +1102,7 @@ sub parse_template {
 
   if ( !$self->{preview} && $ext_for_format eq 'pdf' && $::instance_conf->get_doc_storage) {
     $self->{attachment_filename} ||= $self->generate_attachment_filename;
-    $self->{print_file_id} = $self->store_pdf($self);
+    $self->{print_file_id} = $self->store_pdf($self)->id;
   }
   if ($self->{media} eq 'email') {
     if ( getcwd() eq $self->{"tmpdir"} ) {
@@ -1127,10 +1127,10 @@ sub parse_template {
 
 sub get_bcc_defaults {
   my ($self, $myconfig, $mybcc) = @_;
-#  if (SL::DB::Default->get->bcc_to_login) {
-#    $mybcc .= ", " if $mybcc;
-#    $mybcc .= $myconfig->{email};
-#  }
+  if (SL::DB::Default->get->bcc_to_login) {
+    $mybcc .= ", " if $mybcc;
+    $mybcc .= $myconfig->{email};
+  }
   my $otherbcc = SL::DB::Default->get->global_bcc;
   if ($otherbcc) {
     $mybcc .= ", " if $mybcc;
@@ -1212,10 +1212,11 @@ sub send_email {
       }
     }
     foreach my $attfile ( @attfiles ) {
-      push @{ $mail->{attachments} }, { path => SL::File->get_file_path(dbfile => $attfile),
-                                        id   => $attfile->id,
-                                        type => $attfile->file_mime_type,
-                                        name => $attfile->file_name };
+      push @{ $mail->{attachments} }, { path    => $attfile->get_file,
+                                        id      => $attfile->id,
+                                        type    => $attfile->mime_type,
+                                        name    => $attfile->file_name,
+                                        content => $attfile->get_content };
     }
   }
   $mail->{message}  =~ s/\r//g;
@@ -1223,6 +1224,10 @@ sub send_email {
   $self->{emailerr} = $mail->send();
   # $self->error($self->cleanup . "$err") if $self->{emailerr};
   $self->{email_journal_id} = $mail->{journalentry};
+  $self->{snumbers}  = "emailjournal" . "_" . $self->{email_journal_id};
+  $self->{what_done} = $::form->{type};
+  $self->{addition}  = "MAILED";
+  $self->save_history;
 
   #write back for message info and mail journal
   $self->{cc}  = $mail->{cc};
@@ -3177,7 +3182,10 @@ sub get_history {
     while(my $hash_ref = $sth->fetchrow_hashref()) {
       $hash_ref->{addition} = $main::locale->text($hash_ref->{addition});
       $hash_ref->{what_done} = $main::locale->text($hash_ref->{what_done});
-      $hash_ref->{snumbers} =~ s/^.+_(.*)$/$1/g;
+      my ( $what, $number ) = split /_/, $hash_ref->{snumbers};
+      $hash_ref->{snumbers} = $number;
+      $hash_ref->{haslink}  = 'controller.pl?action=EmailJournal/show&id='.$number if $what eq 'emailjournal';
+      $hash_ref->{snumbers} = $main::locale->text("E-Mail").' '.$number if $what eq 'emailjournal';
       $tempArray[$i++] = $hash_ref;
     }
     $main::lxdebug->leave_sub() and return \@tempArray