diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index fc8177a2993..4be8ad3bf8d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2017 Rui Strecht * Copyright (C) 2018-2024 Ferran Marcet - * Copyright (C) 2024 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 @@ -1909,7 +1909,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { $sql .= ", ".MAIN_DB_PREFIX."contrat as o"; } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) - && ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre']))) // @phan-suppress-curren-line PhanTypeInvalidDimOffset + && ((!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref'])) || (!empty($filterobj->fields['label']) && is_array($filterobj->fields['label'])) || (!empty($filterobj->fields['titre']) && is_array($filterobj->fields['titre']))) // @phan-suppress-current-line PhanTypeInvalidDimOffset && $filterobj->table_element && $filterobj->element) { $sql .= ", ".MAIN_DB_PREFIX.$filterobj->table_element." as o"; } diff --git a/htdocs/core/lib/customreports.lib.php b/htdocs/core/lib/customreports.lib.php index 574faafeabb..621b0dfd093 100644 --- a/htdocs/core/lib/customreports.lib.php +++ b/htdocs/core/lib/customreports.lib.php @@ -1,8 +1,8 @@ * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 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 * the Free Software Foundation; either version 3 of the License, or @@ -110,8 +110,11 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu if (!empty($object->isextrafieldmanaged) && isset($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || (int) dol_eval((string) $extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) { - // @phan-suppress-next-line PhanTypeMismatchDimAssignment - $position = (!empty($val['position']) ? $val['position'] : 0); + if (isset($extrafields->attributes[$object->table_element]['pos'][$key])) { + $position = $extrafields->attributes[$object->table_element]['pos'][$key]; + } else { + $position = 0; + } $arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-sum'] = array( 'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' ('.$langs->trans("Sum").')', 'labelnohtml' => $labelofobject.': '.$langs->trans($val),