X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FEmailJournal.pm;h=6dfed906d698f0563065a9b93a509f17595febcc;hb=a40f0c2f7523a7d6936ca483901c22dfe86358c9;hp=3bfc39b96a72bd718a3a8ba58622e54b57728ce1;hpb=47e66090a3082ad029dd99a19b9c3c8624ab7092;p=kivitendo-erp.git diff --git a/SL/Controller/EmailJournal.pm b/SL/Controller/EmailJournal.pm index 3bfc39b96..6dfed906d 100644 --- a/SL/Controller/EmailJournal.pm +++ b/SL/Controller/EmailJournal.pm @@ -43,7 +43,7 @@ sub action_show { $self->entry(SL::DB::EmailJournal->new(id => $::form->{id})->load); - if (!$self->can_view_all && ($self->entry->sender_id != SL::DB::Manager::Emplyee->current->id)) { + if (!$self->can_view_all && ($self->entry->sender_id != SL::DB::Manager::Employee->current->id)) { $::form->error(t8('You do not have permission to access this entry.')); } @@ -57,11 +57,15 @@ sub action_download_attachment { my $attachment = SL::DB::EmailJournalAttachment->new(id => $::form->{id})->load; - if (!$self->can_view_all && ($attachment->email_journal->sender_id != SL::DB::Manager::Emplyee->current->id)) { + if (!$self->can_view_all && ($attachment->email_journal->sender_id != SL::DB::Manager::Employee->current->id)) { $::form->error(t8('You do not have permission to access this entry.')); } - - $self->send_file(\$attachment->content, name => $attachment->name, type => $attachment->mime_type); + my $ref = \$attachment->content; + if ( $attachment->file_id > 0 ) { + my $file = SL::File->get(id => $attachment->file_id ); + $ref = SL::File->get_content(dbfile => $file) if $file; + } + $self->send_file($ref, name => $attachment->name, type => $attachment->mime_type); } #