<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
$activityContact = new CRM_Activity_DAO_ActivityContact();
$activityContact->copyValues($params);
- return $activityContact->save();
+ if (!$activityContact->find(TRUE)) {
+ return $activityContact->save();
+ }
+ return $activityContact;
}
/**
* function to retrieve names of contact by activity_id
*
- * @param int $id ID of the activity
- * @param string $type type of interaction
+ * @param $activityID
+ * @param $recordTypeID
+ * @param bool $alsoIDs
+ *
+ * @internal param int $id ID of the activity
+ * @internal param string $type type of interaction
*
* @return array
*
* @access public
- *
*/
static function getNames($activityID, $recordTypeID, $alsoIDs = FALSE) {
$names = array();
}
/**
- * function to retrieve id of target contact by activity_id
+ * function to retrieve id of target contact by activity_id
*
- * @param int $id ID of the activity
+ * @param $activityID
+ * @param $recordTypeID
+ *
+ * @internal param int $id ID of the activity
*
* @return mixed
*
* @access public
- *
*/
static function retrieveContactIdsByActivityId($activityID, $recordTypeID) {
$activityContact = array();
FROM civicrm_activity_contact
INNER JOIN civicrm_contact ON contact_id = civicrm_contact.id
WHERE activity_id = %1
-AND record_type_id = %2
-AND civicrm_contact.is_deleted = 0
+AND record_type_id = %2
+AND civicrm_contact.is_deleted = 0
";
$params = array(
1 => array($activityID, 'Integer'),
return $activityContact;
}
+ function links() {
+ $link = array('activity_id' => 'civicrm_activity:id');
+ return $link;
+ }
}