fix php 8.1 warnings

This commit is contained in:
hystepik 2022-11-25 15:48:52 +01:00
parent efc1697c62
commit 68fc388047
5 changed files with 9 additions and 7 deletions

View File

@ -4978,7 +4978,7 @@ abstract class CommonObject
// Line in view mode
if ($action != 'editline' || $selected != $line->id) {
// Product
if ($line->fk_product > 0) {
if (!empty($line->fk_product) && $line->fk_product > 0) {
$product_static = new Product($this->db);
$product_static->fetch($line->fk_product);
@ -8410,6 +8410,8 @@ abstract class CommonObject
$element = 'facture';
} elseif ($element == 'invoice_supplier_rec') {
return $user->rights->fournisseur->facture;
} elseif ($element == 'evaluation') {
return $user->rights->hrm->evaluation;
}
return $user->rights->{$element};

View File

@ -383,10 +383,10 @@ class Evaluationline extends CommonObject
foreach ($filter as $key => $value) {
if ($key == 't.rowid') {
$sqlwhere[] = $key.'='.$value;
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
} else {

View File

@ -85,7 +85,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
$upload_dir = $conf->hrm->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions
@ -210,7 +210,7 @@ if ($object->id > 0) {
print '</div>';
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$param = '&id='.$object->id.'&socid='.$socid;
$param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}

View File

@ -51,7 +51,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'evaluationcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$lineid = GETPOST('lineid', 'int');
// Initialize technical objects
$object = new Evaluation($db);

View File

@ -56,7 +56,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
$upload_dir = $conf->hrm->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions