From 0c5a934e10cae5c953e5aa81350a3d7b9e4eb85d Mon Sep 17 00:00:00 2001 From: Givriz Date: Thu, 20 May 2021 17:40:44 +0200 Subject: [PATCH 1/3] Compatibility phpv8 --- htdocs/admin/mails.php | 6 +++--- htdocs/admin/system/security.php | 4 ++-- htdocs/core/boxes/box_dolibarr_state_board.php | 2 +- htdocs/core/class/html.formfile.class.php | 4 ++-- htdocs/projet/class/task.class.php | 2 +- htdocs/user/card.php | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 2d3133c9fce..e86c78763ee 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -302,7 +302,7 @@ if ($action == 'edit') { // Disable print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''; - print $form->selectyesno('MAIN_DISABLE_ALL_MAILS', $conf->global->MAIN_DISABLE_ALL_MAILS, 1); + print $form->selectyesno('MAIN_DISABLE_ALL_MAILS', getDolGlobalString('MAIN_DISABLE_ALL_MAILS'), 1); print ''; // Force e-mail recipient @@ -514,7 +514,7 @@ if ($action == 'edit') { $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')'; print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; - print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0); + print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'), 0); print ''; // From @@ -529,7 +529,7 @@ if ($action == 'edit') { // Add user to select destinaries list print ''.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''; - print $form->selectyesno('MAIN_MAIL_ENABLED_USER_DEST_SELECT', $conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT, 1); + print $form->selectyesno('MAIN_MAIL_ENABLED_USER_DEST_SELECT', getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT'), 1); print ''; print ''; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 36f08309e02..89d3a3fe251 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -156,7 +156,7 @@ $arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/cus $fileswithwritepermission = array(); foreach ($arrayoffilesinroot as $fileinroot) { // Test permission on file - if ($fileinroot['perm'] & 0222) { + if (isset($fileinroot['perm']) && ($fileinroot['perm'] & 0222)) { $fileswithwritepermission[] = $fileinroot['relativename']; } } @@ -278,7 +278,7 @@ print '
'; print ''.$langs->trans("AntivirusEnabledOnUpload").': '; print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' '; -print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0); +print yn(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 1 : 0); if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { print '   - '.$conf->global->MAIN_ANTIVIRUS_COMMAND; if (defined('MAIN_ANTIVIRUS_COMMAND')) { diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 348ffeda4cd..21bf58b859f 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -266,7 +266,7 @@ class box_dolibarr_state_board extends ModeleBoxes $boxstatItem .= ''; $boxstatItem .= '
'; $boxstatItem .= '' . $text . '
'; - $boxstatItem .= '' . img_object("", $board->picto, 'class="inline-block"') . ' ' . ($board->nb[$val] ? $board->nb[$val] : 0) . ''; + $boxstatItem .= '' . img_object("", $board->picto, 'class="inline-block"') . ' ' . (!empty($board->nb[$val]) ? $board->nb[$val] : 0) . ''; $boxstatItem .= '
'; $boxstatItem .= '
'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 45429512046..0f046a08fd3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -726,7 +726,7 @@ class FormFile } // Language code (if multilang) - if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && !$forcenomultilang && (!empty($modellist) || $showempty)) { + if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && !empty($conf->global->MAIN_MULTILANGS) && !$forcenomultilang && (!empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($this->db); $defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); @@ -812,7 +812,7 @@ class FormFile completeFileArrayWithDatabaseInfo($file_list, $relativedir); //var_dump($sortfield.' - '.$sortorder); - if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) + if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name) $file_list = dol_sort_array($file_list, $sortfield, $sortorder); } } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 0b8e21f5afd..97586a41f41 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1986,7 +1986,7 @@ class Task extends CommonObject global $conf, $langs; // For external user, no check is done on company because readability is managed by public status of project and assignement. - //$socid=$user->socid; + $socid = $user->socid; $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index cb4e7350e0e..7c1cb1b3f7e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1557,7 +1557,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "\n"; // Accountancy code - if ($conf->accounting->enabled) { + if (!empty($conf->accounting->enabled)) { print ''.$langs->trans("AccountancyCode").''; print ''.$object->accountancy_code.''; } @@ -2445,7 +2445,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '
'; // Accountancy code - if ($conf->accounting->enabled) { + if (!empty($conf->accounting->enabled)) { print ""; print ''; print '
'.$langs->trans("AccountancyCode").''; @@ -2726,7 +2726,7 @@ if ($action == 'create' || $action == 'adduserldap') { $genallowed = $user->rights->user->user->lire; $delallowed = $user->rights->user->user->creer; - print $formfile->showdocuments('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); + print $formfile->showdocuments('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', empty($soc->default_lang) ? '' : $soc->default_lang); $somethingshown = $formfile->numoffiles; // Show links to link elements From 9d6e93fd0132c31241daab8557f47247ce80d50e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 May 2021 19:50:53 +0200 Subject: [PATCH 2/3] Update security.php --- htdocs/admin/system/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 89d3a3fe251..cb28b20195d 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -278,7 +278,7 @@ print '
'; print ''.$langs->trans("AntivirusEnabledOnUpload").': '; print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' '; -print yn(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 1 : 0); +print yn(empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 0 : 1); if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { print '   - '.$conf->global->MAIN_ANTIVIRUS_COMMAND; if (defined('MAIN_ANTIVIRUS_COMMAND')) { From 3dfb22b05e3605f7a4a728711e1247524f32ee9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 May 2021 19:54:09 +0200 Subject: [PATCH 3/3] Update task.class.php --- htdocs/projet/class/task.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 97586a41f41..80333f3d9fb 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1986,7 +1986,8 @@ class Task extends CommonObject global $conf, $langs; // For external user, no check is done on company because readability is managed by public status of project and assignement. - $socid = $user->socid; + //$socid = $user->socid; + $socid = 0; $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); @@ -2007,10 +2008,7 @@ class Task extends CommonObject $sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; } // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser - //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if ($socid) { - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; - } + //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser // if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";