From 4ce325fadb3a47529d0e764eddd57ea017bf9666 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2024 14:11:54 +0100 Subject: [PATCH] Fix phpstan --- htdocs/webportal/class/controller.class.php | 12 +++++++----- htdocs/webportal/class/html.formwebportal.class.php | 2 +- .../controllers/default.controller.class.php | 6 ++++-- .../controllers/document.controller.class.php | 6 ++++-- .../controllers/invoicelist.controller.class.php | 6 ++++-- .../webportal/controllers/login.controller.class.php | 6 ++++-- .../controllers/membercard.controller.class.php | 6 ++++-- .../controllers/orderlist.controller.class.php | 6 ++++-- .../controllers/partnershipcard.controller.class.php | 6 ++++-- .../controllers/propallist.controller.class.php | 6 ++++-- 10 files changed, 40 insertions(+), 22 deletions(-) diff --git a/htdocs/webportal/class/controller.class.php b/htdocs/webportal/class/controller.class.php index 566ae0887cb..6c2c0aed3b3 100644 --- a/htdocs/webportal/class/controller.class.php +++ b/htdocs/webportal/class/controller.class.php @@ -54,11 +54,13 @@ class Controller * Action method is called before html output * can be used to manage security and change context * - * @return int Return integer < 0 on error, 0 on success, 1 to replace standard code + * @return int Return integer < 0 on error, > 0 on success */ public function action() { - return $this->hookDoAction(); + $resHook = $this->hookDoAction(); + + return ($resHook < 0 ? -1 : 1); } /** @@ -119,7 +121,7 @@ class Controller * Execute hook doActions * * @param array $parameters Parameters - * @return int Return integer < 0 on error, 0 on success, 1 to replace standard code + * @return int Return integer < 0 on error, 0 on success, 1 to replace standard code */ public function hookDoAction($parameters = array()) { @@ -142,7 +144,7 @@ class Controller * Execute hook PrintPageView * * @param array $parameters Parameters - * @return int Return integer < 0 on error, 0 on success, 1 to replace standard code + * @return int Return integer < 0 on error, 0 on success, 1 to replace standard code */ public function hookPrintPageView($parameters = array()) { @@ -170,7 +172,7 @@ class Controller */ public function loadTemplate($templateName, $vars = false) { - global $conf, $langs, $hookmanager, $db; // load for tpl + global $conf, $langs, $hookmanager, $db; // may be used into the tpl $context = Context::getInstance(); // load for tpl diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index d7f12bc735e..863e4ba20c6 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -699,7 +699,7 @@ class FormWebPortal extends Form if ($type == 'datetime') { //$moreparam .= ' step="1"'; to show seconds - $out .= ' ' . $this->inputType('time', $htmlName . '_time', $valueTime, $htmlName . '_time', $morecss, $moreparam); + $out .= ' ' . $this->inputType('time', $htmlName.'_time', $valueTime, $htmlId, $morecss, $moreparam); } break; diff --git a/htdocs/webportal/controllers/default.controller.class.php b/htdocs/webportal/controllers/default.controller.class.php index 9f06d3bb7d8..9d448bf5779 100644 --- a/htdocs/webportal/controllers/default.controller.class.php +++ b/htdocs/webportal/controllers/default.controller.class.php @@ -21,14 +21,14 @@ class DefaultController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { global $langs; $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } $hookRes = $this->hookDoAction(); @@ -37,6 +37,8 @@ class DefaultController extends Controller $context->desc = $langs->trans('WebPortalHomeDesc'); //$context->doNotDisplayHeaderBar=1;// hide default header } + + return 1; } /** diff --git a/htdocs/webportal/controllers/document.controller.class.php b/htdocs/webportal/controllers/document.controller.class.php index 0532b2fc218..dbaf007c6b3 100644 --- a/htdocs/webportal/controllers/document.controller.class.php +++ b/htdocs/webportal/controllers/document.controller.class.php @@ -240,13 +240,13 @@ class DocumentController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } //$context = Context::getInstance(); @@ -255,6 +255,8 @@ class DocumentController extends Controller //$context->doNotDisplayHeaderBar=1;// hide default header $this->init(); + + return 1; } /** diff --git a/htdocs/webportal/controllers/invoicelist.controller.class.php b/htdocs/webportal/controllers/invoicelist.controller.class.php index cf23cc1c3af..a58b5be7cb4 100644 --- a/htdocs/webportal/controllers/invoicelist.controller.class.php +++ b/htdocs/webportal/controllers/invoicelist.controller.class.php @@ -49,7 +49,7 @@ class InvoiceListController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { @@ -57,7 +57,7 @@ class InvoiceListController extends Controller $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } dol_include_once('/webportal/class/html.formlistwebportal.class.php'); @@ -80,6 +80,8 @@ class InvoiceListController extends Controller } $this->formList = $formListWebPortal; + + return 1; } /** diff --git a/htdocs/webportal/controllers/login.controller.class.php b/htdocs/webportal/controllers/login.controller.class.php index 11f8469a331..9c0eeafaa2b 100644 --- a/htdocs/webportal/controllers/login.controller.class.php +++ b/htdocs/webportal/controllers/login.controller.class.php @@ -21,14 +21,14 @@ class LoginController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { global $langs; $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } $hookRes = $this->hookDoAction(); @@ -37,6 +37,8 @@ class LoginController extends Controller $context->desc = $langs->trans('WebPortalHomeDesc'); //$context->doNotDisplayHeaderBar=1;// hide default header } + + return 1; } /** diff --git a/htdocs/webportal/controllers/membercard.controller.class.php b/htdocs/webportal/controllers/membercard.controller.class.php index 7f32ed68e8f..a984d66f1bb 100644 --- a/htdocs/webportal/controllers/membercard.controller.class.php +++ b/htdocs/webportal/controllers/membercard.controller.class.php @@ -52,7 +52,7 @@ class MemberCardController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { @@ -60,7 +60,7 @@ class MemberCardController extends Controller $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } // Load translation files required by the page @@ -87,6 +87,8 @@ class MemberCardController extends Controller } $this->formCard = $formCardWebPortal; + + return 1; } /** diff --git a/htdocs/webportal/controllers/orderlist.controller.class.php b/htdocs/webportal/controllers/orderlist.controller.class.php index 47ea0d821b1..204f00db2ba 100644 --- a/htdocs/webportal/controllers/orderlist.controller.class.php +++ b/htdocs/webportal/controllers/orderlist.controller.class.php @@ -51,7 +51,7 @@ class OrderListController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { @@ -59,7 +59,7 @@ class OrderListController extends Controller $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } // Load translation files required by the page @@ -80,6 +80,8 @@ class OrderListController extends Controller } $this->formList = $formListWebPortal; + + return 1; } /** diff --git a/htdocs/webportal/controllers/partnershipcard.controller.class.php b/htdocs/webportal/controllers/partnershipcard.controller.class.php index a402fe4a54d..42a44a57d4e 100644 --- a/htdocs/webportal/controllers/partnershipcard.controller.class.php +++ b/htdocs/webportal/controllers/partnershipcard.controller.class.php @@ -52,7 +52,7 @@ class PartnershipCardController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { @@ -60,7 +60,7 @@ class PartnershipCardController extends Controller $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } // Load translation files required by the page @@ -87,6 +87,8 @@ class PartnershipCardController extends Controller } $this->formCard = $formCardWebPortal; + + return 1; } /** diff --git a/htdocs/webportal/controllers/propallist.controller.class.php b/htdocs/webportal/controllers/propallist.controller.class.php index 692d192ff6a..533327a42b6 100644 --- a/htdocs/webportal/controllers/propallist.controller.class.php +++ b/htdocs/webportal/controllers/propallist.controller.class.php @@ -51,7 +51,7 @@ class PropalListController extends Controller * Action method is called before html output * can be used to manage security and change context * - * @return void + * @return int Return integer < 0 on error, > 0 on success */ public function action() { @@ -59,7 +59,7 @@ class PropalListController extends Controller $context = Context::getInstance(); if (!$context->controllerInstance->checkAccess()) { - return; + return -1; } // Load translation files required by the page @@ -83,6 +83,8 @@ class PropalListController extends Controller } $this->formList = $formListWebPortal; + + return 1; } /**