Revision 91751883
Von Jan Büren vor fast 5 Jahren hinzugefügt
bin/mozilla/datev.pl | ||
---|---|---|
27 | 27 |
#====================================================================== |
28 | 28 |
|
29 | 29 |
use POSIX qw(strftime getcwd); |
30 |
use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
|
|
30 |
use IO::Compress::Zip qw(zip $ZipError);
|
|
31 | 31 |
|
32 | 32 |
use SL::Common; |
33 | 33 |
use SL::DATEV qw(:CONSTANTS); |
... | ... | |
150 | 150 |
|
151 | 151 |
$::auth->assert('datev_export'); |
152 | 152 |
|
153 |
my $tmp_name = Common->tmpname(); |
|
154 | 153 |
my $zip_name = strftime("kivitendo-datev-export-%Y%m%d.zip", localtime(time())); |
155 | 154 |
|
156 | 155 |
my $cwd = getcwd(); |
... | ... | |
171 | 170 |
$form->error($locale->text("Your download does not exist anymore. Please re-run the DATEV export assistant.")); |
172 | 171 |
} |
173 | 172 |
|
174 |
my $zip = Archive::Zip->new(); |
|
175 |
map { $zip->addFile($_); } @filenames; |
|
176 |
$zip->writeToFileNamed($tmp_name); |
|
173 |
zip \@filenames => $zip_name or die "zip failed: $ZipError\n"; |
|
177 | 174 |
|
178 | 175 |
chdir($cwd); |
179 | 176 |
|
180 |
open(IN, $tmp_name) || die("open $tmp_name");
|
|
177 |
open(IN, $path . $zip_name) || die("open $path");
|
|
181 | 178 |
$::locale->with_raw_io(\*STDOUT, sub { |
182 | 179 |
print("Content-Type: application/zip\n"); |
183 | 180 |
print("Content-Disposition: attachment; filename=\"${zip_name}\"\n\n"); |
... | ... | |
187 | 184 |
}); |
188 | 185 |
close(IN); |
189 | 186 |
|
190 |
unlink($tmp_name); |
|
191 |
|
|
192 | 187 |
$main::lxdebug->leave_sub(); |
193 | 188 |
} |
194 | 189 |
|
Auch abrufbar als: Unified diff
DATEV- und GoBD-Export auf Compress::IO umgestellt