After_Save Hook on Prospect Lists is executed twice #9602
Labels
Priority:Important
Issues & PRs that are important; broken functions, errors - there are workarounds
Type: Bug
Bugs within the core SuiteCRM codebase
Issue
Creating an after save hook on ProspectLists (Target List) will run twice. The after_save logic hook will be executed before the Save on the
modules\ProspectLists\Save.php
which calls the save() method (on line 79) of the focus (prospect list) triggering the after_save hook again.Expected Behavior
The after_save hook is called after the save() method of the bean has been executed and no other save() method is being called.
Actual Behavior
The current sequence is save() -> after_save hooks -> save -> after_save hooks (again).
If an after_save hook is created any logic there will be executed twice, causing side effects.
Possible Fix
Remove the
$focus->save();
on line 79 ofmodules\ProspectLists\Save.php
and change the way the relationship are handle on that file (line 76 :$focus->set_relationship('prospect_lists_prospects', $rel, true);
)Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: