CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Hide contributions in Activity History for users without CiviContribute access
Pages: [1]

Author Topic: Hide contributions in Activity History for users without CiviContribute access  (Read 1686 times)

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Hide contributions in Activity History for users without CiviContribute access
October 17, 2010, 12:12:17 am
Currently, if I'm an authenticated user, but am NOT in any "Role" that has "Access CiviContribute" checked, I can still see contributions if I go into a contacts activity history. The "Contribution" tab is not visible, but the contributions are still visible if I go to the "Activities" tab! I hacked the source code and wrote a quick and dirty fix to not show contributions under activity history at all, but it's "security by obscurity" and not really a true fix. It also gets blown away every time I do an upgrade. Would be nice to get this cleaned up such that only those who are a member of a group that has "Access CiviContribute" checked can see contributions under the activity tab!

The quick (and I did say "dirty", right?) fix, for those interested is to add:
{if $row.activity_type NEQ "Contribution"}
between line 52, which reads:
{foreach from=$rows item=row}
and line 53, which reads:
<tr class="{cycle values="odd-row,even-row"} {$row.class}">
of templates/CRM/Activity/Selector/Activity.tpl:

Then you'll need a corresponding {/if} between line 109 and line 110

The above line numbers are relevant to civicrm 3.1.4!
Cheers,
Marty.
P.s. I thought I had submitted this a year or two back, but couldn't find it in a search - apologies if you've seen the request in the past.....

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Hide contributions in Activity History for users without CiviContribute access
October 17, 2010, 08:00:46 am

ideally we should do this filtering in the activity selector / queries. Would be great if you can take a look at:

CRM/Activity/BAO/Activity.php and add the necessary filter to the function: getActivitySQLClause

a related issue (though relatively new) will be to filter these activities out of the new activity search

activity types now have a component id associated with them which should make the query a bit easier (i think)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Re: Hide contributions in Activity History for users without CiviContribute access
October 18, 2010, 07:11:28 pm
OK, I'll take a look when I get a chance. Brings up some interesting questions/issues though:
1. Should we hide ALL contributions from all users in the activity tab, or just hide them from people who don't have that role associated?
2. Hiding contributions screws up the activity record count. The number on the tab will say, for example, 10, but there might only be 7 visible records, as 3 of the contribution records are hidden! I'm guessing if we fix this at the selector/query level as you suggested, then it may automatically fix the count - not sure how the count is determined?? When I originally put my quick and dirty fix in place, I added some text to the page that displays the activity summary that said something like "...There are X number of activity records for this person, but they may not all be visible in this summary" (or something like that anyway). Not really a great solution....

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Hide contributions in Activity History for users without CiviContribute access
October 18, 2010, 07:50:54 pm

fixing the underlying SQL will fix both the count and the listing

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Hide contributions in Activity History for users without CiviContribute access

This forum was archived on 2017-11-26.