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

Used Api to get financial account for an entity defined in civicrm_en… #10130

Merged
merged 1 commit into from
Apr 12, 2017

Conversation

pradpnayak
Copy link
Contributor

…tity_financial_account table

Copy link
Contributor

@eileenmcnaughton eileenmcnaughton left a comment

Choose a reason for hiding this comment

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

I agree in principle with these changes. I think it's a tidy up. I made a couple of suggestions. In addition it still needs a careful code-readthrough just looking for errors at the line level (spelling, right params etc.) This probably a 10-15 minute job and I'm happy for it to be done internally within JMA since it's just a fresh-pair of eyes thing

NULL,
'account_relationship'
);
public static function getRelationalFinancialAccount($entityId, $accountRelationType, $entityTable = 'civicrm_financial_type') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see any instance where $entityTable is passed in - should we remove this var?

Also - we should probably cache the values to Civi::statics - I think there are examples in CRM_Core_Pseudoconsant

@monishdeb monishdeb force-pushed the codeCleanup branch 2 times, most recently from d470004 to d59649c Compare April 12, 2017 07:07
'account_relationship.name' => $accountRelationType,
'entity_table' => 'civicrm_financial_type',
'entity_id' => $entityId,
));
Copy link
Member

@monishdeb monishdeb Apr 12, 2017

Choose a reason for hiding this comment

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

@eileenmcnaughton I have removed the 3rd parameter that was representing entity_table. However, using Civi::$statics won't be applicable here because of dynamic factor $entityId currently looking at the examples at CRM_Core_Pseudoconstant most of them support level 2 combination list. But in this case, it need to support level 3 combination e.g. Civi::$statics[__CLASS__][$entityID][$accountRelationType][$financialAccountID] instead of 2 level combination Civi::$statics[__CLASS__][$accountRelationType][$financialAccountID]. So that will be huge 3 level combination to store in cache

Copy link
Contributor

Choose a reason for hiding this comment

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

ok - that's fine - the statics can hold an array of arrays but the parameter was bothering me more - people are motivated to fix performance issues if they matter but bad code signatures get copied & pasted....

Happy for this to be merged

Copy link
Member

@monishdeb monishdeb Apr 12, 2017

Choose a reason for hiding this comment

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

Sorry, my earlier comment wasn't finished. Just updated it.

@monishdeb
Copy link
Member

@eileenmcnaughton the test build passed. Can you merge it?

@eileenmcnaughton eileenmcnaughton merged commit 7fa7be7 into civicrm:master Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants