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

CRM-21852-Membership report failure fix #11948

Closed
wants to merge 2 commits into from

Conversation

seenu4043
Copy link

Overview

Membership detail report error when ACL used (disable view all contacts)

Before

When a restricted user accesses the Membership Detail Form, an error is thrown.
image
After

When a restricted user accesses the Membership Detail Form, the report should be displayed.
image

Technical Details

buildACLClause has been used twice so I Just commented one as it's taking care in buildQuery, also buildPermissionClause has been used as it overriding buildQuery since buildQuery is deprecated(see in code)

Comments

As this is the fist time am writing code for Civicrm so I would appreciate if you could provide me feedback to improve myself better

@civicrm-builder
Copy link

Can one of the admins verify this patch?

@seamuslee001
Copy link
Contributor

Jenkins ok to test

@eileenmcnaughton
Copy link
Contributor

Great first PR - nice clear PR explanation with images.

Jenkins has reported some style warnings - which are probably whitespace issues - see https://www.drupal.org/docs/develop/standards/coding-standards for the drupal standards which we follow

2 questions

  1. why did you move a line in the parent class
  2. is the postProcess() function now similar enough to the parent function that we could just remove the whole function?

@seenu4043
Copy link
Author

@eileenmcnaughton

  1. why did you move a line in the parent class
    because buildPermissionClause Override output from buildACLClause,
    is the postProcess() function now similar enough to the parent function that we could just remove the whole function?
    No it doesn't,I actually tried to remove the whole postProcess code and use parent postprocess, apparently it doesn't work, sounds like we need build query function.

I will re-write the code for style issue and resubmit it.

@seenu4043
Copy link
Author

https://issues.civicrm.org/jira/browse/CRM-21852, JIRA ticket number, fyi

@eileenmcnaughton
Copy link
Contributor

@seenu4043 I just did some tests. This works but it works for me without moving the

$this->buildPermissionClause();
  • which is a change that is making me a little nervous

It also worked for me if I just removed this

  public function postProcess() {

    $this->beginPostProcess();

    // get the acl clauses built before we assemble the query
    $this->buildACLClause($this->_aliases['civicrm_contact']);
    $sql = $this->buildQuery(TRUE);

    $rows = array();
    $this->buildRows($sql, $rows);

    $this->formatDisplay($rows);
    $this->doTemplateAssignment($rows);
    $this->endPostProcess($rows);
  }

From CRM_Report_Form_Member_Detail - I'm wondering why that didn't work for you?

(removing redundant code is the nicest fix :-)

@eileenmcnaughton
Copy link
Contributor

@seenu4043 did you see above - just wanting to understand why removing the whole function didn't work for you? I'm a bit uncomfortable with the re-ordering

@eileenmcnaughton eileenmcnaughton changed the title CRM-6181-Membership report failure fix CRM-21852-Membership report failure fix Apr 16, 2018
@eileenmcnaughton
Copy link
Contributor

Closing as Seamus reviewed alternate fix & now merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants