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

[ready-for-core-team-review]CRM-19804, added pre and post hook invokation for FinancialAccount #9584

Merged
merged 1 commit into from
Dec 30, 2016

Conversation

pradpnayak
Copy link
Contributor


----------------------------------------
* CRM-19804: Pre() and Post() hook for Financial Account
  https://issues.civicrm.org/jira/browse/CRM-19804
$op = 'create';
if (!empty($params['id'])) {
$op = 'edit';
}
Copy link
Member

Choose a reason for hiding this comment

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

@pradpnayak isn't this a repetition? I mean can we not initialise the $op parameter once ? and need optimisation
$op = empty($params['id']) ? 'create' : 'edit';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think one can change the $params values in pre hook i.e they might unset($params['id']) when $op == 'edit' which will end up creating new entry in db rather update and hence post hook should invoke as $op == 'create'.

$op = empty($params['id']) ? 'create' : 'edit';
I was told by one of member from core team in past to use if () condition rather ternary operators. If this pattern is allowed i happy to optimize it and use it in future :)

Copy link
Member

Choose a reason for hiding this comment

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

ahh yes .. u're right

@pradpnayak pradpnayak changed the title CRM-19804, added pre and post hook invokation for FinancialAccount [ready-for-core-team-review]CRM-19804, added pre and post hook invokation for FinancialAccount Dec 28, 2016
Copy link
Contributor

@jitendrapurohit jitendrapurohit left a comment

Choose a reason for hiding this comment

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

tested, pre and post hook are working correctly.

@monishdeb monishdeb merged commit f859f6b into civicrm:master Dec 30, 2016
@pradpnayak pradpnayak deleted the CRM-19804 branch February 22, 2017 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants