Fix php warning
This commit is contained in:
parent
e32b7789e5
commit
f86939d332
@ -796,7 +796,7 @@ IMG;
|
||||
|
||||
|
||||
// Export to PDF using LibreOffice
|
||||
if ($conf->global->MAIN_ODT_AS_PDF == 'libreoffice') {
|
||||
if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') {
|
||||
dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable
|
||||
|
||||
// We delete and recreate a subdir because the soffice may have change pemrissions on it
|
||||
@ -808,7 +808,7 @@ IMG;
|
||||
// using linux/mac libreoffice that must be in path
|
||||
// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
|
||||
$command ='soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
|
||||
} elseif (preg_match('/unoconv/', $conf->global->MAIN_ODT_AS_PDF)) {
|
||||
} elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) {
|
||||
// If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87
|
||||
|
||||
// MAIN_ODT_AS_PDF should be "sudo -u unoconv /usr/bin/unoconv" and userunoconv must have sudo to be root by adding file /etc/sudoers.d/unoconv with content www-data ALL=(unoconv) NOPASSWD: /usr/bin/unoconv .
|
||||
@ -833,17 +833,17 @@ IMG;
|
||||
// - set shell of user to bash instead of nologin.
|
||||
// - set permission to read/write to user on home directory /var/www so user can create the libreoffice , dconf and .cache dir and files then set permission back
|
||||
|
||||
$command = $conf->global->MAIN_ODT_AS_PDF.' '.escapeshellcmd($name);
|
||||
$command = getDolGlobalString('MAIN_ODT_AS_PDF').' '.escapeshellcmd($name);
|
||||
//$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name);
|
||||
} else {
|
||||
// deprecated old method using odt2pdf.sh (native, jodconverter, ...)
|
||||
$tmpname=preg_replace('/\.odt/i', '', $name);
|
||||
|
||||
if (!empty($conf->global->MAIN_DOL_SCRIPTS_ROOT)) {
|
||||
$command = $conf->global->MAIN_DOL_SCRIPTS_ROOT.'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF);
|
||||
if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) {
|
||||
$command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
|
||||
} else {
|
||||
dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
|
||||
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF);
|
||||
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user