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) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Trouble with notify activity assignees
Pages: [1]

Author Topic: Trouble with notify activity assignees  (Read 895 times)

norman

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.14
  • MySQL version: 5.1.61-cll
  • PHP version: 5.3.10
Trouble with notify activity assignees
November 06, 2013, 04:44:25 am
Hi,

I'm having trouble with the notify activity assignee emails. I've turned the option on in the display preferences, and all my other mail functions work fine. When I create a new activity though, the send to assignee email is bouncing back as undeliverable - I've attached a copy of the email headers from the delivery failure notification in case it helps. The email address in the to field is not the address it should be sending to (it should be the same as the from field).

Thanks,
Norman


Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Trouble with notify activity assignees
December 10, 2013, 05:16:53 am
I'm seeing exactly the same issue with one of my sites.

Looks like the 'To:' address is not being correctly created by the script that is creating or sending the notification email. I'm using CiviCRM version 4.4.1. with Drupal 6.
Graham Mitchell
http://mc3.coop

irvken

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 1
Re: Trouble with notify activity assignees
January 15, 2014, 02:41:08 am
Yes, same here, although it was working fine previously, possibly caused by the upgrade to 4.4.1?

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Trouble with notify activity assignees
January 15, 2014, 09:03:21 am
Hi,

I've looked into this and it appears to have been broken during the database schema change for activity contacts in 4.4 . I tracked the problem down to this change in CRM/Activity/Form/Activity.php, function processActivity, between 4.3 and 4.4, around line 1150:

4.3.7:
      $assigneeContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activity->id, TRUE, FALSE);

4.4.1:
      $assigneeContacts = CRM_Activity_BAO_ActivityContact::getNames($activity->id, $assigneeID);

The difference is that CRM_Activity_BAO_ActivityAssignment::getAssigneeNames() has options to return an array of info per contact, including email, whereas CRM_Activity_BAO_ActivityContact::getNames() does not, it just returns contact names.

Luckily CRM_Activity_BAO_ActivityAssignment::getAssigneeNames() still exists in 4.4 (I checked 4.4.1 and 4.4.3) so I was able to revert the above change and this solved the problem.

I couldn't see an existing JIRA issue for this - seems surprising, as it's a large broken thing. Ah, the exact change that I made is in 4.4.3 .

Cheers,

Dave

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Trouble with notify activity assignees
January 15, 2014, 09:08:07 am
Many thanks davej for taking the time to track this down, and come up with a solution. I'll get on to that right away, as it has forced me to turn off activity notifications which I'd rather not do.
I guess it does need to be logged in an issue, or otherwise the problem could just continue into future versions.
Graham Mitchell
http://mc3.coop

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Trouble with notify activity assignees
January 15, 2014, 09:14:35 am
Hi Graham,

Quote from: Upperholme on January 15, 2014, 09:08:07 am
I guess it does need to be logged in an issue, or otherwise the problem could just continue into future versions.

As I say, it has been fixed in 4.4.3, I discovered by comparing CRM/Activity/Form/Activity.php in 4.4.1 versus 4.4.3 . So the change is evidently in the current code base but I haven't ascertained whether this is linked to a JIRA issue.

Cheers,

Dave

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Trouble with notify activity assignees
January 16, 2014, 12:15:39 am
Apologies for the confusion. For me the problem became apparent in a site that is running 4.4.3, but on Drupal 6. I implemented the change you have described, but on my site the activity notification is still not being sent correctly.
I guess there must be other differences between the D6 and D7 versions.

Not sure who/how to notify about D6 specific issues these days?
Graham Mitchell
http://mc3.coop

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Trouble with notify activity assignees
January 16, 2014, 02:45:12 am
Hi Graham,

Quote from: Upperholme on January 16, 2014, 12:15:39 am
Apologies for the confusion. For me the problem became apparent in a site that is running 4.4.3, but on Drupal 6. I implemented the change you have described, but on my site the activity notification is still not being sent correctly.
I guess there must be other differences between the D6 and D7 versions.

Not sure who/how to notify about D6 specific issues these days?

Ah, your post above said the affected site was "CiviCRM version 4.4.1. with Drupal 6."

I believe all of the CRM/ directory should be the same between the D6 & D7 versions. I've just downloaded civicrm-4.4.3-drupal6.tar.gz and civicrm-4.4.3-drupal.tar.gz , untar'd and compared the CRM directories and they're identical.

Could you post the lines following the comment, "// send copy to assignee contacts.CRM-4509" in your CRM/Activity/Form/Activity.php ? The version in my freshly untarred civicrm-4.4.3-drupal6.tar.gz has this, lines 1141 - 1157:

Code: [Select]
    // send copy to assignee contacts.CRM-4509
    $mailStatus = '';

    if (!CRM_Utils_Array::crmIsEmptyArray($params['assignee_contact_id']) &&
      CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
        'activity_assignee_notification'
      )
    ) {
      $mailToContacts = array();
      $assigneeContacts = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($activity->id, TRUE, FALSE);

      //build an associative array with unique email addresses.
      foreach ($activityAssigned as $id => $dnc) {
        if (isset($id) && array_key_exists($id, $assigneeContacts)) {
          $mailToContacts[$assigneeContacts[$id]['email']] = $assigneeContacts[$id];
        }
      }
Cheers,

Dave J


norman

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.14
  • MySQL version: 5.1.61-cll
  • PHP version: 5.3.10
Re: Trouble with notify activity assignees
January 16, 2014, 03:44:57 am
Wonderful! Thank you Davej, that's fixed it for me
  :D

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Trouble with notify activity assignees
January 16, 2014, 06:28:29 am
My error, many apologies.

If you are interested in the comedy of errors, here's what happened:

1. We saw the error occurring back in December, prompting my earlier post.

2. In the interim I turned off the notification option to stop the creation of annoying undeliverable messages.

3. I later upgraded the site  to 4.4.3.

4. When I saw your solution posted, I actually misread it, and edited the file, effectively reverting it back to the old (broken) version. Of course, in order to test it I had to turn notifications back on, which I duly did, created a test actiivty and hey presto, saw the error occurring.

Those of you brighter than me will already have spotted from the above chain of events that at no point did I test 4.4.3 to see if it had resolved the issue (which of course we now know it did). Whoops.

So, re-editing the file back to its original state, and ensuring that activity notifications are switched on, I am happily able to confirm that it all works fine.

Thanks again for your help on this.
Graham Mitchell
http://mc3.coop

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Trouble with notify activity assignees

This forum was archived on 2017-11-26.