From cc5dcde9e184f2ecaf89b2ae608cc4004fb7c659 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Jan 2018 18:55:55 +0100 Subject: [PATCH] Fix protection to avoid errors --- htdocs/admin/company.php | 11 ++++------- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 1c6a0c00145..b2b7efc3a1c 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -262,17 +262,17 @@ if ($action == 'removelogo') require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; - dol_delete_file($logofile); + if ($mysoc->logo != '') dol_delete_file($logofile); dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity); $mysoc->logo=''; $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; - dol_delete_file($logosmallfile); + if ($mysoc->logo_small != '') dol_delete_file($logosmallfile); dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity); $mysoc->logo_small=''; $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini; - dol_delete_file($logominifile); + if ($mysoc->logo_mini != '') dol_delete_file($logominifile); dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity); $mysoc->logo_mini=''; } @@ -370,7 +370,6 @@ if ($action == 'edit' || $action == 'updateedit') print ''."\n"; // Web - print ''; print ''; print ''."\n"; @@ -384,8 +383,7 @@ if ($action == 'edit' || $action == 'updateedit') } // Logo - - print ''; + print ''; print ''; // Note - print ''; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0776a649fc8..96222974a13 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5395,7 +5395,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstant'); $substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT; } - if (empty($exclude) || ! in_array('mycompany', $exclude)) + if ((empty($exclude) || ! in_array('mycompany', $exclude)) && is_object($mysoc)) { $substitutionarray=array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name,
'; print ''; print ''; @@ -402,7 +400,6 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print '