Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #9602 - ProspectLists save function has a duplication issue #9642

Conversation

eojedapilchik
Copy link
Contributor

The $focus->save() call inside \modules\ProspectLists\Save.php on line 79 is unnecessary.
If there are any after_save logic hooks present on the Prospect List (Target List) module, it will trigger them twice for a target list that is being duplicated, causing undesired results.

Description

This fix is related to this issue: https://github.com/salesagility/SuiteCRM/issues/9602

When a Target List is duplicated there's a check on the \modules\ProspectLists\Save.php that handles adding related records to the Target List being duplicated.
On line 79 of the Save.php there's a call that is redundant to the save method of the focus bean. This causes any after_save logic hook to be triggered twice which is undesirable.

Motivation and Context

This solves redundant after_save logic hooks being triggered on a Target List being duplicated.

How To Test This

  1. Create an after_save logic hook on the Target List module.
  2. Add a $GLOBALS['log']->fatal('After save Triggered') or any other logic to the after_save logic hook.
  3. Create a Target List.
  4. On Edit View > Duplicate the target list created in the previous step.
  5. Check that the after_save was triggered only once.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • I have read the How to Contribute guidelines.

@SuiteBot
Copy link

SuiteBot commented Jul 7, 2022

CLA assistant check
All committers have signed the CLA.

@jack7anderson7
Copy link
Contributor

Hi @eojedapilchik,

Thanks for your Pull Request.

Could you please update the commit message following the standards shown in our documentation:
https://docs.suitecrm.com/community/contributing-code/bugs/

Thanks,
Jack

@eojedapilchik
Copy link
Contributor Author

Amended the commit message here: 0733b4a

@serhiisamko091184
Copy link
Contributor

Hello, @eojedapilchik

thanks for contribution,

Would you be so kind also to squash commits in your branch into one (it means to combine multiple commits into single commit)?

Thanks in advance,
Serhii

@serhiisamko091184 serhiisamko091184 added the Status: Requires Updates Issues & PRs which requires input or update from the author label Feb 23, 2023
@eojedapilchik eojedapilchik force-pushed the fix/9602_duplicate_prospectlists_duplication branch from 13f6b30 to aacdba8 Compare February 24, 2023 10:46
@eojedapilchik
Copy link
Contributor Author

eojedapilchik commented Feb 24, 2023

@serhiisamko091184 I updated the branch to use only 1 commit, let me know if there's any other requirement to merge it

@eojedapilchik eojedapilchik changed the title Remove save function in prospecti_list save Fix #9602 - ProspectLists save function has a duplication issue Feb 24, 2023
@serhiisamko091184 serhiisamko091184 added Status: Requires Code Review Needs the core team to code review Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Branch:Hotfix and removed Status: Requires Updates Issues & PRs which requires input or update from the author labels Feb 24, 2023
… issue

The save function is unnecessary and create a duplication of ater_save hooks on duplicate records
@eojedapilchik eojedapilchik force-pushed the fix/9602_duplicate_prospectlists_duplication branch from aacdba8 to 44ee83a Compare February 25, 2023 08:01
Copy link
Contributor

@clemente-raposo clemente-raposo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clemente-raposo clemente-raposo added Status: Requires Testing Requires Manual Testing Status: Passed Code Review Mark issue has passed code review reviewed and removed Status: Requires Code Review Needs the core team to code review labels Mar 20, 2023
Copy link
Contributor

@johnM2401 johnM2401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Target List Logic Hook now only fires once on Duplication

Also fires once on Normal Creation, (either through Create Action, or through Campaigns Module->Target Lists creation)

Users able to relate items as normal.

Can be merged!

@johnM2401 johnM2401 added Status: Passed Testing and removed Status: Requires Testing Requires Manual Testing labels Mar 31, 2023
@jack7anderson7 jack7anderson7 merged commit 0a4c400 into salesagility:hotfix Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Branch:Hotfix Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Status: Passed Code Review Mark issue has passed code review reviewed Status: Passed Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants