avatar kaitlyn2004 Jul 3. 2009. 8:35 am
This blew my mind... surely I'm missing something!


So I'm the project leader... I automatically get subscribed to tickets. So does the person who created it.

Well if it gets assigned to a 3rd party, the creator and myself are subscribed... but not the assignee? That makes no sense!

Tell me I'm missing some setting....
avatar Ilija Studen Staff Jul 3. 2009. 8:55 am
When ticket, tasks or milestone are created, assignees are also automatically subscribed to it, as well as project leader and person who creates the task are. This does not work when you re-assign task, ticket or milestone. In that case, you'll need to make the changes to subscribers manually. Also, assignees can unsubscribe if they want later on.

More about email notifications can be found here: Email Notifications.
avatar kaitlyn2004 Jul 3. 2009. 8:59 am
Ah... well 99% of our tickets are unassigned (and then later assigned)...


It's annoying enough to reassign... but to have to subscribe them as well?

Can this please be changed? I'm not sure how it makes sense in the logic to subscribe an initial assignee but not a reassignee...
avatar Ilija Studen Staff Jul 3. 2009. 9:49 am
Thanks, we'll consider it for one of the upcoming releases.
avatar cbtrussell Pro Jul 7. 2009. 10:49 am
Add me to the list of users who think this is a must have! :)
avatar Ilija Studen Staff Aug 7. 2009. 9:00 am
This feature will be part of one of the future releases (can't guarantee which), In the meantime, here is how you can get this to work on your server:

1. Open /activecollab/application/modules/resources/models/subscriptions/Subscriptions.class.php, find subscribeUsers() method and replace it with this code:

/**
 * Subscribe array of users to the object
 * 
 * If $replace is set to true, all subscriptions for this object will be 
 * dropped and $users will be subscribed to it
 *
 * @param array $users
 * @param ProjectObject $object
 * @param boolean $replace
 * @return boolean
 */
function subscribeUsers($users, $object, $replace = true) {
  db_begin_work();
  
  $object_id = (integer) $object->getId();
  if($object_id) {
    $subscriptions_table = TABLE_PREFIX . 'subscriptions';
    
    if($replace) {
      Subscriptions::deleteByParent($object); // cleanup
    } // if
  
    $to_subscribe = array();
    if(is_foreachable($users)) {
      foreach($users as $user) {
        if(instance_of($user, 'User')) {
          $user_id = (integer) $user->getId();
        } else {
          $user_id = (integer) $user;
        } // if
        
        if($user_id) {
          if(isset($to_subscribe[$user_id])) {
            continue; // duplicate user ID!
          } else {
            if(!$replace && array_var(db_execute_one("SELECT COUNT(*) AS 'row_count' FROM $subscriptions_table WHERE user_id = ? AND parent_id = ?", $user_id, $object_id), 'row_count') > 0) {
              continue; // Make sure that we do not have this user already subscribed
            } // if
            
            cache_remove("user_subscriptions_$user_id");
            $to_subscribe[$user_id] = "($user_id, $object_id)";
          } // if
        } // if
      } // foreach
    } // if
    
    // Insert subscriptions
    if(is_foreachable($to_subscribe)) {
      $insert = db_execute("INSERT INTO $subscriptions_table VALUES " . implode(', ', $to_subscribe));
      
      if(!$insert || is_error($insert)) {
        db_rollback();
        return $insert;
      } // if
    } // if
  } // if
  
  db_commit();
  return true;
} // subscribeUsers


2. Open ProjectObject.class.php (it's in /activecollab/application/modules/system/models/project_objects folder), find this block of code:

// Clean up assignments cache
clean_assignments_cache();

// Check if object is reassigned
if(!$is_new) {


and replace it with:

// Clean up assignments cache
clean_assignments_cache();

// Make sure that all assignees are subscribed
Subscriptions::subscribeUsers($assignees, $this, false);

// Check if object is reassigned
if(!$is_new) {


Please note, this is experimental. I did some tests - it works as expected, but you'll be using this hack at your own risk. If you notice anything unusual, please let us know so we can provide the fix.
avatar kaitlyn2004 Aug 7. 2009. 9:01 am
Ilija - This is fantastic news. Thanks a lot
avatar kaitlyn2004 Aug 7. 2009. 9:10 am
I'm getting an error "Query failed with message 'Unknown column 'object_id' in 'where clause''"

SELECT COUNT(*) AS 'row_count' FROM ac_subscriptions WHERE user_id = '14' AND object_id = '3305'


I'm on v2.1
avatar kaitlyn2004 Aug 7. 2009. 9:17 am
I've changed the query to read parent_id. I assume you've just renamed this column in a more recent version. Appears to work now with parent_id - but please let me know if it's not quite the case. (parent_id changed to object_id)
avatar Ilija Studen Staff Aug 7. 2009. 9:20 am
Yes, it should be parent_id instead of object_id. Sorry about that, a minor mistype before committing to the repository :(
or Go To Next Page