From 68fa30565587806ab26440e7f4464bb629ee47eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Sep 2025 00:51:42 +0200 Subject: [PATCH 01/13] Better detection of duplicates --- dev/tools/apstats.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 289e3f4f38b..202b7c42d7e 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -357,7 +357,7 @@ foreach ($output_arrglpu as $valgitlog) { // The most recent lines are first. } if ($arrayofalerts[$alreadyfoundcommitid]['title'] != $tmpval['title']) { // Concat label of the new line to the already found one (if it differs) - $arrayofalerts[$alreadyfoundcommitid]['title'] .= ', '.$tmpval['title']; + $arrayofalerts[$alreadyfoundcommitid]['title'] .= ', '.preg_replace('/\.$/', '', $tmpval['title']); } $arrayofalerts[$alreadyfoundcommitid]['branch'] = array_merge($arrayofalerts[$alreadyfoundcommitid]['branch'], $tmpval['branch']); @@ -1137,7 +1137,7 @@ function cleanVal2($val) $tmpval['issueid'] = ''; $tmpval['issueidyogosha'] = ''; $tmpval['issueidcve'] = ''; - $tmpval['title'] = array_key_exists(5, $tmp) ? $tmp[5] : ''; + $tmpval['title'] = array_key_exists(5, $tmp) ? preg_replace('/\.$/', '', $tmp[5]) : ''; $tmpval['created_at'] = array_key_exists(0, $tmp) ? $tmp[0] : ''; $tmpval['updated_at'] = ''; From 21d28a745f9c84b73f0245e7820a911cfe9123d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Sep 2025 00:57:29 +0200 Subject: [PATCH 02/13] Fix warning --- htdocs/bookcal/calendar_card.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/bookcal/calendar_card.php b/htdocs/bookcal/calendar_card.php index 68c2e54a7ac..b343c86192f 100644 --- a/htdocs/bookcal/calendar_card.php +++ b/htdocs/bookcal/calendar_card.php @@ -26,13 +26,6 @@ // Load Dolibarr environment require '../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -41,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other")); @@ -322,7 +320,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; /* @@ -430,7 +428,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { - $object->formAddObjectLine(1, $mysoc, $soc); + $object->formAddObjectLine(1, $mysoc, $mysoc); } } } From 73073a5bf0202dd3afba83178e558e2301b8d3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Sep 2025 01:00:43 +0200 Subject: [PATCH 03/13] Knowledge tms (#35243) * clean code * clean code * clean code * clean code * clean code * clean code * clean code --- .../box_last_modified_knowledgerecord.php | 19 +++++++++++-------- htdocs/holiday/define_holiday.php | 4 ++-- .../class/knowledgerecord.class.php | 13 ++++++++----- .../knowledgerecord_card.php | 4 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php index c41d141d5e8..a160bf482c4 100644 --- a/htdocs/core/boxes/box_last_modified_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -1,9 +1,9 @@ - * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2018-2023 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2013-2016 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,8 +91,9 @@ class box_last_modified_knowledgerecord extends ModeleBoxes ); if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { - $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status'; + $sql = 'SELECT k.rowid as id, k.date_creation, GREATEST(k.tms, kef.tms) as date_modification, k.ref, k.lang, k.question, k.status as status'; $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord_extrafields as kef ON kef.fk_object = k.rowid"; $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")"; if ($user->socid) { @@ -101,7 +102,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes $sql .= " AND k.status > 0"; - $sql .= " ORDER BY k.tms DESC, k.rowid DESC "; + $sql .= " ORDER BY date_modification DESC, k.rowid DESC "; $sql .= $this->db->plimit($max, 0); $resql = $this->db->query($sql); @@ -114,10 +115,12 @@ class box_last_modified_knowledgerecord extends ModeleBoxes $objp = $this->db->fetch_object($resql); $datec = $this->db->jdate($objp->date_creation); + $datem = $this->db->jdate($objp->date_modification); $knowledgerecord = new KnowledgeRecord($this->db); $knowledgerecord->id = $objp->id; $knowledgerecord->date_creation = $objp->date_creation; + $knowledgerecord->date_modification = $objp->date_modification; $knowledgerecord->ref = $objp->ref; $knowledgerecord->status = $objp->status; $knowledgerecord->question = $objp->question; @@ -151,8 +154,8 @@ class box_last_modified_knowledgerecord extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( - 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', - 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'), + 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"', + 'text' => dol_print_date($datem, 'dayhour', 'tzuserrel'), ); $r++; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 0e41928f721..35933bed6d3 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -3,7 +3,7 @@ * Copyright (C) 2011 Dimitri Mouillard * Copyright (C) 2013 Marcos García * Copyright (C) 2016 Regis Houssin - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024-2025 MDW * @@ -530,7 +530,7 @@ if (count($typeleaves) == 0) { print ''."\n"; print ''; - print ''.img_picto($langs->trans('MenuLogCP'), 'list-alt').''; + print ''.img_picto($langs->trans('MenuLogCP'), 'list-alt').''; print ''; // Action column diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 0bd9a4d500d..ff4d3582079 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -159,10 +159,12 @@ class KnowledgeRecord extends CommonObject * @var string */ public $url; + /** - * @var int + * @var ?int */ public $status; + /** * @var string */ @@ -772,7 +774,7 @@ class KnowledgeRecord extends CommonObject $nofetch = !empty($params['nofetch']); $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; - if (isset($this->statut)) { + if (isset($this->status)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; @@ -965,9 +967,10 @@ class KnowledgeRecord extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; + $sql = 'SELECT t.rowid, t.date_creation as datec, GREATEST(t.tms, kef.tms) as datem,'; + $sql .= ' t.fk_user_creat, t.fk_user_modif'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element."_extrafields as kef ON kef.fk_object = t.rowid"; $sql .= ' WHERE t.rowid = '.((int) $id); $result = $this->db->query($sql); if ($result) { @@ -978,7 +981,7 @@ class KnowledgeRecord extends CommonObject $this->user_creation_id = $obj->fk_user_creat; $this->user_modification_id = $obj->fk_user_modif; - $this->date_creation = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); } diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index d7331dc767b..77278834407 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -496,7 +496,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { $langs->load("errors"); //print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0); - print ''.$langs->trans("Reply").''; + print ''.$langs->trans("Validate").''; } } From 1596fe56ae5d9138dcbaf86bc40013108ceec579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Sep 2025 01:01:24 +0200 Subject: [PATCH 04/13] fix warnings (#35244) * fix warnings * fix warnings --- htdocs/recruitment/recruitmentjobposition_agenda.php | 3 ++- htdocs/recruitment/recruitmentjobposition_document.php | 3 ++- htdocs/recruitment/recruitmentjobposition_note.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index e7510fc9017..6afaf565805 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -161,6 +161,7 @@ if ($object->id > 0) { */ // Project if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT."/core/class/html.formprojet.class.php"; $formproject = new FormProjets($db); $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index 4bfb32f9a89..664b399a1da 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -141,6 +141,7 @@ if ($object->id) { */ // Project if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT."/core/class/html.formprojet.class.php"; $formproject = new FormProjets($db); $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; diff --git a/htdocs/recruitment/recruitmentjobposition_note.php b/htdocs/recruitment/recruitmentjobposition_note.php index 6a6299e265f..69ceed60169 100644 --- a/htdocs/recruitment/recruitmentjobposition_note.php +++ b/htdocs/recruitment/recruitmentjobposition_note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -118,6 +118,7 @@ if ($id > 0 || !empty($ref)) { */ // Project if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT."/core/class/html.formprojet.class.php"; $formproject = new FormProjets($db); $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; From 140da6caa77a8ef0057175c8041e4a1cd3c85d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Sep 2025 01:03:48 +0200 Subject: [PATCH 05/13] fix CI (#35242) From 59afaf1d70954aff1f3d90a07c238036413031c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Sep 2025 01:04:57 +0200 Subject: [PATCH 06/13] clean code (#35211) * clean code * clean code * clean code * clean code * clean code * clean code * clean code * test * test * fix * fix * fix --------- Co-authored-by: Laurent Destailleur --- dev/build/phpstan/phpstan-baseline.neon | 72 -------------------- htdocs/hrm/class/job.class.php | 90 +++++-------------------- htdocs/hrm/job_card.php | 17 +---- 3 files changed, 19 insertions(+), 160 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 55cc1017260..97412e7a5fd 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -13230,78 +13230,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/admin/admin_hrm.php - - - message: '#^Call to function method_exists\(\) with \$this\(Job\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Job\) and ''description'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Call to function property_exists\(\) with Job and ''date_creation'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Call to function property_exists\(\) with Job and ''date_modification'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Call to function property_exists\(\) with Job and ''label'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Call to function property_exists\(\) with Job and ''ref'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Call to function property_exists\(\) with Job and ''status'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Left side of && is always false\.$#' - identifier: booleanAnd.leftAlwaysFalse - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Method Job\:\:fetchAll\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Method Job\:\:getLinesArray\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Method Job\:\:getSkillRankForJob\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/hrm/class/job.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Position\) and ''getNomUrl'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 2b7ea55844e..de2c922bfe5 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,23 +135,11 @@ class Job extends CommonObject // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - // /** - // * @var string Name of subtable line - // */ - // public $table_element_line = 'hrm_jobline'; - /** * @var string Field with ID of parent key if this object has a parent */ public $fk_element = 'fk_job'; - // /** - // * @var string Name of subtable class that manage subtable lines - // */ - // public $class_element_line = 'Jobline'; - /** * @var array List of child tables. To test if we can delete object. */ @@ -256,13 +244,6 @@ class Job extends CommonObject // Load source object $result = $object->fetchCommon($fromid); - if ($result > 0 && !empty($object->table_element_line)) { - $object->fetchLines(); - } - - // get lines so they will be clone - //foreach($this->lines as $line) - // $line->fetch_optionals(); // Reset some properties unset($object->id); @@ -270,30 +251,17 @@ class Job extends CommonObject unset($object->import_key); // Clear fields - if (property_exists($object, 'ref')) { - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; - } - if (property_exists($object, 'label')) { - // @phan-suppress-next-line PhanTypeInvalidDimOffset - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; - } - if (property_exists($object, 'status')) { - $object->status = self::STATUS_DRAFT; - } - if (property_exists($object, 'date_creation')) { - $object->date_creation = dol_now(); - } - if (property_exists($object, 'date_modification')) { - $object->date_modification = null; - } - // ... + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; + $object->label = $langs->trans("CopyOf")." ".$object->label; + $object->date_creation = dol_now(); + $object->date_modification = null; + // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) { - //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); } } @@ -345,9 +313,7 @@ class Job extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } + return $result; } @@ -375,7 +341,7 @@ class Job extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return Job[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -511,7 +477,7 @@ class Job extends CommonObject $this->db->begin(); // Define new ref - if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life + if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life $num = $this->getNextNumRef(); } else { $num = $this->ref; @@ -856,28 +822,8 @@ class Job extends CommonObject public function LibStatut($status, $mode = 0) { // phpcs:enable + return ''; // There is no status on job profile for the moment - - /* - if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - global $langs; - //$langs->load("hrm"); - $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); - $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); - } - - $statusType = 'status'.$status; - //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; - if ($status == self::STATUS_CANCELED) { - $statusType = 'status6'; - } - - return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); - */ } /** @@ -929,7 +875,7 @@ class Job extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return CommonObjectLine[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -984,6 +930,7 @@ class Job extends CommonObject if (class_exists($classname)) { $obj = new $classname(); '@phan-var-force ModeleNumRefEvaluation $obj'; + /** @var ModeleNumRefEvaluation $obj */ $numref = $obj->getNextValue($this); if ($numref != '' && $numref != '-1') { @@ -1019,7 +966,6 @@ class Job extends CommonObject global $conf, $langs; $result = 0; - $includedocgeneration = 0; $langs->load("hrm"); @@ -1035,7 +981,7 @@ class Job extends CommonObject $modelpath = "core/modules/hrm/doc/"; - if ($includedocgeneration && !empty($modele)) { + if (!empty($modele)) { $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } @@ -1061,7 +1007,7 @@ class Job extends CommonObject $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).''; + $return .= '' . $this->getNomUrl(0) . ''; if ($selected >= 0) { $return .= ''; } @@ -1069,9 +1015,9 @@ class Job extends CommonObject $return .= '
'.$langs->trans("Type").''; $return .= ' : '.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].''; }*/ - if (property_exists($this, 'description') && !(empty($this->description))) { + if (empty($this->description)) { //$return .= '
'.$langs->trans("Description").' : '; - $return .= '
'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).''; + $return .= '
' . dol_trunc($this->description, 25) . ''; } $return .= '
'; $return .= '
'; @@ -1082,7 +1028,7 @@ class Job extends CommonObject /** * function for get required skills associate to job object * @param int $id Id of object - * @return array|int list of ids skillranks + * @return int[]|int list of ids skillranks */ public function getSkillRankForJob($id) { @@ -1100,7 +1046,7 @@ class Job extends CommonObject $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $skillranks[] = $obj; + $skillranks[] = $obj->rowid; $i++; } $this->db->free($resql); diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index d661d37bd62..a10f46c5f34 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -195,7 +195,7 @@ if (empty($reshook)) { $i = 0; while ($i < count($skillRequire)) { $skillrank = new SkillRank($db); - $skillrank->createFromClone($user, $skillRequire[$i]->rowid, $id); + $skillrank->createFromClone($user, $skillRequire[$i], $id); $i++; } } @@ -232,21 +232,6 @@ $title = $langs->trans("Job"); $help_url = ''; llxHeader('', $title, $help_url); -// Example : Adding jquery code -// print ''; - // Part to create if ($action == 'create') { From 8beb61ef7fa87a9ab55b7b5ec8f8acadf096490c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Sep 2025 01:27:38 +0200 Subject: [PATCH 07/13] Set mysoc --- htdocs/api/class/api_access.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 4dbd6ac08f3..77c0257d359 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -190,6 +190,7 @@ class DolibarrApiAccess implements iAuthenticate $conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1; } // Set also the global variable $mysoc + global $mysoc; $mysoc = $fmysoc; // Reload langs From 2fbda7b4f4ba874a92a608b1cc9f697a27d921b9 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Sun, 7 Sep 2025 18:37:33 -0500 Subject: [PATCH 08/13] NEW line input multicurrency price with tax (#35064) * Multicurrency input price with tax * Multicurrency input price with tax * Multicurrency input price with tax - line tittle * Multicurrency input price with tax - line view * PriceUTTCCurrency in lang * Multicurrency input price with tax - line view * Multicurrency input price with tax - line edit * Update objectline_edit.tpl.php * Update objectline_view.tpl.php * Update objectline_edit.tpl.php * Update objectline_title.tpl.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/tpl/objectline_create.tpl.php | 11 +++++++++++ htdocs/core/tpl/objectline_edit.tpl.php | 10 ++++++++++ htdocs/core/tpl/objectline_title.tpl.php | 13 ++++++++++--- htdocs/core/tpl/objectline_view.tpl.php | 16 +++++++++++++++- htdocs/langs/en_US/main.lang | 1 + 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ef18bab7f6f..5ffe8e0b31d 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -13,6 +13,7 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2025 MDW + * Copyright (C) 2025 Lenin Rivas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -148,6 +149,9 @@ if ($nolinesbefore) { trans('PriceUTTC'); ?> + multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?> + trans('PriceUTTCCurrency', $this->multicurrency_code); ?> + trans('Qty'); ?> multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { + $coldisplay++; ?> + + "> + + diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index c4e536b5194..1308e8363c3 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -9,6 +9,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 Lenin Rivas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -276,6 +277,15 @@ $coldisplay++; } print '>'; } + + if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { + $coldisplay++; + $multicurrency_upinctax = $line->multicurrency_subprice_ttc ? $line->multicurrency_subprice_ttc : null; + if (!$multicurrency_upinctax) { + $multicurrency_upinctax = price2num($line->multicurrency_subprice * (1 + ($line->tva_tx / 100)), 'MU'); // One tax + } + print ''; + } ?> * Copyright (C) 2022 OpenDSI * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 Lenin Rivas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,16 +118,22 @@ if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_ } print ''; -// Price HT +// Price HT / excl tax print ''.$langs->trans('PriceUHT').''; -// Multicurrency +// Multicurrency HT / excl tax if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { print ''.$langs->trans('PriceUTTC').' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } +// Price TTC / incl tax if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { - print ''.$langs->trans('PriceUTTC').''; + print ''.$langs->trans('PriceUTTC').''; +} + +// Multicurrency TTC / incl tax +if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { + print ''.$langs->trans('PriceUTTCCurrency', $this->multicurrency_code).''; } // Qty diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index c07c0888b30..e32af87569d 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -10,6 +10,7 @@ * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 Lenin Rivas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -420,8 +421,21 @@ if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH } print(isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice)); ?> - +multicurrency_code != $conf->currency && !empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?> + pu_ttc_devise) ? $line->pu_ttc_devise : null; + if (!$multicurrency_upinctax) { + $multicurrency_upinctax = price2num($line->multicurrency_subprice * (1 + ($line->tva_tx / 100)), 'MU'); // one tax + } + if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES') && $line->multicurrency_total_ttc) { + $multicurrency_upinctax = price2num($line->multicurrency_total_ttc / (float) $line->qty, 'MU'); + } + print (isset($multicurrency_upinctax) ? price($sign * $multicurrency_upinctax) : price($sign * $line->multicurrency_subprice)); + ?> + info_bits & 2) != 2) && $line->special_code != 3) { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ecdc56c0d73..350e6ed5da9 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -391,6 +391,7 @@ PriceU=U.P. PriceUHT=U.P. (net) PriceUHTCurrency=U.P (net) (currency) PriceUTTC=U.P. (inc. tax) +PriceUTTCCurrency=U.P (inc. tax) (currency) Amount=Amount Amounts=Amounts AmountInvoice=Invoice amount From 148574fe4e64ecb0a2296d9d8ce05032d9f622ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Sep 2025 01:47:44 +0200 Subject: [PATCH 09/13] Fix CI --- htdocs/core/lib/usergroups.lib.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index a742c98d3d6..aafac090676 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -528,11 +528,11 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) // TopMenuDisableImages $listoftopmenumodes = array( - array('id' => 0, 'label' => $langs->transnoentitiesnoconv("IconAndText"), 'data-html' => $langs->transnoentitiesnoconv("IconAndText").' ('.$langs->trans("Default").')'), - array('id' => 1, 'label' => $langs->transnoentitiesnoconv("TextOnly"), 'data-html' => $langs->transnoentitiesnoconv("TextOnly")), - array('id' => 2, 'label' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"), 'data-html' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover")), - array('id' => 3, 'label' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover"), 'data-html' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover")), - array('id' => 4, 'label' => $langs->transnoentitiesnoconv("IconOnly"), 'data-html' => $langs->transnoentitiesnoconv("IconOnly")), + 0 => array('id' => 0, 'label' => $langs->transnoentitiesnoconv("IconAndText"), 'data-html' => $langs->transnoentitiesnoconv("IconAndText").' ('.$langs->trans("Default").')'), + 1 => array('id' => 1, 'label' => $langs->transnoentitiesnoconv("TextOnly"), 'data-html' => $langs->transnoentitiesnoconv("TextOnly")), + 2 => array('id' => 2, 'label' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"), 'data-html' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover")), + 3 => array('id' => 3, 'label' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover"), 'data-html' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover")), + 4 => array('id' => 4, 'label' => $langs->transnoentitiesnoconv("IconOnly"), 'data-html' => $langs->transnoentitiesnoconv("IconOnly")), ); if ($foruserprofile) { /* @@ -545,13 +545,11 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray(getDolGlobalString('THEME_TOPMENU_DISABLE_IMAGE'),array()),''),'THEME_TOPMENU_DISABLE_IMAGE','',1).' '; + print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE'), 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500'); } else { - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_TOPMENU_DISABLE_IMAGE,array()),''); - if ($color) print ''; - else print ''; + print $listoftopmenumodes[getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE')]['label']; } if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print '';*/ @@ -562,7 +560,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($edit) { print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE'), 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500'); } else { - print $listoftopmenumodes[getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE')]; + print $listoftopmenumodes[getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE')]['label']; } print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes")); print ''; From 0e1478206ad3d443842b1ec831f493647aa68f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Sep 2025 01:48:52 +0200 Subject: [PATCH 10/13] clean code (#35229) * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code --------- Co-authored-by: Laurent Destailleur --- dev/build/phpstan/phpstan-baseline.neon | 396 ------------------ .../accountancy/class/bookkeeping.class.php | 5 - htdocs/api/class/api_documents.class.php | 12 +- htdocs/asset/agenda.php | 4 +- htdocs/asset/depreciation.php | 2 +- htdocs/asset/disposal.php | 4 +- htdocs/asset/note.php | 2 +- htdocs/bom/bom_agenda.php | 4 +- htdocs/bom/bom_note.php | 4 +- htdocs/bom/lib/bom.lib.php | 2 +- htdocs/bookcal/class/calendar.class.php | 4 - htdocs/categories/photos.php | 4 +- .../action/class/actioncommreminder.class.php | 7 +- htdocs/comm/mailing/note.php | 7 +- htdocs/comm/propal/card.php | 6 +- htdocs/comm/propal/document.php | 6 +- htdocs/commande/card.php | 4 +- htdocs/commande/document.php | 6 +- htdocs/compta/facture/card.php | 4 +- .../facture/class/facture-rec.class.php | 5 - .../facture/class/paymentterm.class.php | 2 +- htdocs/compta/facture/document.php | 4 +- htdocs/contact/card.php | 2 +- htdocs/contact/document.php | 4 +- htdocs/contrat/card.php | 8 +- htdocs/contrat/class/contrat.class.php | 6 - htdocs/contrat/document.php | 4 +- htdocs/core/ajax/onlineSign.php | 8 +- htdocs/core/class/commondict.class.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/menubase.class.php | 2 +- htdocs/core/class/notify.class.php | 32 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/contract.lib.php | 3 +- htdocs/core/lib/files.lib.php | 6 +- htdocs/core/lib/functions.lib.php | 4 +- htdocs/core/lib/holiday.lib.php | 4 +- htdocs/core/lib/member.lib.php | 3 +- htdocs/core/lib/order.lib.php | 3 +- htdocs/core/lib/product.lib.php | 10 +- htdocs/core/lib/project.lib.php | 2 +- htdocs/core/lib/propal.lib.php | 3 +- .../asset/doc/pdf_standard_asset.modules.php | 10 +- .../doc/doc_generic_order_odt.modules.php | 4 +- .../commande/doc/pdf_einstein.modules.php | 10 +- .../commande/doc/pdf_eratosthene.modules.php | 4 +- .../doc/doc_generic_contract_odt.modules.php | 6 +- .../contract/doc/pdf_strato.modules.php | 4 +- .../doc/doc_generic_shipment_odt.modules.php | 6 +- .../expedition/doc/pdf_espadon.modules.php | 4 +- .../expedition/doc/pdf_merou.modules.php | 6 +- .../expedition/doc/pdf_rouget.modules.php | 4 +- .../doc/doc_generic_invoice_odt.modules.php | 4 +- .../modules/facture/doc/pdf_crabe.modules.php | 16 +- .../facture/doc/pdf_octopus.modules.php | 10 +- .../facture/doc/pdf_sponge.modules.php | 14 +- .../product/doc/pdf_standard.modules.php | 8 +- .../project/doc/pdf_baleine.modules.php | 6 +- .../project/doc/pdf_beluga.modules.php | 6 +- .../project/doc/pdf_timespent.modules.php | 6 +- .../doc/doc_generic_proposal_odt.modules.php | 4 +- .../modules/propale/doc/pdf_azur.modules.php | 22 +- .../modules/propale/doc/pdf_cyan.modules.php | 22 +- .../doc/doc_generic_reception_odt.modules.php | 4 +- .../reception/doc/pdf_squille.modules.php | 4 +- .../societe/doc/doc_generic_odt.modules.php | 6 +- .../doc/pdf_eagle_proforma.modules.php | 8 +- .../doc/pdf_canelle.modules.php | 4 +- .../supplier_order/doc/pdf_cornas.modules.php | 4 +- .../doc/pdf_muscadet.modules.php | 4 +- .../doc/pdf_aurore.modules.php | 4 +- .../doc/pdf_zenith.modules.php | 4 +- htdocs/core/photos_resize.php | 12 +- htdocs/cron/class/cronjob.class.php | 7 +- htdocs/document.php | 4 +- htdocs/ecm/class/ecmfiles.class.php | 5 - .../class/emailcollector.class.php | 5 - .../conferenceorboothattendee_note.php | 4 +- htdocs/expedition/list.php | 4 +- htdocs/expedition/shipment.php | 2 +- .../class/fournisseur.facture-rec.class.php | 1 - htdocs/holiday/document.php | 4 +- htdocs/hrm/class/establishment.class.php | 5 - htdocs/hrm/establishment/info.php | 4 +- htdocs/hrm/position_card.php | 4 +- .../class/knowledgerecord.class.php | 7 +- .../knowledgerecord_agenda.php | 4 +- .../knowledgerecord_note.php | 4 +- .../template/class/myobject.class.php | 5 - .../doc/pdf_standard_myobject.modules.php | 4 +- htdocs/mrp/class/mo.class.php | 6 +- htdocs/mrp/mo_agenda.php | 4 +- .../class/multicurrency.class.php | 7 +- .../partnership/class/partnership.class.php | 7 +- htdocs/partnership/partnership_agenda.php | 4 +- htdocs/partnership/partnership_note.php | 4 +- .../product/actions_card_product.class.php | 6 +- .../service/actions_card_service.class.php | 6 +- htdocs/product/card.php | 12 +- .../class/productcustomerprice.class.php | 5 - htdocs/product/document.php | 10 +- .../inventory/class/inventory.class.php | 5 - htdocs/product/list.php | 2 +- .../product/stock/class/productlot.class.php | 5 - htdocs/product/stock/productlot_card.php | 6 +- htdocs/product/stock/productlot_document.php | 4 +- .../stocktransfer/stocktransfer_agenda.php | 4 +- .../stocktransfer/stocktransfer_note.php | 4 +- htdocs/projet/card.php | 6 +- htdocs/projet/document.php | 6 +- htdocs/projet/element.php | 6 +- .../class/recruitmentcandidature.class.php | 6 +- .../class/recruitmentjobposition.class.php | 4 - ...tandard_recruitmentjobposition.modules.php | 10 +- htdocs/societe/card.php | 8 +- htdocs/societe/class/societe.class.php | 5 - htdocs/societe/document.php | 6 +- htdocs/societe/paymentmodes.php | 8 +- htdocs/societe/website.php | 4 +- htdocs/takepos/genimg/index.php | 9 +- htdocs/user/class/api_users.class.php | 4 +- htdocs/user/class/user.class.php | 5 - htdocs/user/class/usergroup.class.php | 7 +- htdocs/user/document.php | 4 +- htdocs/website/class/website.class.php | 7 +- htdocs/zapier/class/hook.class.php | 7 +- 126 files changed, 312 insertions(+), 808 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 97412e7a5fd..882df59f4f0 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -372,12 +372,6 @@ parameters: count: 5 path: ../../../htdocs/accountancy/class/bookkeeping.class.php - - - message: '#^Property BookKeeping\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/accountancy/class/bookkeeping.class.php - - message: '#^Property BookKeeping\:\:\$fk_doc \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -882,12 +876,6 @@ parameters: count: 1 path: ../../../htdocs/adherents/messaging.php - - - message: '#^Property Partnership\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/adherents/partnership.php - - message: '#^Property Partnership\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -1722,12 +1710,6 @@ parameters: count: 1 path: ../../../htdocs/api/index.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/accountancy_codes.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -1812,12 +1794,6 @@ parameters: count: 1 path: ../../../htdocs/asset/card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/card.php - - message: '#^Property Asset\:\:\$date_start \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -1890,12 +1866,6 @@ parameters: count: 1 path: ../../../htdocs/asset/depreciation.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/depreciation_options.php - - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse @@ -1908,42 +1878,18 @@ parameters: count: 1 path: ../../../htdocs/asset/list.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/model/accountancy_codes.php - - message: '#^Variable \$backtopageforcancel might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/asset/model/accountancy_codes.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/model/agenda.php - - message: '#^Property AssetModel\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: ../../../htdocs/asset/model/card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/model/card.php - - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/model/depreciation_options.php - - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse @@ -1956,12 +1902,6 @@ parameters: count: 1 path: ../../../htdocs/asset/model/list.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/asset/model/note.php - - message: '#^Variable \$assetaccountancycodes might not be defined\.$#' identifier: variable.undefined @@ -2052,12 +1992,6 @@ parameters: count: 1 path: ../../../htdocs/bom/bom_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bom/bom_card.php - - message: '#^Variable \$idprod might not be defined\.$#' identifier: variable.undefined @@ -2094,12 +2028,6 @@ parameters: count: 1 path: ../../../htdocs/bom/bom_net_needs.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bom/bom_net_needs.php - - message: '#^Left side of && is always false\.$#' identifier: booleanAnd.leftAlwaysFalse @@ -2202,12 +2130,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/availabilities_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bookcal/availabilities_card.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -2298,12 +2220,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/calendar_card.php - - - message: '#^Property Calendar\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bookcal/calendar_card.php - - message: '#^Property Calendar\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -4218,12 +4134,6 @@ parameters: count: 4 path: ../../../htdocs/compta/facture/class/paymentterm.class.php - - - message: '#^Property PaymentTerm\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/compta/facture/class/paymentterm.class.php - - message: '#^Property PaymentTerm\:\:\$libelle \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -4554,12 +4464,6 @@ parameters: count: 4 path: ../../../htdocs/compta/paiement/class/cpaiement.class.php - - - message: '#^Property CommonDict\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/compta/paiement/class/cpaiement.class.php - - message: '#^Property CommonDict\:\:\$id \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -4866,12 +4770,6 @@ parameters: count: 1 path: ../../../htdocs/compta/sociales/card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/compta/sociales/card.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -5202,12 +5100,6 @@ parameters: count: 1 path: ../../../htdocs/compta/tva/card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/compta/tva/card.php - - message: '#^Property PaymentVAT\:\:\$amount \(float\|int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -5430,12 +5322,6 @@ parameters: count: 3 path: ../../../htdocs/contact/class/contact.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/contact/class/contact.class.php - - message: '#^Property Contact\:\:\$roles \(array\\>\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -5574,12 +5460,6 @@ parameters: count: 2 path: ../../../htdocs/contrat/class/contrat.class.php - - - message: '#^Property Contrat\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/contrat/class/contrat.class.php - - message: '#^Property Contrat\:\:\$fk_commercial_signature \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -7962,12 +7842,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/menubase.class.php - - - message: '#^Property Menubase\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/class/menubase.class.php - - message: '#^Method Notify\:\:getNotificationsArray\(\) has parameter \$scope with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -9024,12 +8898,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/action/doc/pdf_standard_actions.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -9072,12 +8940,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -9402,12 +9264,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -10176,12 +10032,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php - - - message: '#^Property Mo\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php - - message: '#^Left side of \|\| is always false\.$#' identifier: booleanOr.leftAlwaysFalse @@ -10986,12 +10836,6 @@ parameters: count: 1 path: ../../../htdocs/cron/class/cronjob.class.php - - - message: '#^Property Cronjob\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/cron/class/cronjob.class.php - - message: '#^Property Cronjob\:\:\$frequency \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -11322,12 +11166,6 @@ parameters: count: 4 path: ../../../htdocs/ecm/class/ecmfiles.class.php - - - message: '#^Property EcmFiles\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/ecm/class/ecmfiles.class.php - - message: '#^Property EcmFiles\:\:\$filename \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -11622,12 +11460,6 @@ parameters: count: 1 path: ../../../htdocs/eventorganization/conferenceorbooth_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/eventorganization/conferenceorbooth_card.php - - message: '#^Property ConferenceOrBooth\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -11640,12 +11472,6 @@ parameters: count: 1 path: ../../../htdocs/eventorganization/conferenceorbooth_contact.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/eventorganization/conferenceorbooth_contact.php - - message: '#^Property ConferenceOrBooth\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -11664,12 +11490,6 @@ parameters: count: 1 path: ../../../htdocs/eventorganization/conferenceorbooth_document.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/eventorganization/conferenceorbooth_document.php - - message: '#^Property ConferenceOrBooth\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -11712,12 +11532,6 @@ parameters: count: 1 path: ../../../htdocs/eventorganization/conferenceorboothattendee_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/eventorganization/conferenceorboothattendee_card.php - - message: '#^Property ConferenceOrBoothAttendee\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -11892,12 +11706,6 @@ parameters: count: 5 path: ../../../htdocs/expedition/class/expedition.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/expedition/class/expedition.class.php - - message: '#^Property CommonObject\:\:\$fk_delivery_address \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12618,12 +12426,6 @@ parameters: count: 1 path: ../../../htdocs/fourn/class/fournisseur.facture.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/fourn/class/fournisseur.facture.class.php - - message: '#^Property CommonObject\:\:\$ref_ext \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -13476,24 +13278,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/compare.php - - - message: '#^Property Establishment\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/establishment/card.php - - - - message: '#^Property Establishment\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/establishment/info.php - - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/evaluation_card.php - - message: '#^Variable \$k might not be defined\.$#' identifier: variable.undefined @@ -13524,12 +13308,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/job_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/job_card.php - - message: '#^Variable \$soc might not be defined\.$#' identifier: variable.undefined @@ -13554,12 +13332,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/lib/hrm_skillrank.lib.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/position.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -13572,12 +13344,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/position.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/position_card.php - - message: '#^Variable \$upload_dir might not be defined\.$#' identifier: variable.undefined @@ -13602,12 +13368,6 @@ parameters: count: 1 path: ../../../htdocs/hrm/skill_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/hrm/skill_card.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -13914,12 +13674,6 @@ parameters: count: 1 path: ../../../htdocs/intracommreport/card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/intracommreport/card.php - - message: '#^Variable \$soc might not be defined\.$#' identifier: variable.undefined @@ -14070,12 +13824,6 @@ parameters: count: 1 path: ../../../htdocs/knowledgemanagement/knowledgerecord_card.php - - - message: '#^Property KnowledgeRecord\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/knowledgemanagement/knowledgerecord_card.php - - message: '#^Property KnowledgeRecord\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14688,12 +14436,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/template/core/modules/modMyModule.class.php - - - message: '#^Property MyObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -14796,12 +14538,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/template/myobject_card.php - - - message: '#^Property MyObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/modulebuilder/template/myobject_card.php - - message: '#^Property MyObject\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15048,12 +14784,6 @@ parameters: count: 1 path: ../../../htdocs/mrp/mo_agenda.php - - - message: '#^Property Mo\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/mrp/mo_card.php - - message: '#^Property Mo\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15066,12 +14796,6 @@ parameters: count: 1 path: ../../../htdocs/mrp/mo_document.php - - - message: '#^Property Mo\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/mrp/mo_movements.php - - message: '#^Property Mo\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15102,12 +14826,6 @@ parameters: count: 2 path: ../../../htdocs/mrp/mo_production.php - - - message: '#^Property Mo\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/mrp/mo_production.php - - message: '#^Property Mo\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15348,12 +15066,6 @@ parameters: count: 1 path: ../../../htdocs/partnership/partnership_card.php - - - message: '#^Property Partnership\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/partnership/partnership_card.php - - message: '#^Property Partnership\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15720,12 +15432,6 @@ parameters: count: 6 path: ../../../htdocs/product/class/productcustomerprice.class.php - - - message: '#^Property ProductCustomerPrice\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/product/class/productcustomerprice.class.php - - message: '#^Property ProductCustomerPrice\:\:\$fk_product \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -15972,12 +15678,6 @@ parameters: count: 1 path: ../../../htdocs/product/inventory/card.php - - - message: '#^Property Inventory\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/product/inventory/card.php - - message: '#^Variable \$backtopageforcancel might not be defined\.$#' identifier: variable.undefined @@ -16356,12 +16056,6 @@ parameters: count: 2 path: ../../../htdocs/product/stock/class/productlot.class.php - - - message: '#^Property Productlot\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/product/stock/class/productlot.class.php - - message: '#^Property Productlot\:\:\$eol_date \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -16686,12 +16380,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/stocktransfer/class/stocktransferline.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/product/stock/stocktransfer/stocktransfer_agenda.php - - message: '#^Property StockTransfer\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -16704,12 +16392,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/stocktransfer/stocktransfer_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/product/stock/stocktransfer/stocktransfer_card.php - - message: '#^Property StockTransfer\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -16722,12 +16404,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/stocktransfer/stocktransfer_card.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/product/stock/stocktransfer/stocktransfer_contact.php - - message: '#^Property StockTransfer\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -16950,12 +16626,6 @@ parameters: count: 2 path: ../../../htdocs/projet/class/project.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/projet/class/project.class.php - - message: '#^Property Project\:\:\$ip \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -18432,12 +18102,6 @@ parameters: count: 4 path: ../../../htdocs/reception/class/reception.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/reception/class/reception.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -18828,12 +18492,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/class/recruitmentjobposition.class.php - - - message: '#^Property RecruitmentJobPosition\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -18900,12 +18558,6 @@ parameters: count: 2 path: ../../../htdocs/recruitment/recruitmentcandidature_card.php - - - message: '#^Property RecruitmentCandidature\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/recruitment/recruitmentcandidature_card.php - - message: '#^Property RecruitmentCandidature\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -18936,12 +18588,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/recruitmentcandidature_list.php - - - message: '#^Property RecruitmentJobPosition\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/recruitment/recruitmentjobposition_applications.php - - message: '#^Property RecruitmentJobPosition\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -18966,12 +18612,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/recruitmentjobposition_card.php - - - message: '#^Property RecruitmentJobPosition\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/recruitment/recruitmentjobposition_card.php - - message: '#^Property RecruitmentJobPosition\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -19416,12 +19056,6 @@ parameters: count: 1 path: ../../../htdocs/societe/card.php - - - message: '#^Property Societe\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/societe/card.php - - message: '#^Property Societe\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -19530,12 +19164,6 @@ parameters: count: 1 path: ../../../htdocs/societe/class/societe.class.php - - - message: '#^Property Societe\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/societe/class/societe.class.php - - message: '#^Property Societe\:\:\$fournisseur \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -20460,12 +20088,6 @@ parameters: count: 1 path: ../../../htdocs/user/class/user.class.php - - - message: '#^Property User\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 2 - path: ../../../htdocs/user/class/user.class.php - - message: '#^Property User\:\:\$rights \(stdClass\) in empty\(\) is not falsy\.$#' identifier: empty.property @@ -20568,12 +20190,6 @@ parameters: count: 1 path: ../../../htdocs/user/class/usergroup.class.php - - - message: '#^Property UserGroup\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/user/class/usergroup.class.php - - message: '#^Property UserGroup\:\:\$name \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -20910,12 +20526,6 @@ parameters: count: 2 path: ../../../htdocs/webhook/class/target.class.php - - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/webhook/target_card.php - - message: '#^Variable \$soc might not be defined\.$#' identifier: variable.undefined @@ -21144,12 +20754,6 @@ parameters: count: 4 path: ../../../htdocs/website/class/website.class.php - - - message: '#^Property Website\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/website/class/website.class.php - - message: '#^Property Website\:\:\$fk_default_home \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index eb17e2728e0..04e3238bf59 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -49,11 +49,6 @@ class BookKeeping extends CommonObject */ public $table_element = 'accounting_bookkeeping'; - /** - * @var int Entity - */ - public $entity; - /** * @var BookKeepingLine[] Lines */ diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 55e98e0c4a7..02808795c0a 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -369,7 +369,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Thirdparty not found'); } - $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } elseif ($modulepart == 'user') { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -412,7 +412,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Proposal not found'); } - $upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $upload_dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); } elseif ($modulepart == 'supplier_proposal') { require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; @@ -426,7 +426,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Supplier proposal not found'); } - $upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $upload_dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); } elseif ($modulepart == 'commande' || $modulepart == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -516,7 +516,7 @@ class Documents extends DolibarrApi throw new RestException(500, 'Error while fetching object: '.$object->error); } - $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); + $upload_dir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -586,7 +586,7 @@ class Documents extends DolibarrApi throw new RestException(404, 'Category not found'); } - $upload_dir = $conf->categorie->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->categorie->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/".dol_sanitizeFileName($object->ref); } elseif ($modulepart == 'ecm') { throw new RestException(500, 'Modulepart Ecm not implemented yet.'); // require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; @@ -656,7 +656,7 @@ class Documents extends DolibarrApi if (!$result) { throw new RestException(404, 'Contact not found'); } - $upload_dir = $conf->societe->multidir_output[$object->entity] . "/contact/" . get_exdir(0, 0, 0, 1, $object, 'contact'); + $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity] . "/contact/" . get_exdir(0, 0, 0, 1, $object, 'contact'); } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); } diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 2d5a5ae6a75..f389e962202 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -88,7 +88,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->asset->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/asset/depreciation.php b/htdocs/asset/depreciation.php index 4a972e37cb5..cb8bd3164d5 100644 --- a/htdocs/asset/depreciation.php +++ b/htdocs/asset/depreciation.php @@ -60,7 +60,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id; + $upload_dir = $conf->asset->multidir_output[$object->entity ?? $conf->entity] . "/" . $object->id; } // Security check (enable the most restrictive one) diff --git a/htdocs/asset/disposal.php b/htdocs/asset/disposal.php index 4d97ffc353b..13b5ef338ad 100644 --- a/htdocs/asset/disposal.php +++ b/htdocs/asset/disposal.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -58,7 +58,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->asset->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissionnote = $user->hasRight('asset', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 3de0ab564b8..41ff1ffcd2c 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -57,7 +57,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->asset->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissionnote = $user->hasRight('asset', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index a79a5b13342..bd4f2135d1c 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -1,7 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,7 +94,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id; + $upload_dir = (!empty($conf->bom->multidir_output[$object->entity ?? $conf->entity]) ? $conf->bom->multidir_output[$object->entity ?? $conf->entity] : $conf->bom->dir_output)."/".$object->id; } // Security check - Protection if external user diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 689d73454fe..09c04cf61f6 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,7 +66,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id; + $upload_dir = (!empty($conf->bom->multidir_output[$object->entity ?? $conf->entity]) ? $conf->bom->multidir_output[$object->entity ?? $conf->entity] : $conf->bom->dir_output)."/".$object->id; } $permissionnote = $user->hasRight('bom', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index d7f2b662442..c545b286723 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2023 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index a3d4ba9fb28..b52aa462b13 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -124,10 +124,6 @@ class Calendar extends CommonObject * @var int */ public $rowid; - /** - * @var int - */ - public $entity; /** * @var string */ diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index b26bef2bf99..9aa9d18af52 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -72,7 +72,7 @@ if (is_numeric($type)) { $type = array_search($type, $object->MAP_ID); // For backward compatibility } -$upload_dir = $conf->categorie->multidir_output[$object->entity]; +$upload_dir = $conf->categorie->multidir_output[$object->entity ?? $conf->entity]; // Security check $result = restrictedArea($user, 'categorie', $id, '&category'); diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index e2a42a1c0ac..68d90d58c6c 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -92,11 +92,6 @@ class ActionCommReminder extends CommonObject */ public $rowid; - /** - * @var int Entity - */ - public $entity; - /** * @var int date remind */ diff --git a/htdocs/comm/mailing/note.php b/htdocs/comm/mailing/note.php index 964d226f73f..534e128d643 100644 --- a/htdocs/comm/mailing/note.php +++ b/htdocs/comm/mailing/note.php @@ -1,7 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2007-2017 Laurent Destailleur + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,7 +57,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->mailing->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->mailing->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissionnote = $user->hasRight('mailing', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index be504a05597..e480d8b8f41 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2167,7 +2167,7 @@ if (empty($reshook)) { } // Actions to build doc - $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity ?? $conf->entity]) ? $conf->propal->multidir_output[$object->entity ?? $conf->entity] : $conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; } @@ -3684,7 +3684,7 @@ if ($action == 'create') { * Generated documents */ $objref = dol_sanitizeFileName($object->ref); - $filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref); + $filedir = $conf->propal->multidir_output[$object->entity ?? $conf->entity] . "/" . dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $usercanread; $delallowed = $usercancreate; @@ -3730,7 +3730,7 @@ if ($action == 'create') { // Presend form $modelmail = 'propal_send'; $defaulttopic = 'SendPropalRef'; - $diroutput = $conf->propal->multidir_output[$object->entity]; + $diroutput = $conf->propal->multidir_output[$object->entity ?? $conf->entity]; $trackid = 'pro' . $object->id; include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index f873f40ba2b..7ee0af21e10 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -104,7 +104,7 @@ $usercancreate = $user->hasRight("propal", "creer"); if ($object->id > 0) { $object->fetch_thirdparty(); - $upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; } @@ -119,7 +119,7 @@ llxHeader('', $title, $help_url); $form = new Form($db); if ($object->id > 0) { - $upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $head = propal_prepare_head($object); print dol_get_fiche_head($head, 'document', $langs->trans('Proposal'), -1, $object->picto); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 680b570998c..3e96d198089 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2035,7 +2035,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; // Actions to build doc - $upload_dir = !empty($conf->commande->multidir_output[$object->entity]) ? $conf->commande->multidir_output[$object->entity] : $conf->commande->dir_output; + $upload_dir = !empty($conf->commande->multidir_output[$object->entity ?? $conf->entity]) ? $conf->commande->multidir_output[$object->entity ?? $conf->entity] : $conf->commande->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; @@ -3640,7 +3640,7 @@ if ($action == 'create' && $usercancreate) { // Documents $objref = dol_sanitizeFileName($object->ref); $relativepath = $objref . '/' . $objref . '.pdf'; - $filedir = $conf->commande->multidir_output[$object->entity] . '/' . $objref; + $filedir = $conf->commande->multidir_output[$object->entity ?? $conf->entity] . '/' . $objref; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $usercanread; $delallowed = $usercancreate; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index c92c0500a4a..21fb7ce68a7 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -104,7 +104,7 @@ $result = restrictedArea($user, 'commande', $id, ''); if ($object->fetch($id)) { $object->fetch_thirdparty(); - $upload_dir = $conf->commande->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->commande->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); } include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; @@ -123,7 +123,7 @@ if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref)) { $object->fetch_thirdparty(); - $upload_dir = $conf->commande->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->commande->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $head = commande_prepare_head($object); print dol_get_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), -1, $object->picto); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 12e44503fe0..82489de706b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -6750,7 +6750,7 @@ if ($action == 'create') { // Generated documents $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->invoice->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $filedir = $conf->invoice->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $urlsource = $_SERVER['PHP_SELF'].'?facid='.$object->id; $genallowed = $usercanread; $delallowed = $usercancreate; @@ -6827,7 +6827,7 @@ if ($action == 'create') { // Presend form $modelmail = 'facture_send'; $defaulttopic = 'SendBillRef'; - $diroutput = $conf->invoice->multidir_output[$object->entity]; + $diroutput = $conf->invoice->multidir_output[$object->entity ?? $conf->entity]; $trackid = 'inv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index d3ddf47ee8c..ac78350d54d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -77,11 +77,6 @@ class FactureRec extends CommonInvoice */ public $picto = 'bill'; - /** - * @var int Entity - */ - public $entity; - /** * {@inheritdoc} */ diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 89116d35ae3..76e92f09e10 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -58,7 +58,7 @@ class PaymentTerm // extends CommonObject /** - * @var int Entity ID + * @var ?int Entity ID */ public $entity; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index f66acf8d918..e00a841cebd 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2017-2024 Frédéric France + * Copyright (C) 2017-2025 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * Copyright (C) 2025 MDW * @@ -136,7 +136,7 @@ if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { $object->fetch_thirdparty(); - $upload_dir = $conf->facture->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->facture->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $head = facture_prepare_head($object); print dol_get_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, $object->picto); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 845b338430f..6457ad5946e 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -378,7 +378,7 @@ if (empty($reshook)) { $object->fetchRoles(); // Photo save - $dir = $conf->societe->multidir_output[$object->entity]."/contact/".$object->id."/photos"; + $dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/contact/".$object->id."/photos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if (GETPOST('deletephoto') && $object->photo) { $fileimg = $dir.'/'.$object->photo; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 5f5cbd6f107..3450bfe81e9 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2024 Frédéric France + * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2017 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -91,7 +91,7 @@ if ($id > 0) { $object->fetch($id); } -$upload_dir = $conf->societe->multidir_output[$object->entity].'/contact/'.dol_sanitizeFileName($object->ref); +$upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity].'/contact/'.dol_sanitizeFileName($object->ref); $modulepart = 'contact'; // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index f029414618d..25fbdeb7d0c 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1019,8 +1019,8 @@ if (empty($reshook)) { $action = 'editref'; } else { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $old_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($old_ref); - $new_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $old_filedir = $conf->contrat->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($old_ref); + $new_filedir = $conf->contrat->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); // Rename directory of contract with new name dol_move_dir($old_filedir, $new_filedir); @@ -2381,7 +2381,7 @@ if ($action == 'create') { * Generated documents */ $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $filedir = $conf->contrat->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->hasRight('contrat', 'lire'); $delallowed = $user->hasRight('contrat', 'creer'); @@ -2427,7 +2427,7 @@ if ($action == 'create') { // Presend form $modelmail = 'contract'; $defaulttopic = 'SendContractRef'; - $diroutput = $conf->contrat->multidir_output[$object->entity]; + $diroutput = $conf->contrat->multidir_output[$object->entity ?? $conf->entity]; $trackid = 'con'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1fe72c4ae2e..ef3802c69d7 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -103,12 +103,6 @@ class Contrat extends CommonObject */ public $ref_supplier; - /** - * Entity of the contract - * @var int - */ - public $entity; - /** * Client id linked to the contract * @var int diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 3fb3d427f8a..e4b3f784682 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -88,7 +88,7 @@ if ($object->id > 0) { $object->fetch_thirdparty(); } -$upload_dir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); +$upload_dir = $conf->contrat->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $modulepart = 'contract'; // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index da25632abdb..31dda607808 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -121,7 +121,7 @@ if ($action == "importSignature") { $object = new Propal($db); $object->fetch(0, $ref); - $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity ?? $conf->entity]) ? $conf->propal->multidir_output[$object->entity ?? $conf->entity] : $conf->propal->dir_output; $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance @@ -339,7 +339,7 @@ if ($action == "importSignature") { $object = new Contrat($db); $object->fetch(0, $ref); - $upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output; + $upload_dir = !empty($conf->contrat->multidir_output[$object->entity ?? $conf->entity]) ? $conf->contrat->multidir_output[$object->entity ?? $conf->entity] : $conf->contrat->dir_output; $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); @@ -471,7 +471,7 @@ if ($action == "importSignature") { $object = new Fichinter($db); $object->fetch(0, $ref); - $upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity]) ? $conf->ficheinter->multidir_output[$object->entity] : $conf->ficheinter->dir_output; + $upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity ?? $conf->entity]) ? $conf->ficheinter->multidir_output[$object->entity ?? $conf->entity] : $conf->ficheinter->dir_output; $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; $langs->loadLangs(array("main", "companies")); diff --git a/htdocs/core/class/commondict.class.php b/htdocs/core/class/commondict.class.php index 28e7badb699..f6dc107025b 100644 --- a/htdocs/core/class/commondict.class.php +++ b/htdocs/core/class/commondict.class.php @@ -49,7 +49,7 @@ abstract class CommonDict public $id; /** - * @var int The environment ID when using a multicompany module + * @var ?int The environment ID when using a multicompany module */ public $entity; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b66beaecbf7..afb4bdae217 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -70,7 +70,7 @@ abstract class CommonObject public $id; /** - * @var int The environment ID when using a multicompany module + * @var ?int The environment ID when using a multicompany module */ public $entity; diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 3e95db95cbb..247f007737f 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -51,7 +51,7 @@ class Menubase public $id; /** - * @var int Entity + * @var ?int Entity */ public $entity; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 722c4f9d890..7d5e1e89318 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2023 William Mead * Copyright (C) 2024 Jon Bendtsen * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -795,13 +795,13 @@ class Notify break; case 'PROPAL_VALIDATE': $link = ''.$newref.''; - $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $dir_output = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); $object_type = 'propal'; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $link); break; case 'PROPAL_CLOSE_REFUSED': $link = ''.$newref.''; - $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $dir_output = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); $object_type = 'propal'; $labeltouse = getDolGlobalString('PROPAL_CLOSE_REFUSED_TEMPLATE'); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedRefused", $link); @@ -811,7 +811,7 @@ class Notify break; case 'PROPAL_CLOSE_SIGNED': $link = ''.$newref.''; - $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $dir_output = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); $object_type = 'propal'; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link); if (!empty($object->context['closedfromonlinesignature'])) { @@ -845,7 +845,7 @@ class Notify break; case 'ORDER_SUPPLIER_VALIDATE': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $labeltouse = isset($conf->global->ORDER_SUPPLIER_VALIDATE_TEMPLATE) ? $conf->global->ORDER_SUPPLIER_VALIDATE_TEMPLATE : ''; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; @@ -854,7 +854,7 @@ class Notify break; case 'ORDER_SUPPLIER_CANCEL': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextSupplierOrderCanceledBy", $link, $user->getFullName($outputlangs)); @@ -862,7 +862,7 @@ class Notify break; case 'ORDER_SUPPLIER_APPROVE': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $labeltouse = isset($conf->global->ORDER_SUPPLIER_APPROVE_TEMPLATE) ? $conf->global->ORDER_SUPPLIER_APPROVE_TEMPLATE : ''; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; @@ -871,7 +871,7 @@ class Notify break; case 'ORDER_SUPPLIER_SUBMIT': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextSupplierOrderSubmittedBy", $link, $user->getFullName($outputlangs)); @@ -879,7 +879,7 @@ class Notify break; case 'ORDER_SUPPLIER_REFUSE': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $labeltouse = isset($conf->global->ORDER_SUPPLIER_REFUSE_TEMPLATE) ? $conf->global->ORDER_SUPPLIER_REFUSE_TEMPLATE : ''; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n"; @@ -1127,13 +1127,13 @@ class Notify break; case 'PROPAL_VALIDATE': $link = ''.$newref.''; - $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $dir_output = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $link); break; case 'PROPAL_CLOSE_SIGNED': $link = ''.$newref.''; - $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $dir_output = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); $object_type = 'propal'; $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link); break; @@ -1164,7 +1164,7 @@ class Notify break; case 'ORDER_SUPPLIER_CANCEL': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $langs->transnoentitiesnoconv("EMailTextSupplierOrderCanceledBy", $link, $user->getFullName($langs)); @@ -1172,7 +1172,7 @@ class Notify break; case 'ORDER_SUPPLIER_VALIDATE': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $langs->transnoentitiesnoconv("EMailTextSupplierOrderValidatedBy", $link, $user->getFullName($langs)); @@ -1180,7 +1180,7 @@ class Notify break; case 'ORDER_SUPPLIER_APPROVE': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $langs->transnoentitiesnoconv("EMailTextSupplierOrderApprovedBy", $link, $user->getFullName($langs)); @@ -1188,7 +1188,7 @@ class Notify break; case 'ORDER_SUPPLIER_SUBMIT': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $langs->transnoentitiesnoconv("EMailTextSupplierOrderSubmittedBy", $link, $user->getFullName($langs)); @@ -1196,7 +1196,7 @@ class Notify break; case 'ORDER_SUPPLIER_REFUSE': $link = ''.$newref.''; - $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object); + $dir_output = $conf->fournisseur->commande->multidir_output[$object->entity ?? $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); $object_type = 'order_supplier'; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg .= $langs->transnoentitiesnoconv("EMailTextSupplierOrderRefusedBy", $link, $user->getFullName($langs)); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b35b8e772b4..f61b828d0d8 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -431,7 +431,7 @@ function societe_prepare_head(Societe $object) } else { require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; - $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id; + $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity] . "/" . $object->id; $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $totalAttached = $nbFiles + $nbLinks; diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index 532b2652003..7a64a9bd7e1 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2023 Charlene BENKE * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,7 +87,7 @@ function contract_prepare_head(Contrat $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->contrat->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 9302c852f15..e12d03bbbe6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2023 Lenin Rivas * Copyright (C) 2024-2025 MDW * @@ -441,9 +441,9 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object = global $object; if (!empty($object->id)) { if (isModEnabled("product")) { - $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; + $upload_dirold = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; } else { - $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; + $upload_dirold = $conf->service->multidir_output[$object->entity ?? $conf->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; } $relativedirold = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dirold); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4b7e3d71f83..9b9374e26c0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -565,7 +565,7 @@ function setEntity($currentobject) if (is_object($mc) && method_exists($mc, 'setEntity')) { return $mc->setEntity($currentobject); } else { - return ((is_object($currentobject) && $currentobject->id > 0 && $currentobject->entity > 0) ? $currentobject->entity : $conf->entity); + return ((is_object($currentobject) && $currentobject->id > 0 && ((int) $currentobject->entity) > 0) ? (int) $currentobject->entity : $conf->entity); } } @@ -8763,7 +8763,7 @@ function yn($yesno, $format = 1, $color = 0) /** * Return a path to have a the directory according to object where files are stored. * This function is called by getMultidirOutput - * New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, '').'/' + * New usage: $conf->module->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, '').'/' * or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, '') * * Example of output with new usage: $object is invoice -> 'INYYMM-ABCD' diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index e25ee0b5902..10bfba25044 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -44,7 +44,7 @@ function holiday_prepare_head($object) // Attachments require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->holiday->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id; diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 3826c28e7e3..f0843bb2a07 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2017 Regis Houssin * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,7 +116,7 @@ function member_prepare_head(Adherent $object) // Attachments require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member'); + $upload_dir = $conf->adherent->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member'); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 136324b96f2..22002aef664 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,7 +119,7 @@ function commande_prepare_head(Commande $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->commande->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->commande->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 3217b0d19fd..d0e937722c4 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -203,18 +203,18 @@ function product_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = ''; if (isModEnabled("product") && ($object->type == Product::TYPE_PRODUCT)) { - $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); } if (isModEnabled("service") && ($object->type == Product::TYPE_SERVICE)) { - $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->service->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); } $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { if (isModEnabled("product") && ($object->type == Product::TYPE_PRODUCT)) { - $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; + $upload_dir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; } if (isModEnabled("service") && ($object->type == Product::TYPE_SERVICE)) { - $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; + $upload_dir = $conf->service->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; } $nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); } @@ -273,7 +273,7 @@ function productlot_prepare_head($object) // Attachments require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->productbatch->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT."/product/stock/productlot_document.php?id=".$object->id; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f3fa70d4354..7db8c5ee8db 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -441,7 +441,7 @@ function task_prepare_head($object) } $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); - $filesdir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->project->ref).'/'.dol_sanitizeFileName($object->ref); + $filesdir = $conf->project->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->project->ref).'/'.dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $nbFiles = count(dol_dir_list($filesdir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 39a9eb77b01..427ba5ac05b 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +99,7 @@ function propal_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id; diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 67815d6a5f9..41db3197f09 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -8,7 +8,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Nick Fragoulis * @@ -239,8 +239,8 @@ class pdf_standard_asset extends ModelePDFAsset // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir .'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -831,8 +831,8 @@ class pdf_standard_asset extends ModelePDFAsset if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 51516084ece..b4dd9900f77 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -4,7 +4,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2021 Philippe Grand - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -261,7 +261,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $object->fetch_thirdparty(); - $dir = $conf->commande->multidir_output[$object->entity]; + $dir = $conf->commande->multidir_output[$object->entity ?? $conf->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 507d52d0e28..fc1bb915a31 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -230,7 +230,7 @@ class pdf_einstein extends ModelePDFCommandes } $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->commande->multidir_output[$object->entity]."/".$objectref; + $dir = $conf->commande->multidir_output[$object->entity ?? $conf->entity]."/".$objectref; $file = $dir."/".$objectref.$suffix.".pdf"; } @@ -275,8 +275,8 @@ class pdf_einstein extends ModelePDFCommandes // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -1378,8 +1378,8 @@ class pdf_einstein extends ModelePDFCommandes if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d0c51a38fa1..2023e24aa2f 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -322,8 +322,8 @@ class pdf_eratosthene extends ModelePDFCommandes // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 4dd5cc58d74..5bdaf19b0e9 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -235,7 +235,7 @@ class doc_generic_contract_odt extends ModelePDFContract // Load translation files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "deliveries")); - if ($conf->contract->multidir_output[$object->entity]) { + if ($conf->contract->multidir_output[$object->entity ?? $conf->entity]) { // If $object is id instead of object if (!is_object($object)) { $id = $object; @@ -249,7 +249,7 @@ class doc_generic_contract_odt extends ModelePDFContract $object->fetch_thirdparty(); - $dir = $conf->contract->multidir_output[$object->entity]; + $dir = $conf->contract->multidir_output[$object->entity ?? $conf->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 5394064a8d5..9298e1f1b1e 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -238,8 +238,8 @@ class pdf_strato extends ModelePDFContract // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 8929c3c860d..7f82572e00f 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -4,7 +4,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2021 Philippe Grand - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -241,7 +241,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition // Load translation files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->expedition->multidir_output[$object->entity]."/sending") { + if ($conf->expedition->multidir_output[$object->entity ?? $conf->entity]."/sending") { // If $object is id instead of object if (!is_object($object)) { $id = $object; @@ -255,7 +255,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $object->fetch_thirdparty(); - $dir = $conf->expedition->multidir_output[$object->entity]."/sending"; + $dir = $conf->expedition->multidir_output[$object->entity ?? $conf->entity]."/sending"; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index a72b83cea76..4e49586d420 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -1067,8 +1067,8 @@ class pdf_espadon extends ModelePdfExpedition // Logo if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 0c52e7bfd8a..196e44f35f6 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -533,8 +533,8 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetXY(11, 7); if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index aded5f57e12..e2d86b6b906 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -943,8 +943,8 @@ class pdf_rouget extends ModelePdfExpedition // Logo if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 17d278a6bcb..7e97b0b6b30 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -249,7 +249,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $object->fetch_thirdparty(); - $dir = empty($conf->facture->multidir_output[$object->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity]; + $dir = empty($conf->facture->multidir_output[$object->entity ?? $conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity ?? $conf->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 1b3cab234a3..0f877dd55d6 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -272,11 +272,11 @@ class pdf_crabe extends ModelePDFFactures // Definition of $dir and $file if ($object->specimen) { - $dir = empty($conf->facture->multidir_output[$object->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity]; + $dir = empty($conf->facture->multidir_output[$object->entity ?? $conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity ?? $conf->entity]; $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = (empty($conf->facture->multidir_output[$object->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity])."/".$objectref; + $dir = (empty($conf->facture->multidir_output[$object->entity ?? $conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity ?? $conf->entity])."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { @@ -334,8 +334,8 @@ class pdf_crabe extends ModelePDFFactures // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -883,8 +883,8 @@ class pdf_crabe extends ModelePDFFactures // Add terms to sale if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { $termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $termsofsale = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity].'/'.$mysoc->termsofsale; } if (file_exists($termsofsale) && is_readable($termsofsale)) { $pagecount = $pdf->setSourceFile($termsofsale); @@ -2080,8 +2080,8 @@ class pdf_crabe extends ModelePDFFactures if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 665b6ac8fd2..6103f734a99 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -385,7 +385,7 @@ class pdf_octopus extends ModelePDFFactures $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->facture->multidir_output[$object->entity]."/".$objectref; + $dir = $conf->facture->multidir_output[$object->entity ?? $conf->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { @@ -437,8 +437,8 @@ class pdf_octopus extends ModelePDFFactures // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $this->tplidx = $pdf->importPage(1); @@ -2227,8 +2227,8 @@ class pdf_octopus extends ModelePDFFactures if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index f22aeeec675..438fe317fda 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -309,7 +309,7 @@ class pdf_sponge extends ModelePDFFactures $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->facture->multidir_output[$object->entity]."/".$objectref; + $dir = $conf->facture->multidir_output[$object->entity ?? $conf->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { @@ -360,8 +360,8 @@ class pdf_sponge extends ModelePDFFactures // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -1108,8 +1108,8 @@ class pdf_sponge extends ModelePDFFactures // Add terms to sale if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { $termsofsale = $conf->mycompany->dir_output.'/'.$mysoc->termsofsale; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $termsofsale = $conf->mycompany->multidir_output[$object->entity].'/'.$mysoc->termsofsale; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $termsofsale = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity].'/'.$mysoc->termsofsale; } if (file_exists($termsofsale) && is_readable($termsofsale)) { $pagecount = $pdf->setSourceFile($termsofsale); @@ -2446,8 +2446,8 @@ class pdf_sponge extends ModelePDFFactures if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index a90e4c064a9..f53e0cf8c55 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023 Anthony Berton * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -257,7 +257,7 @@ class pdf_standard extends ModelePDFProduct foreach ($pdir as $midir) { if (!$arephoto) { if ($conf->entity != $object->entity) { - $dir = $conf->product->multidir_output[$object->entity].'/'.$midir; //Check repertories of current entities + $dir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.$midir; //Check repertories of current entities } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product } @@ -760,8 +760,8 @@ class pdf_standard extends ModelePDFProduct if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 8098896a64e..8762c0605d2 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2018 Laurent Destailleur * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -168,11 +168,11 @@ class pdf_baleine extends ModelePDFProjects // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); - if ($conf->project->multidir_output[$object->entity]) { + if ($conf->project->multidir_output[$object->entity ?? $conf->entity]) { //$nblines = count($object->lines); // This is set later with array of tasks $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->project->multidir_output[$object->entity]; + $dir = $conf->project->multidir_output[$object->entity ?? $conf->entity]; if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; } diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 17478387058..5b631cb0641 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2018 Laurent Destailleur * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -217,11 +217,11 @@ class pdf_beluga extends ModelePDFProjects // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); - if ($conf->project->multidir_output[$object->entity]) { + if ($conf->project->multidir_output[$object->entity ?? $conf->entity]) { //$nblines = count($object->lines); // This is set later with array of tasks $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->project->multidir_output[$object->entity]; + $dir = $conf->project->multidir_output[$object->entity ?? $conf->entity]; if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; } diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 6c91a182b0f..32f3f88c9c6 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -163,11 +163,11 @@ class pdf_timespent extends ModelePDFProjects // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); - if ($conf->project->multidir_output[$object->entity]) { + if ($conf->project->multidir_output[$object->entity ?? $conf->entity]) { //$nblines = count($object->lines); // This is set later with array of tasks $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->project->multidir_output[$object->entity]; + $dir = $conf->project->multidir_output[$object->entity ?? $conf->entity]; if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 961a0ab27c1..d99e5a4080c 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -298,7 +298,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $object->fetch_thirdparty(); - $dir = $conf->propal->multidir_output[$object->entity]; + $dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 765f328f343..0380ac41f56 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -287,7 +287,7 @@ class pdf_azur extends ModelePDFPropales $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->propal->multidir_output[$object->entity]."/".$objectref; + $dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } @@ -326,8 +326,8 @@ class pdf_azur extends ModelePDFPropales // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -773,8 +773,8 @@ class pdf_azur extends ModelePDFPropales if (getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE') && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) { $termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE'); $termsofsale = $conf->propal->dir_output.'/'.$termsofsalefilename; - if (!empty($conf->propal->multidir_output[$object->entity])) { - $termsofsale = $conf->propal->multidir_output[$object->entity].'/'.$termsofsalefilename; + if (!empty($conf->propal->multidir_output[$object->entity ?? $conf->entity])) { + $termsofsale = $conf->propal->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; } if (file_exists($termsofsale) && is_readable($termsofsale)) { $pagecount = $pdf->setSourceFile($termsofsale); @@ -825,15 +825,15 @@ class pdf_azur extends ModelePDFPropales if (!empty($linefile->id) && !empty($linefile->file_name)) { if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { if (isModEnabled("product")) { - $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } elseif (isModEnabled("service")) { - $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } } else { if (isModEnabled("product")) { - $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); } elseif (isModEnabled("service")) { - $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); } } @@ -1585,8 +1585,8 @@ class pdf_azur extends ModelePDFPropales if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 2f7c7d04ac7..8c9ed631ce1 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -265,7 +265,7 @@ class pdf_cyan extends ModelePDFPropales $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->propal->multidir_output[$object->entity]."/".$objectref; + $dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } @@ -304,8 +304,8 @@ class pdf_cyan extends ModelePDFPropales // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -960,8 +960,8 @@ class pdf_cyan extends ModelePDFPropales if (getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE') && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) { $termsofsalefilename = getDolGlobalString('MAIN_INFO_PROPAL_TERMSOFSALE'); $termsofsale = $conf->propal->dir_output.'/'.$termsofsalefilename; - if (!empty($conf->propal->multidir_output[$object->entity])) { - $termsofsale = $conf->propal->multidir_output[$object->entity].'/'.$termsofsalefilename; + if (!empty($conf->propal->multidir_output[$object->entity ?? $conf->entity])) { + $termsofsale = $conf->propal->multidir_output[$object->entity ?? $conf->entity].'/'.$termsofsalefilename; } if (file_exists($termsofsale) && is_readable($termsofsale)) { $pagecount = $pdf->setSourceFile($termsofsale); @@ -1012,15 +1012,15 @@ class pdf_cyan extends ModelePDFPropales $filetomerge_dir = null; if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { if (isModEnabled("product")) { - $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } elseif (isModEnabled("service")) { - $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } } else { if (isModEnabled("product")) { - $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); } elseif (isModEnabled("service")) { - $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file ?? $conf->entity].'/'.get_exdir(0, 0, 0, 0, $product, 'product'); } } @@ -1725,8 +1725,8 @@ class pdf_cyan extends ModelePDFPropales if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index f92fc4ca6f9..cfcf8f541d6 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -250,7 +250,7 @@ class doc_generic_reception_odt extends ModelePdfReception $object->fetch_thirdparty(); - $dir = !empty($conf->reception->multidir_output[$object->entity]) ? $conf->reception->multidir_output[$object->entity] : $conf->reception->dir_output; + $dir = !empty($conf->reception->multidir_output[$object->entity ?? $conf->entity]) ? $conf->reception->multidir_output[$object->entity ?? $conf->entity] : $conf->reception->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 050e5060276..5d92174979c 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -926,8 +926,8 @@ class pdf_squille extends ModelePdfReception // Logo if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 949c8abf977..2c90ce35230 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -239,8 +239,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); - if ($conf->societe->multidir_output[$object->entity]) { - $dir = $conf->societe->multidir_output[$object->entity]; + if ($conf->societe->multidir_output[$object->entity ?? $conf->entity]) { + $dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]; $objectref = dol_sanitizeFileName((string) $object->id); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 1b63623c86b..f3454eb3bca 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -294,8 +294,8 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer // Set path to the background PDF File if (!getDolGlobalString('MAIN_DISABLE_FPDI') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir .'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -1225,8 +1225,8 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 9c33922bf92..60ec67f2e92 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -255,8 +255,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir .'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 323c55584ea..4fa1768da19 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1245,8 +1245,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 2df7f792ab4..b80568cc821 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1141,8 +1141,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index b7fc37c2797..cb78220cd56 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1236,8 +1236,8 @@ class pdf_aurore extends ModelePDFSupplierProposal if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index cf2510053ee..985746d1f94 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -1214,8 +1214,8 @@ class pdf_zenith extends ModelePDFSupplierProposal if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 53c7b2f792f..be9889cb78d 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -5,7 +5,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2024 MDW * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -139,12 +139,12 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv if ($result <= 0) { dol_print_error($db, 'Failed to load object'); } - $dir = $conf->product->multidir_output[$object->entity]; // By default + $dir = $conf->product->multidir_output[$object->entity ?? $conf->entity]; // By default if ($object->type == Product::TYPE_PRODUCT) { - $dir = $conf->product->multidir_output[$object->entity]; + $dir = $conf->product->multidir_output[$object->entity ?? $conf->entity]; } if ($object->type == Product::TYPE_SERVICE) { - $dir = $conf->service->multidir_output[$object->entity]; + $dir = $conf->service->multidir_output[$object->entity ?? $conf->entity]; } } } elseif ($modulepart == 'project') { @@ -155,7 +155,7 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv if ($result <= 0) { dol_print_error($db, 'Failed to load object'); } - $dir = $conf->project->multidir_output[$object->entity]; // By default + $dir = $conf->project->multidir_output[$object->entity ?? $conf->entity]; // By default } } elseif ($modulepart == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; @@ -165,7 +165,7 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv if ($result <= 0) { dol_print_error($db, 'Failed to load object'); } - $dir = $conf->propal->multidir_output[$object->entity]; // By default + $dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity]; // By default } } elseif ($modulepart == 'holiday') { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f833504f065..eac2f07f681 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2022 Laurent Destailleur * Copyright (C) 2013 Florian Henry * Copyright (C) 2023-2024 William Mead - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -49,11 +49,6 @@ class Cronjob extends CommonObject */ public $picto = 'cron'; - /** - * @var int Entity - */ - public $entity; - /** * @var string Job type */ diff --git a/htdocs/document.php b/htdocs/document.php index 9cf9034d7bb..72f76cea104 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2010 Pierre Morin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2022 Ferran Marcet - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -269,7 +269,7 @@ if (empty($modulepart)) { } // Check security and set return info with full path of file -$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, ''); +$check_access = dol_check_secure_access_document($modulepart, $original_file, ($entity ?? 1), $user, ''); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 84f90cfedee..33f0e4a7fd0 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -67,11 +67,6 @@ class EcmFiles extends CommonObject */ public $share; - /** - * @var int Entity - */ - public $entity; - /** * @var string filename, Note: Into ecm database record, the entry never ends with .noexe */ diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 605b9c81a29..37cad47f9cd 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -157,11 +157,6 @@ class EmailCollector extends CommonObject */ public $ref; - /** - * @var int Entity - */ - public $entity; - /** * @var string label */ diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 699d7b5a124..61afed3bf09 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -64,7 +64,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->eventorganization->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->eventorganization->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } // Permissions diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index dc35a4d70f6..1e50640a44b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Vincent Maury * Copyright (C) 2024 William Mead - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1543,7 +1543,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['e.ref']['checked'])) { print ''; print $object->getNomUrl(1); - $filedir = ($conf->expedition->multidir_output[$object->entity] ? $conf->expedition->multidir_output[$object->entity] : $conf->expedition->dir_output).'/sending/'.get_exdir(0, 0, 0, 1, $object, ''); + $filedir = ($conf->expedition->multidir_output[$object->entity ?? $conf->entity] ? $conf->expedition->multidir_output[$object->entity ?? $conf->entity] : $conf->expedition->dir_output).'/sending/'.get_exdir(0, 0, 0, 1, $object, ''); $filename = dol_sanitizeFileName($object->ref); print $formfile->getDocumentsLink('expedition', $filename, $filedir); print "\n"; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index ef296aa14d0..b84298db269 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -738,7 +738,7 @@ if ($order_id > 0 || !empty($ref)) { $text = $product_static->getNomUrl(1); $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'
'; - $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); + $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity ?? $conf->entity], 1, 1, 0, 0, 0, 80); print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i); // Show range diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index d172d963dd1..84f9f3deffe 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -229,7 +229,6 @@ class FactureFournisseurRec extends CommonInvoice /* Override fields in CommonObject - public $entity; public $total_ht; public $total_tva; public $total_ttc; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index be55c21ee09..bf30730f0d9 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -109,7 +109,7 @@ if (($id > 0) || $ref) { } -$upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, ''); +$upload_dir = $conf->holiday->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, ''); $modulepart = 'holiday'; // Protection if external user diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index dece2bbe53e..de13072e076 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -100,11 +100,6 @@ class Establishment extends CommonObject */ public $status; - /** - * @var int Entity - */ - public $entity; - /** * @var int user mod id */ diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php index 0f9b3e61168..5b7dd497abe 100644 --- a/htdocs/hrm/establishment/info.php +++ b/htdocs/hrm/establishment/info.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -83,7 +83,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'. 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[$object->entity ?? $conf->entity]."/".$object->id; } $permissiontoread = $user->admin; diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index a0cbca8a554..0ca05a33e9b 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -5,7 +5,7 @@ * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -359,7 +359,7 @@ function displayPositionCard(&$object) // /* // * Generated documents // */ -// $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id; +// $filedir = $conf->societe->multidir_output[$object->entity ?? $conf->entity].'/'.$object->id; // $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id; // $genallowed = $user->hasRight('societe', 'lire'); // $delallowed = $user->hasRight('societe', 'creer'); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index ff4d3582079..85c5e5e87b1 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -109,18 +109,17 @@ class KnowledgeRecord extends CommonObject 'answer' => array('type' => 'html', 'label' => 'Solution', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 3, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 5, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', 9 => 'Obsolete'),), ); + /** * @var int */ public $rowid; + /** * @var string */ public $ref; - /** - * @var int - */ - public $entity; + /** * @var string */ diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index 63707b92f5b..dbf27cd908d 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -1,7 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +91,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = (!empty($conf->knowledgemanagement->multidir_output[$object->entity]) ? $conf->knowledgemanagement->multidir_output[$object->entity] : $conf->knowledgemanagement->dir_output)."/".$object->id; + $upload_dir = (!empty($conf->knowledgemanagement->multidir_output[$object->entity ?? $conf->entity]) ? $conf->knowledgemanagement->multidir_output[$object->entity ?? $conf->entity] : $conf->knowledgemanagement->dir_output)."/".$object->id; } // Security check - Protection if external user diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 5e00656e9a7..980caf60cd8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -1,7 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,7 +58,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 0ac68db5adb..57d10cfdf4c 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -159,11 +159,6 @@ class MyObject extends CommonObject */ public $ref; - /** - * @var int Entity - */ - public $entity; - /** * @var string label */ diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 320c4af2dfd..354a569213c 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -322,8 +322,8 @@ class pdf_standard_myobject extends ModelePDFMyObject // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 97fae7d0b74..e2042a9e9e7 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -110,14 +110,12 @@ class Mo extends CommonObject 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 2, 'position' => 1000, 'default' => '0', 'notnull' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '2' => 'InProgress', '3' => 'StatusMOProduced', '9' => 'Canceled')), 'fk_parent_line' => array('type' => 'integer:MoLine:mrp/class/mo.class.php', 'label' => 'ParentMo', 'enabled' => 1, 'visible' => 0, 'position' => 1020, 'default' => '0', 'notnull' => 0, 'index' => 1,'showoncombobox' => 0), ); + /** * @var int */ public $rowid; - /** - * @var int - */ - public $entity; + /** * @var string */ diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 839dbd763d5..6d189318a42 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024-2025 MDW * @@ -101,7 +101,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = (empty($conf->mrp->multidir_output[$object->entity]) ? $conf->mrp->dir_output : $conf->mrp->multidir_output[$object->entity])."/".$object->id; + $upload_dir = (empty($conf->mrp->multidir_output[$object->entity ?? $conf->entity]) ? $conf->mrp->dir_output : $conf->mrp->multidir_output[$object->entity ?? $conf->entity])."/".$object->id; } // Security check - Protection if external user diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 1f4baa53e25..2adaaa778e7 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -73,11 +73,6 @@ class MultiCurrency extends CommonObject */ public $name; - /** - * @var int The environment ID when using a multicompany module - */ - public $entity; - /** * @var mixed Sample property 2 */ diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 9aa92a9db70..50dfac2608d 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -125,18 +125,17 @@ class Partnership extends CommonObject 'ip' => array('type' => 'ip', 'label' => 'IPOfApplicant', 'enabled' => 1, 'position' => 74, 'notnull' => 0, 'visible' => -2,), 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'visible' => 2, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', 2 => 'Approved', 3 => 'Refused', 9 => 'Terminated'),), ); + /** * @var int */ public $rowid; + /** * @var string */ public $ref; - /** - * @var int - */ - public $entity; + /** * @var int */ diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 9375d37991c..65e57be9ee6 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -1,7 +1,7 @@ * Copyright (C) 2021 NextGestion - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +91,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->partnership->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->partnership->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissiontoread = $user->hasRight('partnership', 'read'); diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index 7ddb8c89566..4c247e3dcb0 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -1,7 +1,7 @@ * Copyright (C) 2021 NextGestion - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,7 +63,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->partnership->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->partnership->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissiontoread = $user->hasRight('partnership', 'read'); diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 4f0b4cbe4bd..5e2928cedca 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -267,8 +267,8 @@ class ActionsCardProduct if ($action == 'view') { // Photo $this->tpl['nblines'] = 4; - if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity])) { - $this->tpl['photos'] = $this->object->show_photos('product', $conf->product->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80); + if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity ?? 1])) { + $this->tpl['photos'] = $this->object->show_photos('product', $conf->product->multidir_output[$this->object->entity ?? 1], 1, 1, 0, 0, 0, 80); } // Nature diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 1baf3537cc9..ad19f8d373e 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -286,8 +286,8 @@ class ActionsCardService if ($action == 'view') { // Photo $this->tpl['nblines'] = 4; - if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity])) { - $this->tpl['photos'] = $this->object->show_photos('product', $conf->service->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80); + if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity ?? 1])) { + $this->tpl['photos'] = $this->object->show_photos('product', $conf->service->multidir_output[$this->object->entity ?? 1], 1, 1, 0, 0, 0, 80); } // Duration diff --git a/htdocs/product/card.php b/htdocs/product/card.php index aecb40b4263..d5ec04b349e 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -420,9 +420,9 @@ if (empty($reshook)) { if ($error) { // Move files from the dir of the third party to delete into the dir of the third party to keep - if (!empty($conf->product->multidir_output[$productOrigin->entity])) { - $srcdir = $conf->product->multidir_output[$productOrigin->entity]."/".$productOrigin->ref; - $destdir = $conf->product->multidir_output[$object->entity]."/".$object->ref; + if (!empty($conf->product->multidir_output[$productOrigin->entity ?? 1])) { + $srcdir = $conf->product->multidir_output[$productOrigin->entity ?? 1]."/".$productOrigin->ref; + $destdir = $conf->product->multidir_output[$object->entity ?? $conf->entity]."/".$object->ref; if (dol_is_dir($srcdir)) { $dirlist = dol_dir_list($srcdir, 'files', 1); @@ -3262,8 +3262,8 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { // Documents $objectref = dol_sanitizeFileName($object->ref); - if (!empty($conf->product->multidir_output[$object->entity])) { - $filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities + if (!empty($conf->product->multidir_output[$object->entity ?? $conf->entity])) { + $filedir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.$objectref; //Check repertories of current entities } else { $filedir = $conf->product->dir_output.'/'.$objectref; } @@ -3292,7 +3292,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { // Presend form $modelmail = 'product_send'; $defaulttopic = $object->label; - $diroutput = $conf->product->multidir_output[$object->entity]; + $diroutput = $conf->product->multidir_output[$object->entity ?? $conf->entity]; $trackid = 'prod' . $object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index be5dc7f0cd2..b211eb45224 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -61,11 +61,6 @@ class ProductCustomerPrice extends CommonObject */ public $table_element = 'product_customer_price'; - /** - * @var int Entity - */ - public $entity; - /** * @var string */ diff --git a/htdocs/product/document.php b/htdocs/product/document.php index ff75e6d3dc2..5d614a1ba3a 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -8,7 +8,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -97,16 +97,16 @@ if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); if (isModEnabled("product")) { - $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); + $upload_dir = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); } elseif (isModEnabled("service")) { - $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); + $upload_dir = $conf->service->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); } if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { // For backward compatibility, we scan also old dirs if (isModEnabled("product")) { - $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; + $upload_dirold = $conf->product->multidir_output[$object->entity ?? $conf->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; } else { - $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; + $upload_dirold = $conf->service->multidir_output[$object->entity ?? $conf->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos"; } } } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index f438b675cfe..5019089b4ea 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -117,11 +117,6 @@ class Inventory extends CommonObject */ public $ref; - /** - * @var int Entity - */ - public $entity; - /** * @var int ID */ diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 00e202cdbda..8dce61a9935 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1761,7 +1761,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['thumbnail']['checked'])) { $product_thumbnail_html = ''; if (!empty($product_static->entity)) { - $product_thumbnail = $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); + $product_thumbnail = $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity ?? $conf->entity], 1, 1, 0, 0, 0, 80); if ($product_static->nbphoto > 0) { $product_thumbnail_html = $product_thumbnail; } diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index e2960a673cc..f726667ad39 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -168,11 +168,6 @@ class Productlot extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000) ); - /** - * @var int Entity - */ - public $entity; - /** * @var int Product ID */ diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 3155aa02ef6..12478e42652 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2018 Laurent Destailleur * Copyright (C) 2018 All-3kcis * Copyright (C) 2021 Noé Cendrier - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * Copyright (C) 2025 MDW * @@ -109,7 +109,7 @@ if ($id || $ref) { $batch = $tmp[1]; } $object->fetch($id, $productid, $batch); - $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); + $upload_dir = $conf->productbatch->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); $filearray = dol_dir_list($upload_dir, "files"); } @@ -494,7 +494,7 @@ if ($action != 'presend') { if ($includedocgeneration) { $objref = dol_sanitizeFileName($object->ref); $relativepath = $object->id.'/'.$objref.'.pdf'; - $filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product_batch'); + $filedir = $conf->productbatch->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product_batch'); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $usercanread; // If you can read, you can build the PDF to read content $delallowed = $usercancreate; // If you can create/edit, you can remove a file on card diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 535d08f6cd4..020629d2ae0 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -8,7 +8,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018 All-3kcis - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -99,7 +99,7 @@ if ($id || $ref) { $object->fetch($id, $productid, $batch); if (isModEnabled('productbatch')) { - $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); + $upload_dir = $conf->productbatch->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); $filearray = dol_dir_list($upload_dir, "files"); } } diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index b9334955d53..e5c58143bc0 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -1,7 +1,7 @@ * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,7 +90,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = (!empty($conf->stocktransfer->multidir_output[$object->entity]) ? $conf->stocktransfer->multidir_output[$object->entity] : $conf->stocktransfer->dir_output)."/".$object->id; + $upload_dir = (!empty($conf->stocktransfer->multidir_output[$object->entity ?? $conf->entity]) ? $conf->stocktransfer->multidir_output[$object->entity ?? $conf->entity] : $conf->stocktransfer->dir_output)."/".$object->id; } $permissiontoread = $user->hasRight('stocktransfer', 'stocktransfer', 'read'); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_note.php b/htdocs/product/stock/stocktransfer/stocktransfer_note.php index fa641f8c124..7927fa3b7b6 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_note.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_note.php @@ -1,7 +1,7 @@ * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +62,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'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; } $permissionnote = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index aa369255f6e..a0310e7a8ab 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -479,7 +479,7 @@ if (empty($reshook)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); - $upload_dir = $conf->project->multidir_output[$object->entity]; + $upload_dir = $conf->project->multidir_output[$object->entity ?? $conf->entity]; $file = $upload_dir.'/'.GETPOST('file'); $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) { @@ -1797,7 +1797,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { * Generated documents */ $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $filedir = $conf->project->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = ($user->hasRight('projet', 'lire') && $userAccess > 0); $delallowed = ($user->hasRight('projet', 'creer') && $userWrite > 0); @@ -1825,7 +1825,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { $modelmail = 'project'; $defaulttopic = 'SendProjectRef'; $defaulttopiclang = 'projects'; - $diroutput = $conf->project->multidir_output[$object->entity]; + $diroutput = $conf->project->multidir_output[$object->entity ?? $conf->entity]; $autocopy = 'MAIN_MAIL_AUTOCOPY_PROJECT_TO'; // used to know the automatic BCC to add $trackid = 'proj'.$object->id; diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index e96fd4d9cca..867452ef92a 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Laurent Destailleur * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,7 +60,7 @@ if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($obj } if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->project->multidir_output[$object->entity ?? $conf->entity]."/".dol_sanitizeFileName($object->ref); } // Get parameters @@ -126,7 +126,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-project page-card_do $form = new Form($db); if ($object->id > 0) { - $upload_dir = $conf->project->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->project->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName($object->ref); // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index e2521410666..fbc5a7d1ba2 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1383,18 +1383,18 @@ foreach ($listofreferent as $key => $value) { $filename = dol_sanitizeFileName($element->ref); if (!empty($conf->$element_doc)) { $confelementdoc = $conf->$element_doc; - $filedir = $confelementdoc->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref); + $filedir = $confelementdoc->multidir_output[$element->entity ?? $conf->entity].'/'.dol_sanitizeFileName($element->ref); } else { $filedir = ''; } if ($element_doc === 'order_supplier') { $element_doc = 'commande_fournisseur'; - $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref); + $filedir = $conf->fournisseur->commande->multidir_output[$element->entity ?? $conf->entity].'/'.dol_sanitizeFileName($element->ref); } elseif ($element_doc === 'invoice_supplier') { $element_doc = 'facture_fournisseur'; $filename = get_exdir($element->id, 2, 0, 0, $element, 'invoice_supplier').dol_sanitizeFileName($element->ref); - $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].'/'.$filename; + $filedir = $conf->fournisseur->facture->multidir_output[$element->entity ?? $conf->entity].'/'.$filename; } print '
'; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 3dfbcdd395e..883f4923ed3 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -127,14 +127,12 @@ class RecruitmentCandidature extends CommonObject 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Received', 3 => 'ContractProposed', 5 => 'ContractSigned', 8 => 'Refused', 9 => 'Canceled')), "ip" => array("type" => "varchar(250)", "label" => "Ip", "enabled" => 1, 'position' => 700, 'notnull' => 0, "visible" => 0, "comment" => "ip used to create record (for public submission page)"), ); + /** * @var int */ public $rowid; - /** - * @var int - */ - public $entity; + /** * @var string */ diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index f6682fa59e4..4e2533d5e01 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -139,10 +139,6 @@ class RecruitmentJobPosition extends CommonObject * @var string ref */ public $ref; - /** - * @var int - */ - public $entity; /** * @var string label diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index fcbcb8b8d6e..ad20b5c74b8 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -9,7 +9,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -272,8 +272,8 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio // Set path to the background PDF File if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); @@ -755,8 +755,8 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a828699ceea..aacd04024b9 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -735,7 +735,7 @@ if (empty($reshook)) { } // Logo/Photo save - $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; + $dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if (GETPOST('deletephoto') && $object->logo) { $fileimg = $dir.'/'.$object->logo; @@ -930,7 +930,7 @@ if (empty($reshook)) { // Actions to build doc $id = $socid; - $upload_dir = !empty($conf->societe->multidir_output[$object->entity]) ? $conf->societe->multidir_output[$object->entity] : $conf->societe->dir_output; + $upload_dir = !empty($conf->societe->multidir_output[$object->entity ?? $conf->entity]) ? $conf->societe->multidir_output[$object->entity ?? $conf->entity] : $conf->societe->dir_output; $permissiontoadd = $user->hasRight('societe', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -3471,7 +3471,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio /* * Generated documents */ - $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id; + $filedir = $conf->societe->multidir_output[$object->entity ?? $conf->entity].'/'.$object->id; $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id; $genallowed = $user->hasRight('societe', 'lire'); $delallowed = $user->hasRight('societe', 'creer'); @@ -3512,7 +3512,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Presend form $modelmail = 'thirdparty'; $defaulttopic = 'Information'; - $diroutput = $conf->societe->multidir_output[$object->entity]; + $diroutput = $conf->societe->multidir_output[$object->entity ?? $conf->entity]; $trackid = 'thi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a0da7ae9db1..bc42d50d81e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -269,11 +269,6 @@ class Societe extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000), ); - /** - * @var int Entity - */ - public $entity; - /** * Thirdparty name * @var ?string diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 42ab5a876a8..242e2dd43f0 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,8 +85,8 @@ $object = new Societe($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); - $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; - $courrier_dir = $conf->societe->multidir_output[$object->entity]."/courrier/".get_exdir($object->id, 0, 0, 0, $object, 'thirdparty'); + $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/".$object->id; + $courrier_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]."/courrier/".get_exdir($object->id, 0, 0, 0, $object, 'thirdparty'); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 7c178c66dad..0437d0e581e 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -9,7 +9,7 @@ * Copyright (C) 2018-2023 Thibault FOUCART * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify @@ -538,14 +538,14 @@ if (empty($reshook)) { $action = 'builddoc'; $moreparams = array( 'use_companybankid' => GETPOST('companybankid'), - 'force_dir_output' => $conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName((string) $object->id) + 'force_dir_output' => $conf->societe->multidir_output[$object->entity ?? $conf->entity].'/'.dol_sanitizeFileName((string) $object->id) ); $_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php $_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php } $id = $socid; - $upload_dir = $conf->societe->multidir_output[$object->entity]; + $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; $id = $savid; @@ -1936,7 +1936,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' /* * Generated documents */ - $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id; + $filedir = $conf->societe->multidir_output[$object->entity ?? $conf->entity].'/'.$object->id; $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id; print $formfile->showdocuments('company', (string) $object->id, $filedir, $urlsource, $permissiontoread, (int) $permissiontoaddupdatepaymentinformation, $object->model_pdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, '', '', $object->default_lang); diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 5b9ee89ce7e..ddcbaea8615 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -7,7 +7,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -192,7 +192,7 @@ if (empty($reshook)) { // Mass actions $objectclass = 'WebsiteAccount'; $objectlabel = 'WebsiteAccount'; - $uploaddir = empty($conf->societe->multidir_output[$object->entity]) ? $conf->societe->dir_output : $conf->societe->multidir_output[$object->entity]; + $uploaddir = empty($conf->societe->multidir_output[$object->entity ?? $conf->entity]) ? $conf->societe->dir_output : $conf->societe->multidir_output[$object->entity ?? $conf->entity]; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index 09ce30defc5..687207bbc35 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +41,9 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { require '../../main.inc.php'; // Load $user and permissions } - +/** + * @var Conf $conf + */ $id = GETPOSTINT('id'); $w = GETPOSTINT('w'); $h = GETPOSTINT('h'); @@ -62,7 +65,7 @@ if ($query == "cat") { $object = new Categorie($db); $result = $object->fetch($id); - $upload_dir = $conf->categorie->multidir_output[$object->entity]; + $upload_dir = $conf->categorie->multidir_output[$object->entity ?? $conf->entity]; $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/"; $dir = $upload_dir.'/'.$pdir; @@ -83,7 +86,7 @@ if ($query == "cat") { $objProd = new Product($db); $objProd->fetch($id); - $image = $objProd->show_photos('product', $conf->product->multidir_output[$objProd->entity], 'small', 1); + $image = $objProd->show_photos('product', $conf->product->multidir_output[$objProd->entity ?? $conf->entity], 'small', 1); $match = array(); preg_match('@src="([^"]+)"@', $image, $match); diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index bb877291948..4b5726b1936 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -598,11 +598,11 @@ class Users extends DolibarrApi } if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && !empty(DolibarrApiAccess::$user->admin) && empty(DolibarrApiAccess::$user->entity)) { - $entity = (!empty($entity) ? $entity : $conf->entity); + $entity = (!empty($entity) ? (int) $entity : $conf->entity); } else { // When using API, action is done on entity of logged user because a user of entity X with permission to create user should not be able to // hack the security by giving himself permissions on another entity. - $entity = (DolibarrApiAccess::$user->entity > 0 ? DolibarrApiAccess::$user->entity : $conf->entity); + $entity = (((int) DolibarrApiAccess::$user->entity) > 0 ? (int) DolibarrApiAccess::$user->entity : $conf->entity); } $result = $this->useraccount->SetInGroup($group, $entity); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 5fa0a6a90ae..9f1b0759685 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -189,11 +189,6 @@ class User extends CommonObject */ public $api_key; - /** - * @var int Entity - */ - public $entity; - /** * @var string Clear password in memory */ diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 04f014d7133..442928a2d8c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Alexis Algoud * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Abbes Bahfir - * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2023-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -55,11 +55,6 @@ class UserGroup extends CommonObject */ public $picto = 'group'; - /** - * @var int Entity of group - */ - public $entity; - /** * @var string * @deprecated Use $name diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 1d0afa34a33..873f7d34d5d 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -115,7 +115,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); $object->loadRights(); - //$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ; + // $upload_dir = $conf->user->multidir_output[$object->entity ?? $conf->entity] . "/" . $object->id ; // For users, the upload_dir is always $conf->user->entity for the moment $upload_dir = $conf->user->dir_output."/".$object->id; } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 9751b464045..e9210d3c74d 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -57,11 +57,6 @@ class Website extends CommonObject */ public $picto = 'globe'; - /** - * @var int Entity - */ - public $entity; - /** * @var string Ref */ diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 715c12565d2..724ce4c5a68 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -190,11 +190,6 @@ class Hook extends CommonObject */ public $ref; - /** - * @var int Entity - */ - public $entity; - /** * @var string label */ From 686de5271a041deb9fcaa32a2d6cad25cf9ae82f Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Sun, 7 Sep 2025 18:12:00 -0600 Subject: [PATCH 11/13] Update admin.lib.php (#35246) Fix PHP Error: Undefined array key "login" (/admin/tools/listsessions.php:161) The error is triggered when the user name conatins '_' or '.' Co-authored-by: Laurent Destailleur --- htdocs/core/lib/admin.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 2ce1e930f89..ec10142eb4e 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1111,7 +1111,7 @@ function listOfSessions() $idsess = $tmp[1]; $regs = array(); $arrayofSessions[$idsess]["login"] = ''; - $loginfound = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs); + $loginfound = preg_match('/dol_login\|s:[0-9]+:"([^"]+)"/i', $sessValues, $regs); if ($loginfound) { $arrayofSessions[$idsess]["login"] = (string) $regs[1]; } From 6334fa5beae4b97eea09076874e7377fead21e6d Mon Sep 17 00:00:00 2001 From: R0ck3n <101400523+R0ck3n@users.noreply.github.com> Date: Mon, 8 Sep 2025 02:37:42 +0200 Subject: [PATCH 12/13] NEW: Add prepare() method to DoliDB class (rebuild) (#35249) * feat:prepared sql for mysqli and postgres * refactor:remove whitespace * Update DoliDB.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/db/DoliDB.class.php | 15 +++++++++++++++ htdocs/core/db/mysqli.class.php | 22 ++++++++++++++++++++++ htdocs/core/db/pgsql.class.php | 19 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 824e85a5e4d..73915025c6c 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -459,4 +459,19 @@ abstract class DoliDB implements Database return false; } + + /** + * Prepare a SQL statement for execution + * + * This method must be implemented by subclasses. + * + * @param string $sql SQL query to prepare + * @return mixed Driver-specific prepared statement object or false on failure + */ + public function prepare($sql) + { + $this->lasterror = 'prepare() not implemented for this driver. Failed to prepare '.$sql; + + return false; + } } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 27083e25e8a..72d713da892 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1294,6 +1294,28 @@ class DoliDBMysqli extends DoliDB return $result; } + + /** + * Prepare a SQL statement for execution + * + * @param string $sql SQL query to prepare + * @return false|mysqli_stmt + */ + public function prepare($sql) + { + if (!$this->connected) { + $this->lasterror = 'Not connected to database'; + return false; + } + $stmt = $this->db->prepare($sql); + if ($stmt === false) { + $this->lasterror = $this->db->error; + $this->lastqueryerror = $sql; + return false; + } + + return $stmt; + } } if (class_exists('mysqli')) { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 017d7e63061..d2f3f6ee8c8 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1512,4 +1512,23 @@ class DoliDBPgsql extends DoliDB return array(); } + + /** + * Prepare a SQL statement for execution (PostgreSQL prepared statement) + * + * @param string $sql The SQL query to prepare + * @return string|false The name of the prepared statement on success, or false on failure + */ + public function prepare($sql) + { + $stmtname = uniqid('dolipgstmt_'); // Generate a unique identifier for the statement + + $result = pg_prepare($this->db, $stmtname, $sql); + if (!$result) { + $this->lasterror = pg_last_error($this->db); + return false; + } + + return $stmtname; // We just return the name of the prepared statement + } } From 2d7579c6e2d64d93c0e200007bd147300efe001d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 11:05:10 +0200 Subject: [PATCH 13/13] Bump actions/setup-python from 5 to 6 (#35251) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 9e396472b35..ee546f3f7f2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -66,7 +66,7 @@ jobs: run: |- [ -r requirements.txt ] || [ -r pyproject.toml ] || touch requirements.txt # Install python and pre-commit tool - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: cache: pip python-version: "3.11"