projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'rb-wiederkehrende-rechnungen' into after-262
[kivitendo-erp.git]
/
SL
/
Template
/
OpenDocument.pm
diff --git
a/SL/Template/OpenDocument.pm
b/SL/Template/OpenDocument.pm
index
98fba05
..
552bc2f
100644
(file)
--- a/
SL/Template/OpenDocument.pm
+++ b/
SL/Template/OpenDocument.pm
@@
-3,6
+3,7
@@
package SL::Template::OpenDocument;
use parent qw(SL::Template::Simple);
use Archive::Zip;
use parent qw(SL::Template::Simple);
use Archive::Zip;
+use Encode;
use POSIX 'setsid';
use SL::Iconv;
use POSIX 'setsid';
use SL::Iconv;
@@
-21,7
+22,7
@@
sub new {
my $self = $type->SUPER::new(@_);
$self->{"rnd"} = int(rand(1000000));
my $self = $type->SUPER::new(@_);
$self->{"rnd"} = int(rand(1000000));
- $self->{"iconv"} = SL::Iconv->new($
main::dbcharset
, "UTF-8");
+ $self->{"iconv"} = SL::Iconv->new($
::lx_office_conf{system}->{dbcharset}
, "UTF-8");
$self->set_tag_style('<%', '%>');
$self->{quot_re} = '"';
$self->set_tag_style('<%', '%>');
$self->{quot_re} = '"';
@@
-228,7
+229,7
@@
sub parse {
return 0;
}
return 0;
}
- my $contents =
$zip->contents("content.xml"
);
+ my $contents =
Encode::decode('utf-8-strict', $zip->contents("content.xml")
);
if (!$contents) {
$self->{"error"} = "File is not a OpenDocument file.";
$main::lxdebug->leave_sub();
if (!$contents) {
$self->{"error"} = "File is not a OpenDocument file.";
$main::lxdebug->leave_sub();
@@
-267,7
+268,7
@@
sub parse {
# $new_contents =~ s|>|>\n|g;
# $new_contents =~ s|>|>\n|g;
- $zip->contents("content.xml",
$new_contents
);
+ $zip->contents("content.xml",
Encode::encode('utf-8-strict', $new_contents)
);
my $styles = $zip->contents("styles.xml");
if ($contents) {
my $styles = $zip->contents("styles.xml");
if ($contents) {
@@
-381,7
+382,7
@@
sub spawn_xvfb {
my $pid = fork();
if (0 == $pid) {
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
my $pid = fork();
if (0 == $pid) {
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
- exec($
main::xvfb_bin
, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp");
+ exec($
::lx_office_conf{applications}->{xvfb}
, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp");
}
sleep(3);
$main::lxdebug->message(LXDebug->DEBUG2(), " parent dont sleeping\n");
}
sleep(3);
$main::lxdebug->message(LXDebug->DEBUG2(), " parent dont sleeping\n");
@@
-418,7
+419,8
@@
sub spawn_xvfb {
sub is_openoffice_running {
$main::lxdebug->enter_sub();
sub is_openoffice_running {
$main::lxdebug->enter_sub();
- my $output = `./scripts/oo-uno-test-conn.py $main::openofficeorg_daemon_port 2> /dev/null`;
+ my $cmd = "./scripts/oo-uno-test-conn.py " . $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . " 2> /dev/null";
+ my $output = `$cmd`;
chomp $output;
my $res = ($? == 0) || $output;
chomp $output;
my $res = ($? == 0) || $output;
@@
-456,11
+458,11
@@
sub spawn_openoffice {
exit if ($new_pid);
my $ssres = setsid();
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
exit if ($new_pid);
my $ssres = setsid();
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
- my @cmdline = ($
main::openofficeorg_writer_bin
,
+ my @cmdline = ($
::lx_office_conf{applications}->{openofficeorg_writer}
,
"-minimized", "-norestore", "-nologo", "-nolockcheck",
"-headless",
"-accept=socket,host=localhost,port=" .
"-minimized", "-norestore", "-nologo", "-nolockcheck",
"-headless",
"-accept=socket,host=localhost,port=" .
- $
main::openofficeorg_daemon_port
. ";urp;");
+ $
::lx_office_conf{print_templates}->{openofficeorg_daemon_port}
. ";urp;");
exec(@cmdline);
}
exec(@cmdline);
}
@@
-507,8
+509,8
@@
sub convert_to_pdf {
}
my @cmdline;
}
my @cmdline;
- if (!$
main::openofficeorg_daemon
) {
- @cmdline = ($
main::openofficeorg_writer_bin
,
+ if (!$
::lx_office_conf{print_templates}->{openofficeorg_daemon}
) {
+ @cmdline = ($
::lx_office_conf{applications}->{openofficeorg_writer}
,
"-minimized", "-norestore", "-nologo", "-nolockcheck",
"-headless",
"file:${filename}.odt",
"-minimized", "-norestore", "-nologo", "-nolockcheck",
"-headless",
"file:${filename}.odt",
@@
-521,7
+523,7
@@
sub convert_to_pdf {
}
@cmdline = ("./scripts/oo-uno-convert-pdf.py",
}
@cmdline = ("./scripts/oo-uno-convert-pdf.py",
- $
main::openofficeorg_daemon_port
,
+ $
::lx_office_conf{print_templates}->{openofficeorg_daemon_port}
,
"${filename}.odt");
}
"${filename}.odt");
}