From c4dd6be9f8685107242f10dfe11c5039980aec66 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 21 Sep 2021 18:47:34 +0200 Subject: [PATCH 1/6] Add showdocument hook --- htdocs/core/class/html.formfile.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 591fb5ed2d1..a21ef8e3305 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -391,6 +391,20 @@ class FormFile global $langs, $conf, $user, $hookmanager; global $form; + $reshook = 0; + if (is_object($hookmanager)){ + $parameters = array(); ++ $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + // May report error + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + } + // Remode default action if $reskook > 0 + if ($reshook > 0) { + return ''; + } + if (!is_object($form)) { $form = new Form($this->db); } From 12be914d049f6f59c2735796305178f4056765cb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 21 Sep 2021 16:49:00 +0000 Subject: [PATCH 2/6] Fixing style errors. --- htdocs/core/class/html.formfile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a21ef8e3305..d0d3717a1f1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -392,13 +392,13 @@ class FormFile global $form; $reshook = 0; - if (is_object($hookmanager)){ + if (is_object($hookmanager)) { $parameters = array(); -+ $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } + } } // Remode default action if $reskook > 0 if ($reshook > 0) { From fd911ff36fc1c76468e152aab95d943881f67a59 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:15:54 +0200 Subject: [PATCH 3/6] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0d3717a1f1..f6f977d3058 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -394,7 +394,7 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { $parameters = array(); - + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 73b0d8079cae433cd04db9a7c41bb088fbad77c2 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 21 Sep 2021 22:23:14 +0200 Subject: [PATCH 4/6] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0d3717a1f1..8b954cc3d3a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -393,8 +393,26 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { - $parameters = array(); - + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); + $parameters = array( + 'modulepart'=>&$modulepart, + 'modulesubdir'=>&$modulesubdir, + 'filedir'=>&$filedir, + 'urlsource'=>&$urlsource, + 'genallowed'=>&$genallowed, + 'delallowed'=>&$delallowed, + 'modelselected'=>&$modelselected, + 'allowgenifempty'=>&$allowgenifempty, + 'forcenomultilang'=>&$forcenomultilang, + 'noform'=>&$noform, + 'param'=>&$param, + 'title'=>&$title, + 'buttonlabel'=>&$buttonlabel, + 'codelang'=>&$codelang, + 'morepicto'=>&$morepicto, + 'hideifempty'=>&$hideifempty, + 'removeaction'=>&$removeaction + ); + $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // Note that parameters may have been updated by hook // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 49fd1b761cff315d592efd04ed7f2c3b8be29928 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 21 Sep 2021 20:27:33 +0000 Subject: [PATCH 5/6] Fixing style errors. --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8b954cc3d3a..2e58c845e6b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -394,7 +394,7 @@ class FormFile $reshook = 0; if (is_object($hookmanager)) { $parameters = array( - 'modulepart'=>&$modulepart, + 'modulepart'=>&$modulepart, 'modulesubdir'=>&$modulesubdir, 'filedir'=>&$filedir, 'urlsource'=>&$urlsource, From 2f6a4fa04a908b1045eb6b3d8cc4523249b213ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Oct 2021 19:20:37 +0200 Subject: [PATCH 6/6] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2e58c845e6b..e7a8beee681 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -412,7 +412,7 @@ class FormFile 'hideifempty'=>&$hideifempty, 'removeaction'=>&$removeaction ); - $reshook = $hookmanager->executeHooks('showdocuments', $parameters, $object); // Note that parameters may have been updated by hook + $reshook = $hookmanager->executeHooks('showDocuments', $parameters, $object); // Note that parameters may have been updated by hook // May report error if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -420,7 +420,7 @@ class FormFile } // Remode default action if $reskook > 0 if ($reshook > 0) { - return ''; + return $hookmanager->resPrint; } if (!is_object($form)) {