From a451fee68f9f8ddc5e8be3fb7ad67372870475c3 Mon Sep 17 00:00:00 2001 From: Givriz Date: Fri, 23 Apr 2021 18:01:11 +0200 Subject: [PATCH 1/7] Compatibility phpv8 --- htdocs/admin/mails.php | 12 +++++----- htdocs/admin/system/filecheck.php | 6 ++--- htdocs/admin/tools/dolibarr_export.php | 2 +- htdocs/admin/tools/listevents.php | 32 +++++++++++++------------- htdocs/core/lib/admin.lib.php | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 0252f149d10..6479306736c 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -48,7 +48,7 @@ $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__ID__' => 'RecipientIdRecord', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__CHECK_READ__' => (is_object($object) && !empty($object->thirdparty) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__LOGIN__' => 'RecipientLogin', '__LASTNAME__' => 'RecipientLastname', @@ -737,14 +737,14 @@ if ($action == 'edit') { print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print ''; - if (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') { + if (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'robot') { print $langs->trans('RobotEmail'); - } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { + } elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'user') { print $langs->trans('UserEmail'); - } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { + } elseif (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') === 'company') { print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); } else { - $id = preg_replace('/senderprofile_/', '', !empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : ''); + $id = preg_replace('/senderprofile_/', '', getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE')); if ($id > 0) { include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; $emailsenderprofile = new EmailSenderProfile($db); @@ -756,7 +756,7 @@ if ($action == 'edit') { // Errors To print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; - print ''.(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : ''); + print ''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) { print img_warning($langs->trans("ErrorBadEMail")); } diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 0f77b9d9d41..762a9a2ed28 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -53,8 +53,8 @@ print ''.$langs->trans("FileCheckDesc").'
print '
'; print ''; print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionLastInstall").''.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'
'.$langs->trans("VersionLastUpgrade").''.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'
'.$langs->trans("VersionProgram").''.DOL_VERSION; // If current version differs from last upgrade if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) { @@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') { } -if (!$error && $xml) { +if (empty($error) && !empty($xml)) { $checksumconcat = array(); $file_list = array(); $out = ''; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 0d4f60f3851..428c80676a2 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -157,7 +157,7 @@ $title = $langs->trans("BackupDumpWizard"); print load_fiche_titre($title); -print ''; +print '
'; print ''; print '
'; print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 935804ada10..76aa4cee121 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -234,7 +234,7 @@ $nbtotalofrecords = ''; $sql .= $db->plimit($conf->liste_limit + 1, $offset); //print $sql; $result = $db->query($sql); -if ($result) { +if (!empty($result)) { $num = $db->num_rows($result); $i = 0; @@ -245,55 +245,55 @@ if ($result) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } - if ($optioncss != '') { + if (!empty($optioncss) && $optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } - if ($search_code) { + if (!empty($search_code)) { $param .= '&search_code='.urlencode($search_code); } - if ($search_ip) { + if (!empty($search_ip)) { $param .= '&search_ip='.urlencode($search_ip); } - if ($search_user) { + if (!empty($search_user)) { $param .= '&search_user='.urlencode($search_user); } - if ($search_desc) { + if (!empty($search_desc)) { $param .= '&search_desc='.urlencode($search_desc); } - if ($search_ua) { + if (!empty($search_ua)) { $param .= '&search_ua='.urlencode($search_ua); } - if ($search_prefix_session) { + if (!empty($search_prefix_session)) { $param .= '&search_prefix_session='.urlencode($search_prefix_session); } - if ($date_startmonth) { + if (!empty($date_startmonth)) { $param .= "&date_startmonth=".urlencode($date_startmonth); } - if ($date_startday) { + if (!empty($date_startday)) { $param .= "&date_startday=".urlencode($date_startday); } - if ($date_startyear) { + if (!empty($date_startyear)) { $param .= "&date_startyear=".urlencode($date_startyear); } - if ($date_endmonth) { + if (!empty($date_endmonth)) { $param .= "&date_endmonth=".urlencode($date_endmonth); } - if ($date_endday) { + if (!empty($date_endday)) { $param .= "&date_endday=".urlencode($date_endday); } - if ($date_endyear) { + if (!empty($date_endyear)) { $param .= "&date_endyear=".urlencode($date_endyear); } $langs->load('withdrawals'); - if ($num) { + if (!empty($num)) { $center = ''.$langs->trans("Purge").''; } print '
'; print ''; - print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit); + print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, empty($center) ? '' : $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit); if ($action == 'purge') { $formquestion = array(); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 05ec254c7d7..4b2f0844241 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -906,7 +906,7 @@ function listOfSessions() if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session (preg_match('/dol_entity\|i:'.$conf->entity.';/i', $sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i', $sessValues)) && // limit to current entity - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i', $sessValues)) { // limit to company name + preg_match('/dol_company\|s:([0-9]+):"('.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').')"/i', $sessValues)) { // limit to company name $tmp = explode('_', $file); $idsess = $tmp[1]; $regs = array(); From 81d899947d9ded81203bccc48b44be500b3c796c Mon Sep 17 00:00:00 2001 From: Givriz Date: Wed, 12 May 2021 18:41:41 +0200 Subject: [PATCH 2/7] Update listevents.php --- htdocs/admin/tools/listevents.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 76aa4cee121..1190e156db4 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -248,22 +248,22 @@ if (!empty($result)) { if (!empty($optioncss) && $optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } - if (!empty($search_code)) { + if ($search_code) { $param .= '&search_code='.urlencode($search_code); } - if (!empty($search_ip)) { + if ($search_ip) { $param .= '&search_ip='.urlencode($search_ip); } - if (!empty($search_user)) { + if ($search_user) { $param .= '&search_user='.urlencode($search_user); } - if (!empty($search_desc)) { + if ($search_desc) { $param .= '&search_desc='.urlencode($search_desc); } - if (!empty($search_ua)) { + if ($search_ua) { $param .= '&search_ua='.urlencode($search_ua); } - if (!empty($search_prefix_session)) { + if ($search_prefix_session) { $param .= '&search_prefix_session='.urlencode($search_prefix_session); } if (!empty($date_startmonth)) { From 9bde70feba4a8e82f90e8c53c75967f4ce0d5bab Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 17 May 2021 16:08:48 +0200 Subject: [PATCH 3/7] Update user.class.php --- htdocs/user/class/user.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2752ee745a1..acbc89482b5 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2411,8 +2411,18 @@ class User extends CommonObject $label .= '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job); } $label .= '
'.$langs->trans("Email").': '.dol_string_nohtmltag($this->email); - if (!empty($this->phone)) { - $label .= '
'.$langs->trans("Phone").': '.dol_string_nohtmltag($this->phone); + if (!empty($this->office_phone) || !empty($this->office_fax) || !empty($this->fax)) { + $phonelist = array(); + if ($this->office_phone) { + $phonelist[] = dol_print_phone($this->office_phone, $this->country_code, $this->id, 0, '', ' ', 'phone'); + } + if ($this->office_fax) { + $phonelist[] = dol_print_phone($this->office_fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); + } + if ($this->user_mobile) { + $phonelist[] = dol_print_phone($this->user_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile'); + } + $label .= '
'.$langs->trans('Phone').': '.implode(' ', $phonelist); } if (!empty($this->admin)) { $label .= '
'.$langs->trans("Administrator").': '.yn($this->admin); From 68fe68b8444fcdd009d337aca7cc67f5a9ca5eb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 16:25:25 +0200 Subject: [PATCH 4/7] Update listevents.php --- htdocs/admin/tools/listevents.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 1190e156db4..824b287cce9 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -245,7 +245,7 @@ if (!empty($result)) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } - if (!empty($optioncss) && $optioncss != '') { + if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_code) { @@ -266,22 +266,22 @@ if (!empty($result)) { if ($search_prefix_session) { $param .= '&search_prefix_session='.urlencode($search_prefix_session); } - if (!empty($date_startmonth)) { + if ($date_startmonth) { $param .= "&date_startmonth=".urlencode($date_startmonth); } - if (!empty($date_startday)) { + if ($date_startday) { $param .= "&date_startday=".urlencode($date_startday); } - if (!empty($date_startyear)) { + if ($date_startyear) { $param .= "&date_startyear=".urlencode($date_startyear); } - if (!empty($date_endmonth)) { + if ($date_endmonth) { $param .= "&date_endmonth=".urlencode($date_endmonth); } - if (!empty($date_endday)) { + if ($date_endday) { $param .= "&date_endday=".urlencode($date_endday); } - if (!empty($date_endyear)) { + if ($date_endyear) { $param .= "&date_endyear=".urlencode($date_endyear); } From c8758c53d282a306aad3509ac10134da3505837d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 16:27:14 +0200 Subject: [PATCH 5/7] Update listevents.php --- htdocs/admin/tools/listevents.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 824b287cce9..ec824b380d6 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -42,7 +42,7 @@ if ($user->socid > 0) { } // Load translation files required by the page -$langs->loadLangs(array("companies", "admin", "users", "other")); +$langs->loadLangs(array("companies", "admin", "users", "other","withdrawals")); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -285,7 +285,7 @@ if (!empty($result)) { $param .= "&date_endyear=".urlencode($date_endyear); } - $langs->load('withdrawals'); + $center = ''; if (!empty($num)) { $center = ''.$langs->trans("Purge").''; } @@ -293,7 +293,7 @@ if (!empty($result)) { print ''; print ''; - print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, empty($center) ? '' : $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit); + print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit); if ($action == 'purge') { $formquestion = array(); From caf1c625a3c489367617b8e12637e479381423b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 16:28:19 +0200 Subject: [PATCH 6/7] Update listevents.php --- htdocs/admin/tools/listevents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index ec824b380d6..8d147ea1087 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -286,7 +286,7 @@ if (!empty($result)) { } $center = ''; - if (!empty($num)) { + if ($num) { $center = ''.$langs->trans("Purge").''; } From caea6f8d6ca9f81b985afce2a3bf8c48eed3ac10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 16:29:00 +0200 Subject: [PATCH 7/7] Update listevents.php --- htdocs/admin/tools/listevents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 8d147ea1087..fbc2412a9df 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -234,7 +234,7 @@ $nbtotalofrecords = ''; $sql .= $db->plimit($conf->liste_limit + 1, $offset); //print $sql; $result = $db->query($sql); -if (!empty($result)) { +if ($result) { $num = $db->num_rows($result); $i = 0;