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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Tailoring the 'notify activity assignee' function
Pages: [1]

Author Topic: Tailoring the 'notify activity assignee' function  (Read 1451 times)

nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
Tailoring the 'notify activity assignee' function
November 20, 2013, 07:49:32 am
I'm working on a use case to provide calendar (in this case Outlook) entries for assigned scheduled activities. I've read a couple of threads on the forum from two or three years ago where people discussed development of Outlook integration tools for Civi, and even totten's blog post about activity calendars from 2011, and the drupal module "CiviCRM activities iCalendar feed". But none of them seem to have made it to production status.

I know that I can turn on 'notify activity assignee' in the site configuration, but this strikes me as a very heavy-handed approach - there's no finer-grained configuration to say that it should apply only to certain activity types, or to activites linked to particular cases, or suchlike, and I can imagine complaints from users if we turn it on for every possible assigned activity - especially since some of our activities are ways of recording past events and are assigned to contacts we certainly don't want to send emails to.

Is there any ongoing work around calendar integration, activity scheduling and the like? Is there even an agreed idea of the 'right way' to approach this? I'd appreciate any thoughts.

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: Tailoring the 'notify activity assignee' function
November 20, 2013, 08:11:20 am

might want to chat with petednz on forums/irc and see if u'll can combine efforts. He recently was interested in making the activity assignee email less heavy handed and trigger it off activity type

recurring activities / events have been on the plate for some time, i suspect they will be added in the next 6-24 months

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

nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
Re: Tailoring the 'notify activity assignee' function
December 06, 2013, 09:26:02 am
Talked it over with petednz. He's keen but hasn't got any actual progress to date.

I've got an approach sketched out, and I wondered if anyone had any feedback before I get the work done.

I've considered, and decided against, a full-blown 'Advanced Case Management' extension, which would take some of the xml parsing away and replace with database/GUI configurations. It feels like the right thing to do in the long run, but added a level of complexity that I'm just not comfortable with as a novice civi hacker. Instead I've fallen back onto extending the use of the XML configuration file. But if anyone is thinking of attempting such a thing, count me in!

What I initially planned was in three parts:

An additional global preference alongside activity_assignee_notification and activity_assignee_notification_ics which would store a flag to indicate if activity assignee notification is managed in the case configuration on a per-casetype basis. Call it activity_assignee_notification_casemanaged if you like. This needs a change to /CRM/Admin/Form/Preferences/Display.php and the relevant template, but the data can be written to the database in the standard way.

An additional setting in each case type's XML configuration file, constructed in a similar way to the 'RedactActivityEmail' setting in the generic Settings.xml file, which can be parsed using new functions in /CRM/Case/XMLProcessor/Process.php.

And an alteration in the logic in /CRM/Activity/Form/Activity.php (the processActivity function) such that notifications are sent out EITHER in the case of global activity_assignee_notification flag being on OR in the case of activity__assignee_notification_casemanaged being on and the specific case type in question having the necessary flag set to 1 in the xml.


However, having thought it through a bit more, we decided we're going to implement locally only the second an third parts of this (in other words, the processActivity function will look for the xml setting in the case type definition). That way we get the functionality we need, but there's no messing with the global configuration - this enhancement degrades gracefully, in that it continues to respect the global setting if it is turned on, but in cases where the global setting is turned off, the presence of case type specific setting in the case type xml file will result in notifications being sent out.

We will probably also tailor the templates for the email and the ics attachment, but that's cosmetic, and site-specific.

So, how does that sound? Right idea, or barking up the wrong tree?

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Tailoring the 'notify activity assignee' function
February 21, 2014, 03:00:03 pm
stumbled on this old post and wondered if Nick had anything to update
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

FrTommy

  • I post frequently
  • ***
  • Posts: 273
  • Karma: 2
  • CiviCRM version: 4.5.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5.32
  • PHP version: 5.3
Re: Tailoring the 'notify activity assignee' function
February 22, 2014, 12:35:29 pm
what about just adding a checkbox to the create new activity screen to notify the assignee?

lesley

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 1
Re: Tailoring the 'notify activity assignee' function
February 22, 2014, 06:54:07 pm
I'm very interested in this functionality for a couple of clients - one using outlook the other using google calendar.
This could possibly be a deal maker with the outlook users in which case I might be able to provide some $$$ especially if I can get outlook email syncing with civi as well.

I'm not sure if it ties in with this extension which apparently works in 4.4 :
https://drupal.org/project/civicrm_activity_ical

Could someone enlighten me?

many thanks
Lesley


nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
Re: Tailoring the 'notify activity assignee' function
March 04, 2014, 06:53:21 am
Well, we did pretty much what I described.

We modified CRM/Case/Form/Activity.php and CRM/Case/XMLProcessor/Process.php to create new functions to check in the case definition xml file to see if case-specific settings for 'Notifications' and 'Notifications with Ical attachment' are turned on.

We modified CRM/Case/BAO/Case.php to pass a few more variables through to the template in the $tplParams array, and then modified templates/CRM/Activity/Calendar/ICal.tpl to ensure that the 'end time' of the activity was based on the activity start time plus the activity duration (by default, the iCal attachment sets both start time and end time to be the activity time.

We also edited CRM/Activity/BAO/ICalendar.php so that the iCal attachment could be rendered inline rather than as an attachment. This just helps at the Outlook end of the process and means the appointments transfer 'automatically' to the users' calendar without them having to accept the invite.

The format of the email, including the subject line (and hence the 'subject' of the appointment in the Outlook calendar) is determined by a CiviCRM template - which is stored in the database and managed through the GUI not through the file system, which means we had to edit the template in the admin pages: Administer >> Message Templates >> System workflow messages >> Cases - send copy of an activity

We used smarty templating in the subject line as so...

Code: [Select]
{if $caseType}[{$caseType}] - {/if}{$activityType} - {if $caseType eq 'GRAPHIC 2'} {$activityClient} {crmAPI var='lab' entity='CustomField' action='get' sequential='0' label=$smarty.const.CIVI_FIELD_G2_LAB_ID}  {crmAPI var='pat' entity='CustomField' action='get' sequential='0' label=$smarty.const.CIVI_FIELD_G2_PAT_ID} {crmAPI var='fam' entity='CustomField' action='get' sequential='0' label=$smarty.const.CIVI_FIELD_G2_FAM_ID}  {assign var=labId value=$lab.id} {assign var=patId value=$pat.id} {assign var=famId value=$fam.id}  {crmAPI var='caseCustomData' entity='CustomValue' action='get' sequential='0' entity_id=$caseId entity_table='Case'}  ( LAB ID: {$caseCustomData.values.$labId.latest} ,  FAMILY ID: {$caseCustomData.values.$famId.latest} ) {/if} {if $activityMedium}: {$activityMedium}{/if}

.. which looks horrific, but results in the subject of the email (and thus the appointment itself) having the target contact's name, and some useful custom data as well.

There are limitations - our implementation doesn't handle amended appointment times very well, occassionally creating duplicate entries. But for our purposes it allows us to populate an Outlook 2003 calendar with activities set up in CiviCRM, and that's what we needed.

Our implementation doesn't tie in with the drupal module you linked to - that looks good, but our users are on such an old version of Outlook (and behind a very previous firewall) that they couldn't access an iCal feed, as such but needed the activities emailing to them individually.

Would there be value in packaging this up in some way? I don't feel like it is 'finished' enough to be released, but it 'works' well enough for our one use case, so we won't be developing it any further for now. I can supply diffs of all the customised files if someone would find them helpful.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Tailoring the 'notify activity assignee' function

This forum was archived on 2017-11-26.