From: Moritz Bunkus Date: Tue, 28 Feb 2017 09:02:39 +0000 (+0100) Subject: Dateimanagement: DownloadZip: etwas aufgeräumt X-Git-Tag: release-3.5.4~1422 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=eb4bace4170b79c7308468a1ebe4d61cef3221a7;p=kivitendo-erp.git Dateimanagement: DownloadZip: etwas aufgeräumt --- diff --git a/SL/Controller/DownloadZip.pm b/SL/Controller/DownloadZip.pm index 92a03fcf7..33514c4a7 100644 --- a/SL/Controller/DownloadZip.pm +++ b/SL/Controller/DownloadZip.pm @@ -53,19 +53,10 @@ sub action_download_orderitems_files { my @files = SL::File->get_all(object_id => $item->parts_id, object_type => $element_type, ); - my @wanted_files; - ## also for filtering if needed: - # if ( $doctype ) { - # @wanted_files = grep { $_->{file_name} =~ /$doctype/ } @files; - # } else { - @wanted_files = @files; - # } - if ( scalar (@wanted_files) > 0 ) { - $zip->addDirectory($item->part->partnumber); - $zip->addFile($_->get_file, - Encode::encode($name_encoding,$item->part->partnumber.'/'.$_->db_file->file_name) - ) for @wanted_files; - } + next unless @files; + + $zip->addDirectory($item->part->partnumber); + $zip->addFile($_->get_file, Encode::encode($name_encoding, $item->part->partnumber . '/' . $_->db_file->file_name)) for @files; } } unless ( $zip->writeToFileNamed($sfile->file_name) == Archive::Zip::AZ_OK ) {