Author Topic: Activity report restricted to current user  (Read 2440 times)

Offline lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1533
  • Karma: 105
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Activity report restricted to current user
« on: February 10, 2010, 06:56:46 pm »
Is their any way to "tokenize" some of the report filter criteria. I'd like to create an activity report for the dashboard that only shows the logged in user's activities, instead of all activities. So basically using the "source contact name" field, with a criteria of current user.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Offline Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3992
  • Karma: 120
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activity report restricted to current user
« Reply #1 on: February 12, 2010, 12:49:28 am »
Quote
Is their any way to "tokenize" some of the report filter criteria. I'd like to create an activity report for the dashboard that only shows the logged in user's activities, instead of all activities.
Currently I don't think it is possible to do this.

Quote
So basically using the "source contact name" field, with a criteria of current user.

I guess better solution would be add checkbox
  • Logged in User as a filter.


Kurund
Found this reply helpful? Support CiviCRM

Offline lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1533
  • Karma: 105
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Activity report restricted to current user
« Reply #2 on: February 27, 2010, 05:47:34 pm »
Kurund,

I've made some mods to the activity report that lets you restrict the list of activities to the current user (it filters across all three contact uses -- contact/assigned/target). You probably can make some improvements to it.

I haven't played much with the reports, but found the structure somewhat limiting. It seems that the way the filter arrays are built are really designed for a fixed structure: field / operand / value

In this case, what I really wanted to do was create a checkbox field (doesn't look like there's an option for checkbox in CRM_Report_Form) that could trigger a custom WHERE clause (i.e. look for the current id across those three values). I figured out a workaround, but think there probably should be the capability for a little more flexibility.

Either that or I'm not looking in the right place.  ::)

-Brian
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Offline Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3992
  • Karma: 120
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activity report restricted to current user
« Reply #3 on: February 28, 2010, 01:28:48 am »
Can you file an issue with your patch. We will check and fix the patch if needed.

Kurund
Found this reply helpful? Support CiviCRM

Offline lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1533
  • Karma: 105
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Activity report restricted to current user
« Reply #4 on: March 01, 2010, 07:51:08 am »
http://issues.civicrm.org/jira/browse/CRM-5902

I also notice that in this report, it only shows one assigned contact -- even if the activity was assigned to multiple people. I am taking a look at that, but it may be something you'll want to look at as well.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Offline Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3992
  • Karma: 120
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activity report restricted to current user
« Reply #5 on: March 01, 2010, 09:56:40 am »
Since this patch might involve fair amount of rework I am afraid you will have to wait till 3.3 :(

Thanks,

Kurund
Found this reply helpful? Support CiviCRM

Offline lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1533
  • Karma: 105
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Activity report restricted to current user
« Reply #6 on: March 01, 2010, 10:06:56 am »
you mean the inclusion of multiple assigned contacts?

i only defined the Jira issue to address filtering by the current logged in user -- which is working fine (though you'll want to review). i'd suggest separating them into two issues if the multiple-assigned will take longer.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Offline YMNathaniel

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 1
Re: Activity report restricted to current user
« Reply #7 on: March 15, 2010, 07:57:46 am »
Has this been separated into 2 separate issues as suggested, or any additional steps taken at implementing? I'm also interested in this functionality.

Offline YMNathaniel

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 1
Re: Activity report restricted to current user
« Reply #8 on: March 15, 2010, 08:10:18 am »

Offline kmitz

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 2
Re: Activity report restricted to current user
« Reply #9 on: April 21, 2010, 06:40:00 pm »
Hey,

I'm assuming that this is for CRM/Report/Form/Activity.php...when I modified this, it didn't change the default Activity dashlet, but instead changed the customized Activity report I set up (with the checkbox checked to allow use as a dashlet -- follow me??).

I'd like to change the default Activity dashlet...any idea which file to hack?  This is difficult to determine when using AJAX.

CRM/Dashlet/Page/Activity.php doesn't seem to be the one, either.

Thanks,

kmitz

Offline lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1533
  • Karma: 105
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Activity report restricted to current user
« Reply #10 on: April 22, 2010, 03:23:09 am »
you're right -- the mod was to the report, which could be used as a dashlet.

the standard dashlet is handled by: CRM/Dashlet/Selector/Activity.php

this is a bit of a hack, but if you comment out lines 66-67

Code: [Select]
/*$admin = CRM_Core_Permission::check( 'view all activities' ) ||
                 CRM_Core_Permission::check( 'administer CiviCRM' );*/

it will indicate the user is only permissioned to view their own activities. if you're using drupal, you could change the permissions for the user. but i'm assuming you want the users to access and edit all activities -- but just have their own activities display on the dashboard
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

Offline kmitz

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 2
Re: Activity report restricted to current user
« Reply #11 on: April 22, 2010, 07:03:03 am »
Quote
i'm assuming you want the users to access and edit all activities -- but just have their own activities display on the dashboard

Quite correct.  Thanks for the quick reply.

Offline naseem_sarwar

  • I’m new here
  • *
  • Posts: 23
  • Karma: 0
  • CiviCRM version: civivrm version 4
  • CMS version: drupal 7
  • MySQL version: mysql 5+
  • PHP version: php version 5+
Re: Activity report restricted to current user
« Reply #12 on: September 28, 2011, 07:06:31 am »
Hi,

can anybody help me to implement that. i have checked the thread and it is quite old one. and i am assuming that must be added in the civicrm. but i am not sure this feature is added in version 4. as i am using drupal 7 for development. any pointer how can i implement that ll be great and much appreciated.

Thanks
Naseem Sarwar

Offline Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3992
  • Karma: 120
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Activity report restricted to current user
« Reply #13 on: October 04, 2011, 03:37:16 am »
Naseem,

What's your CiviCRM version? This fix is part of 4.0.x release

Kurund
Found this reply helpful? Support CiviCRM

Offline naseem_sarwar

  • I’m new here
  • *
  • Posts: 23
  • Karma: 0
  • CiviCRM version: civivrm version 4
  • CMS version: drupal 7
  • MySQL version: mysql 5+
  • PHP version: php version 5+
Re: Activity report restricted to current user
« Reply #14 on: October 04, 2011, 07:56:58 am »
Hi kurund,

i am using 4.0.5 version and the filters i am getting are in the attached image. i put the limit to current user 'yes' but still it is showing all the activities on every user account.
i dont know may be i am missing something. might be simpler but i am couldnt figure this out. please help...

thanks