From b567c2d0119032aa92b203f0d122401a3544ea2f Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Mon, 29 Sep 2025 15:14:30 +0200 Subject: [PATCH] Correction phpstan --- .../webportal/tpl/list-additional-filters.tpl.php | 3 ++- htdocs/public/webportal/tpl/list-filters.tpl.php | 3 ++- htdocs/public/webportal/tpl/list-footer.tpl.php | 3 ++- htdocs/public/webportal/tpl/list-lines.tpl.php | 3 ++- htdocs/public/webportal/tpl/list-nav.tpl.php | 3 ++- htdocs/public/webportal/tpl/list-titles.tpl.php | 1 + htdocs/public/webportal/tpl/list.tpl.php | 3 ++- .../webportal/class/html.formlistwebportal.class.php | 12 ++++++------ 8 files changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/public/webportal/tpl/list-additional-filters.tpl.php b/htdocs/public/webportal/tpl/list-additional-filters.tpl.php index 2d99e473215..58d0afaf9cc 100644 --- a/htdocs/public/webportal/tpl/list-additional-filters.tpl.php +++ b/htdocs/public/webportal/tpl/list-additional-filters.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf @@ -17,7 +18,7 @@ if (empty($context) || !is_object($context)) { * @var Controller $this * @var FormListWebPortal $formList */ -$formList = $this->formList; +$formList = &$this->formList; // Filters $moreforfilter = ''; diff --git a/htdocs/public/webportal/tpl/list-filters.tpl.php b/htdocs/public/webportal/tpl/list-filters.tpl.php index dc51e3c6991..1cd155f1c34 100644 --- a/htdocs/public/webportal/tpl/list-filters.tpl.php +++ b/htdocs/public/webportal/tpl/list-filters.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf @@ -17,7 +18,7 @@ if (empty($context) || !is_object($context)) { * @var Controller $this * @var FormListWebPortal $formList */ -$formList = $this->formList; +$formList = &$this->formList; ?> diff --git a/htdocs/public/webportal/tpl/list-footer.tpl.php b/htdocs/public/webportal/tpl/list-footer.tpl.php index 2d21e19cf2f..a564bba6ebb 100644 --- a/htdocs/public/webportal/tpl/list-footer.tpl.php +++ b/htdocs/public/webportal/tpl/list-footer.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf @@ -17,7 +18,7 @@ if (empty($context) || !is_object($context)) { * @var Controller $this * @var FormListWebPortal $formList */ -$formList = $this->formList; +$formList = &$this->formList; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $context); // Note that $action and $object may have been modified by hook diff --git a/htdocs/public/webportal/tpl/list-lines.tpl.php b/htdocs/public/webportal/tpl/list-lines.tpl.php index cd357ca71f0..1fb8a366f13 100644 --- a/htdocs/public/webportal/tpl/list-lines.tpl.php +++ b/htdocs/public/webportal/tpl/list-lines.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf @@ -17,7 +18,7 @@ if (empty($context) || !is_object($context)) { * @var Controller $this * @var FormListWebPortal $formList */ -$formList = $this->formList; +$formList = &$this->formList; if (!empty($formList->records)) { $totalarray = [ diff --git a/htdocs/public/webportal/tpl/list-nav.tpl.php b/htdocs/public/webportal/tpl/list-nav.tpl.php index 1341c39b98c..50635509987 100644 --- a/htdocs/public/webportal/tpl/list-nav.tpl.php +++ b/htdocs/public/webportal/tpl/list-nav.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf @@ -17,7 +18,7 @@ if (empty($context) || !is_object($context)) { * @var Controller $this * @var FormListWebPortal $formList */ -$formList = $this->formList; +$formList = &$this->formList; // Get nb pages $nbPages = 0; diff --git a/htdocs/public/webportal/tpl/list-titles.tpl.php b/htdocs/public/webportal/tpl/list-titles.tpl.php index df7e5c42be3..6d880e94c93 100644 --- a/htdocs/public/webportal/tpl/list-titles.tpl.php +++ b/htdocs/public/webportal/tpl/list-titles.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf diff --git a/htdocs/public/webportal/tpl/list.tpl.php b/htdocs/public/webportal/tpl/list.tpl.php index 3579cc4f421..e3f11c48ffd 100644 --- a/htdocs/public/webportal/tpl/list.tpl.php +++ b/htdocs/public/webportal/tpl/list.tpl.php @@ -8,6 +8,7 @@ if (empty($context) || !is_object($context)) { exit(1); } '@phan-var-force Context $context'; +'@phan-var-force Controller $this'; /** * @var Conf $conf @@ -17,7 +18,7 @@ if (empty($context) || !is_object($context)) { * @var Controller $this * @var FormListWebPortal $formList */ -$formList = $this->formList; +$formList = &$this->formList; ?> diff --git a/htdocs/webportal/class/html.formlistwebportal.class.php b/htdocs/webportal/class/html.formlistwebportal.class.php index dd40383a98b..eebbd50058c 100644 --- a/htdocs/webportal/class/html.formlistwebportal.class.php +++ b/htdocs/webportal/class/html.formlistwebportal.class.php @@ -116,7 +116,7 @@ class FormListWebPortal public $sortorder = ''; /** - * @var array,visible:int<0,1>,enabled:int<0,1>,position:int,help:string}> Array of fields + * @var array,visible:int<0,1>,enabled:bool|int<0,1>,position:int,help:string,searchmulti:int<0,1>}> Array of fields */ public $arrayfields = array(); /** @@ -128,7 +128,7 @@ class FormListWebPortal */ public $search_all = ''; /** - * @var array Fields for search all + * @var array Fields for search all */ public $fields_to_search_all = array(); /** @@ -221,7 +221,7 @@ class FormListWebPortal if (!$this->sortorder) { $this->sortorder = 'DESC'; } - $this->emptyValueKey = ($elementEn == 'order' ? -5 : -1); + $this->emptyValueKey = ($elementEn == 'order' ? "-5" : "-1"); // Sort object fields if (is_object($this->object)) { @@ -277,8 +277,8 @@ class FormListWebPortal } } $this->arrayfields['remain_to_pay'] = array('type' => 'price', 'label' => 'RemainderToPay', 'checked' => 1, 'enabled' => $this->element == 'invoice' && isModEnabled('facture'), 'visible' => 1, 'position' => 10000, 'help' => '',); - $this->arrayfields['download_link'] = array('label' => 'File', 'checked' => 1, 'enabled' => ($this->element == 'propal' && isModEnabled('propal')) || ($this->element == 'order' && isModEnabled('commande')) || ($this->element == 'invoice' && isModEnabled('facture')), 'visible' => 1, 'position' => 10001, 'help' => '',); - $this->arrayfields['signature_link'] = array('label' => 'Signature', 'checked' => 1, 'enabled' => $this->element == 'propal' && isModEnabled('propal') && getDolGlobalString("PROPOSAL_ALLOW_ONLINESIGN") != 0, 'visible' => 1, 'position' => 10002, 'help' => '',); + $this->arrayfields['download_link'] = array('type' => '', 'label' => 'File', 'checked' => 1, 'enabled' => ($this->element == 'propal' && isModEnabled('propal')) || ($this->element == 'order' && isModEnabled('commande')) || ($this->element == 'invoice' && isModEnabled('facture')), 'visible' => 1, 'position' => 10001, 'help' => '',); + $this->arrayfields['signature_link'] = array('type' => '', 'label' => 'Signature', 'checked' => 1, 'enabled' => $this->element == 'propal' && isModEnabled('propal') && getDolGlobalString("PROPOSAL_ALLOW_ONLINESIGN") != 0, 'visible' => 1, 'position' => 10002, 'help' => '',); if (method_exists($this->controller, 'listSetArrayFields')) { $this->controller->listSetArrayFields(); @@ -527,7 +527,7 @@ class FormListWebPortal $context = Context::getInstance(); $this->params = '&contextpage=' . urlencode($this->contextpage); - $this->params .= '&limit=' . urlencode($this->limit); + $this->params .= '&limit=' . $this->limit; foreach ($this->search as $key => $val) { if (is_array($val)) { foreach ($val as $skey) {