From a023c83c326d9280104f44e1300a25b197f6ec19 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Thu, 7 Mar 2024 17:36:00 +0100 Subject: [PATCH] #1756 [Hook] fix: fatal typage formObjectOptions --- class/actions_digiquali.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/class/actions_digiquali.class.php b/class/actions_digiquali.class.php index 3d2fd62f..832ed656 100644 --- a/class/actions_digiquali.class.php +++ b/class/actions_digiquali.class.php @@ -241,11 +241,12 @@ public function printCommonFooter($parameters) /** * Overloading the formObjectOptions function : replacing the parent's function with the one below * - * @param array $parameters Hook metadata (context, etc...) - * @param object $object Object - * @return void + * @param array $parameters Hook metadatas (context, etc...) + * @param object|null $object Current object + * @return int 0 < on error, 0 on success, 1 to replace standard code */ - public function formObjectOptions(array $parameters, object $object) { + public function formObjectOptions(array $parameters, ?object $object): int + { if (strpos($parameters['context'], 'productlotcard') !== false) { $objectData = ['type' => $object->element, 'id' => $object->id]; @@ -257,6 +258,8 @@ public function formObjectOptions(array $parameters, object $object) { $object->updateExtrafield('control_history_link'); } } + + return 0; // or return 1 to replace standard code } /**