2
0
forked from Wavyzz/dolibarr

Fix Phan notices introduced since 30/12/2024

This commit is contained in:
MDW
2025-01-13 20:04:35 +01:00
parent 4707d29f0a
commit 7150af31dc
50 changed files with 407 additions and 142 deletions

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
@@ -409,21 +410,21 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$position = (empty($val['position']) ? 0 : intval($val['position']));
$arrayofgroupby[$tablealias.'.'.$key.'-year'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)).'.1',
'table' => $object->table_element,
'tablefromt' => $tablepath
);
$arrayofgroupby[$tablealias.'.'.$key.'-month'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)).'.2',
'table' => $object->table_element,
'tablefromt' => $tablepath
);
$arrayofgroupby[$tablealias.'.'.$key.'-day'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)).'.3',
'table' => $object->table_element,
@@ -432,7 +433,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
} else {
$position = (empty($val['position']) ? 0 : intval($val['position']));
$arrayofgroupby[$tablealias.'.'.$key] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']),
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)),
'table' => $object->table_element,
@@ -455,14 +456,14 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('timestamp', 'date', 'datetime'))) {
$position = (empty($extrafields->attributes[$object->table_element]['pos'][$key]) ? 0 : intval($extrafields->attributes[$object->table_element]['pos'][$key]));
$arrayofgroupby[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-year'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val),
'position' => ($position + ($count * 100000)).'.1',
'table' => $object->table_element,
'tablefromt' => $tablepath
);
$arrayofgroupby[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-month'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val),
'position' => ($position + ($count * 100000)).'.2',
'table' => $object->table_element,
@@ -570,7 +571,7 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof
$position = (empty($val['position']) ? 0 : intval($val['position']));
$arrayoffields[$tablealias.'.'.$key] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']),
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)),
'table' => $object->table_element,

View File

@@ -495,6 +495,7 @@ function getEntity($element, $shared = 1, $currentobject = null)
'currentobject' => $currentobject,
'out' => $out
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('hookGetEntity', $parameters, $currentobject, $action); // Note that $action and $object may have been modified by some hooks
if (is_numeric($reshook)) {
@@ -11309,6 +11310,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
// No need to make a return $head. Var is modified as a reference
if (!empty($hookmanager)) {
$parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head, 'filterorigmodule' => $filterorigmodule);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('completeTabsHead', $parameters, $object);
if ($reshook > 0) { // Hook ask to replace completely the array
$head = $hookmanager->resArray;

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
@@ -14,7 +15,7 @@
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2023-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@@ -454,6 +455,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
if (is_object($hookmanager)) {
$parameters = array('sourcecompany' => &$sourcecompany, 'targetcompany' => &$targetcompany, 'targetcontact' => &$targetcontact, 'outputlangs' => $outputlangs, 'mode' => $mode, 'usecontact' => $usecontact);
$action = '';
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('pdf_build_address', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$stringaddress .= $hookmanager->resPrint;
}
@@ -2678,7 +2680,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
$reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys
} elseif ($reshook>0) {
} elseif ($reshook > 0) {
// The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook.
$linkedobjects = $hookmanager->resArray;
}