2
0
forked from Wavyzz/dolibarr

Merge pull request #25002 from Hystepik/develop#3

fix php 8.1 warnings with strict  mode
This commit is contained in:
Laurent Destailleur
2023-06-09 01:12:02 +02:00
committed by GitHub
7 changed files with 9 additions and 8 deletions

View File

@@ -1860,11 +1860,11 @@ class ActionComm extends CommonObject
$imgpicto = img_picto('', 'object_phoning', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type_code == 'AC_FAX') {
$imgpicto = img_picto('', 'object_phoning_fax', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || preg_match('/_SENTBYMAIL/', $this->code)) {
} elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || (!empty($this->code) && preg_match('/_SENTBYMAIL/', $this->code))) {
$imgpicto = img_picto('', 'object_email', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type_code == 'AC_INT') {
$imgpicto = img_picto('', 'object_intervention', $color, false, 0, 0, '', 'paddingright');
} elseif (preg_match('/^TICKET_MSG/', $this->code)) {
} elseif (!empty($this->code) && preg_match('/^TICKET_MSG/', $this->code)) {
$imgpicto = img_picto('', 'object_conversation', $color, false, 0, 0, '', 'paddingright');
} elseif ($this->type != 'systemauto') {
$imgpicto = img_picto('', 'user-cog', $color, false, 0, 0, '', 'paddingright');

View File

@@ -584,7 +584,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
// Local calendar
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
if ($user->rights->holiday->read) {
if ($user->hasRight("holiday", "read")) {
// Holiday calendar
$s .= '
<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
@@ -1011,7 +1011,7 @@ if ($showbirthday) {
}
}
if ($user->rights->holiday->read) {
if ($user->hasRight("holiday", "read")) {
// LEAVE-HOLIDAY CALENDAR
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";

View File

@@ -9757,7 +9757,7 @@ class Form
$nophoto = '/public/theme/common/nophoto.png';
$defaultimg = 'identicon'; // For gravatar
if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) { // For modules that need a special image when photo not found
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor')) !== false) {
if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor')) !== false) {
$nophoto = 'company';
} else {
$nophoto = '/public/theme/common/user_anonymous.png';

View File

@@ -6817,7 +6817,7 @@ function yn($yesno, $case = 1, $color = 0)
$result = 'unknown';
$classname = '';
if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0
if ($yesno == 1 || (isset($yesno) && (strtolower($yesno) == 'yes' || strtolower($yesno) == 'true'))) { // A mettre avant test sur no a cause du == 0
$result = $langs->trans('yes');
if ($case == 1 || $case == 3) {
$result = $langs->trans("Yes");

View File

@@ -54,6 +54,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
$permissiontoread = $user->admin;
$permissiontoadd = $user->admin; // Used by the include of actions_addupdatedelete.inc.php
$permissiontodelete = $user->admin;
$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check - Protection if external user

View File

@@ -78,7 +78,7 @@ if ($id > 0 || !empty($ref)) {
}
$permissiontoread = $user->admin;
$permissiontoadd = $user->rights->hrm->write; // Used by the include of actions_addupdatedelete.inc.php
$permissiontoadd = $user->hasRight('hrm', 'write'); // Used by the include of actions_addupdatedelete.inc.php
$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check - Protection if external user

View File

@@ -212,7 +212,7 @@ class FormResource
print '<option value="'.$id.'"';
}
// Si selected est text, on compare avec code, sinon avec id
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
if (!empty($selected) && preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
print ' selected';
} elseif ($selected == $id) {
print ' selected';