Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
bb852592
Commit
bb852592
authored
10 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Restore broken feature. One hook = One call of function per module.
parent
c51b964b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/core/class/hookmanager.class.php
+2
-4
2 additions, 4 deletions
htdocs/core/class/hookmanager.class.php
with
2 additions
and
4 deletions
htdocs/core/class/hookmanager.class.php
+
2
−
4
View file @
bb852592
...
...
@@ -157,8 +157,6 @@ class HookManager
{
if
(
!
empty
(
$modules
))
{
$modulealreadyexecuted
[
$context
]
=
array
();
// Filter by context
foreach
(
$modules
as
$module
=>
$actionclassinstance
)
{
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n";
...
...
@@ -167,8 +165,8 @@ class HookManager
// jump to next class if method does not exists
if
(
!
method_exists
(
$actionclassinstance
,
$method
))
continue
;
// test to avoid to run twice a hook, when a module implements several active contexts
if
(
in_array
(
$module
,
$modulealreadyexecuted
[
$context
]
))
continue
;
$modulealreadyexecuted
[
$
context
][
$
module
]
=
$module
;
// Use the $currentcontext in method for avoid to run twice
if
(
in_array
(
$module
,
$modulealreadyexecuted
))
continue
;
$modulealreadyexecuted
[
$module
]
=
$module
;
// Use the $currentcontext in method for avoid to run twice
// Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
$parameters
[
'currentcontext'
]
=
$context
;
// Hooks that must return int (hooks with type 'addreplace')
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment