$this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, $cid);
$this->assign('openreport', $full_open_report);
- $click_thru_report = CRM_Mailing_Event_BAO_MailingEventClickThrough::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
+ $click_thru_report = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
$this->assign('clickreport', $click_thru_report);
}
'class' => 'CRM_Mailing_DAO_MailingGroup',
'table' => 'civicrm_mailing_group',
],
- 'CRM_Mailing_DAO_TrackableURL' => [
- 'name' => 'TrackableURL',
- 'class' => 'CRM_Mailing_DAO_TrackableURL',
+ 'CRM_Mailing_DAO_MailingTrackableURL' => [
+ 'name' => 'MailingTrackableURL',
+ 'class' => 'CRM_Mailing_DAO_MailingTrackableURL',
'table' => 'civicrm_mailing_trackable_url',
],
'CRM_Mailing_DAO_MailingJob' => [
'class' => 'CRM_Mailing_Event_DAO_MailingEventReply',
'table' => 'civicrm_mailing_event_reply',
],
- 'CRM_Mailing_Event_DAO_MailingEventClickThrough' => [
- 'name' => 'MailingEventClickThrough',
- 'class' => 'CRM_Mailing_Event_DAO_MailingEventClickThrough',
+ 'CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen' => [
+ 'name' => 'MailingEventTrackableURLOpen',
+ 'class' => 'CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen',
'table' => 'civicrm_mailing_event_trackable_url_open',
],
'CRM_Mailing_Event_DAO_MailingEventUnsubscribe' => [
if ($this->url_tracking && !empty($this->id)) {
// ensure that Google CSS and any .css files are not tracked.
if (!(strpos($token, 'css?family') || strpos($token, '.css'))) {
- $data = CRM_Mailing_BAO_TrackableURL::getTrackerURL($token, $this->id, $event_queue_id);
+ $data = CRM_Mailing_BAO_MailingTrackableURL::getTrackerURL($token, $this->id, $event_queue_id);
if (!empty($html)) {
$data = htmlentities($data, ENT_NOQUOTES);
}
'unsubscribe' => CRM_Mailing_Event_BAO_MailingEventUnsubscribe::getTableName(),
'bounce' => CRM_Mailing_Event_BAO_MailingEventBounce::getTableName(),
'forward' => CRM_Mailing_Event_BAO_MailingEventForward::getTableName(),
- 'url' => CRM_Mailing_BAO_TrackableURL::getTableName(),
- 'urlopen' => CRM_Mailing_Event_BAO_MailingEventClickThrough::getTableName(),
+ 'url' => CRM_Mailing_BAO_MailingTrackableURL::getTableName(),
+ 'urlopen' => CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTableName(),
'component' => CRM_Mailing_BAO_MailingComponent::getTableName(),
'spool' => CRM_Mailing_BAO_Spool::getTableName(),
];
//CRM-12814
if (!empty($mailings)) {
$openCounts = CRM_Mailing_Event_BAO_MailingEventOpened::getMailingContactCount(array_keys($mailings), $params['contact_id']);
- $clickCounts = CRM_Mailing_Event_BAO_MailingEventClickThrough::getMailingContactCount(array_keys($mailings), $params['contact_id']);
+ $clickCounts = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getMailingContactCount(array_keys($mailings), $params['contact_id']);
}
// format params and add links
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+class CRM_Mailing_BAO_MailingTrackableURL extends CRM_Mailing_DAO_MailingTrackableURL {
+
+ /**
+ * Given a url, mailing id and queue event id, find or construct a
+ * trackable url and redirect url.
+ *
+ * @param string $url
+ * The target url to track.
+ * @param int $mailing_id
+ * The id of the mailing.
+ * @param int $queue_id
+ * The queue event id (contact clicking through).
+ *
+ * @return string
+ * The redirect/tracking url
+ */
+ public static function getTrackerURL($url, $mailing_id, $queue_id) {
+ if (strpos($url, '{') !== FALSE) {
+ return self::getTrackerURLForUrlWithTokens($url, $mailing_id, $queue_id);
+ }
+ else {
+ return self::getBasicTrackerURL($url, $mailing_id, $queue_id);
+ }
+ }
+
+ private static function getBasicTrackerURL($url, $mailing_id, $queue_id) {
+ static $urlCache = [];
+
+ if (array_key_exists($mailing_id . $url, $urlCache)) {
+ return $urlCache[$mailing_id . $url] . "&qid=$queue_id";
+ }
+
+ // hack for basic CRM-1014 and CRM-1151 and CRM-3492 compliance:
+ // let's not replace possible image URLs, CiviMail URLs or internal anchor URLs
+ if (preg_match('/\.(png|jpg|jpeg|gif|css)[\'"]?$/i', $url)
+ or substr_count($url, 'civicrm/extern/')
+ or substr_count($url, 'civicrm/mailing/')
+ or ($url[0] === '#')
+ ) {
+ // let's not cache these, so they don't get &qid= appended to them
+ return $url;
+ }
+ else {
+
+ $hrefExists = FALSE;
+
+ $tracker = new CRM_Mailing_BAO_MailingTrackableURL();
+ if (preg_match('/^href/i', $url)) {
+ $url = preg_replace('/^href[ ]*=[ ]*[\'"](.*?)[\'"]$/i', '$1', $url);
+ $hrefExists = TRUE;
+ }
+
+ $tracker->url = $url;
+ $tracker->mailing_id = $mailing_id;
+
+ if (!$tracker->find(TRUE)) {
+ $tracker->save();
+ }
+ $id = $tracker->id;
+
+ $redirect = CRM_Utils_System::externUrl('extern/url', "u=$id");
+ $urlCache[$mailing_id . $url] = $redirect;
+ }
+
+ // This looks silly - calling the hook twice. This smells like an accident. Restoring old cache-based lookup.
+ // $returnUrl = CRM_Utils_System::externUrl('extern/url', "u=$id&qid=$queue_id");
+ $returnUrl = "{$urlCache[$mailing_id . $url]}&qid={$queue_id}";
+
+ if ($hrefExists) {
+ $returnUrl = "href='{$returnUrl}' rel='nofollow'";
+ }
+
+ return $returnUrl;
+ }
+
+ /**
+ * Create a trackable URL for a URL with tokens.
+ *
+ * @param string $url
+ * @param int $mailing_id
+ * @param int|string $queue_id
+ *
+ * @return string
+ */
+ private static function getTrackerURLForUrlWithTokens($url, $mailing_id, $queue_id) {
+
+ // Parse the URL.
+ // (not using parse_url because it's messy to reassemble)
+ if (!preg_match('/^([^?#]+)([?][^#]*)?(#.*)?$/', $url, $parsed)) {
+ // Failed to parse it, give up and don't track it.
+ return $url;
+ }
+
+ // If we have a token in the URL + path section, we can't tokenise.
+ if (strpos($parsed[1], '{') !== FALSE) {
+ return $url;
+ }
+
+ $trackable_url = $parsed[1];
+
+ // Process the query parameters, if there are any.
+ $tokenised_params = [];
+ $static_params = [];
+ if (!empty($parsed[2])) {
+ $query_key_value_pairs = explode('&', substr($parsed[2], 1));
+
+ // Separate the tokenised from the static parts.
+ foreach ($query_key_value_pairs as $_) {
+ if (strpos($_, '{') === FALSE) {
+ $static_params[] = $_;
+ }
+ else {
+ $tokenised_params[] = $_;
+ }
+ }
+ // Add the static params to the trackable part.
+ if ($static_params) {
+ $trackable_url .= '?' . implode('&', $static_params);
+ }
+ }
+
+ // Get trackable URL.
+ $data = self::getBasicTrackerURL($trackable_url, $mailing_id, $queue_id);
+
+ // Append the tokenised bits and the fragment.
+ if ($tokenised_params) {
+ // We know the URL will already have the '?'
+ $data .= '&' . implode('&', $tokenised_params);
+ }
+ if (!empty($parsed[3])) {
+ $data .= $parsed[3];
+ }
+ return $data;
+ }
+
+ /**
+ * @param $url
+ * @param $mailing_id
+ *
+ * @return int
+ * Url id of the given url and mail
+ */
+ public static function getTrackerURLId($url, $mailing_id) {
+ $tracker = new CRM_Mailing_BAO_MailingTrackableURL();
+ $tracker->url = $url;
+ $tracker->mailing_id = $mailing_id;
+ if ($tracker->find(TRUE)) {
+ return $tracker->id;
+ }
+
+ return NULL;
+ }
+
+}
<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved. |
- | |
- | This work is published under the GNU AGPLv3 license with some |
- | permitted exceptions and without any warranty. For full license |
- | and copyright information, see https://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
+ * Class was renamed in 5.62
+ * @deprecated
*/
-class CRM_Mailing_BAO_TrackableURL extends CRM_Mailing_DAO_TrackableURL {
-
- /**
- * Given a url, mailing id and queue event id, find or construct a
- * trackable url and redirect url.
- *
- * @param string $url
- * The target url to track.
- * @param int $mailing_id
- * The id of the mailing.
- * @param int $queue_id
- * The queue event id (contact clicking through).
- *
- * @return string
- * The redirect/tracking url
- */
- public static function getTrackerURL($url, $mailing_id, $queue_id) {
- if (strpos($url, '{') !== FALSE) {
- return self::getTrackerURLForUrlWithTokens($url, $mailing_id, $queue_id);
- }
- else {
- return self::getBasicTrackerURL($url, $mailing_id, $queue_id);
- }
- }
-
- private static function getBasicTrackerURL($url, $mailing_id, $queue_id) {
- static $urlCache = [];
-
- if (array_key_exists($mailing_id . $url, $urlCache)) {
- return $urlCache[$mailing_id . $url] . "&qid=$queue_id";
- }
-
- // hack for basic CRM-1014 and CRM-1151 and CRM-3492 compliance:
- // let's not replace possible image URLs, CiviMail URLs or internal anchor URLs
- if (preg_match('/\.(png|jpg|jpeg|gif|css)[\'"]?$/i', $url)
- or substr_count($url, 'civicrm/extern/')
- or substr_count($url, 'civicrm/mailing/')
- or ($url[0] === '#')
- ) {
- // let's not cache these, so they don't get &qid= appended to them
- return $url;
- }
- else {
-
- $hrefExists = FALSE;
-
- $tracker = new CRM_Mailing_BAO_TrackableURL();
- if (preg_match('/^href/i', $url)) {
- $url = preg_replace('/^href[ ]*=[ ]*[\'"](.*?)[\'"]$/i', '$1', $url);
- $hrefExists = TRUE;
- }
-
- $tracker->url = $url;
- $tracker->mailing_id = $mailing_id;
-
- if (!$tracker->find(TRUE)) {
- $tracker->save();
- }
- $id = $tracker->id;
-
- $redirect = CRM_Utils_System::externUrl('extern/url', "u=$id");
- $urlCache[$mailing_id . $url] = $redirect;
- }
-
- // This looks silly - calling the hook twice. This smells like an accident. Restoring old cache-based lookup.
- // $returnUrl = CRM_Utils_System::externUrl('extern/url', "u=$id&qid=$queue_id");
- $returnUrl = "{$urlCache[$mailing_id . $url]}&qid={$queue_id}";
-
- if ($hrefExists) {
- $returnUrl = "href='{$returnUrl}' rel='nofollow'";
- }
-
- return $returnUrl;
- }
-
- /**
- * Create a trackable URL for a URL with tokens.
- *
- * @param string $url
- * @param int $mailing_id
- * @param int|string $queue_id
- *
- * @return string
- */
- private static function getTrackerURLForUrlWithTokens($url, $mailing_id, $queue_id) {
-
- // Parse the URL.
- // (not using parse_url because it's messy to reassemble)
- if (!preg_match('/^([^?#]+)([?][^#]*)?(#.*)?$/', $url, $parsed)) {
- // Failed to parse it, give up and don't track it.
- return $url;
- }
-
- // If we have a token in the URL + path section, we can't tokenise.
- if (strpos($parsed[1], '{') !== FALSE) {
- return $url;
- }
-
- $trackable_url = $parsed[1];
-
- // Process the query parameters, if there are any.
- $tokenised_params = [];
- $static_params = [];
- if (!empty($parsed[2])) {
- $query_key_value_pairs = explode('&', substr($parsed[2], 1));
-
- // Separate the tokenised from the static parts.
- foreach ($query_key_value_pairs as $_) {
- if (strpos($_, '{') === FALSE) {
- $static_params[] = $_;
- }
- else {
- $tokenised_params[] = $_;
- }
- }
- // Add the static params to the trackable part.
- if ($static_params) {
- $trackable_url .= '?' . implode('&', $static_params);
- }
- }
-
- // Get trackable URL.
- $data = self::getBasicTrackerURL($trackable_url, $mailing_id, $queue_id);
-
- // Append the tokenised bits and the fragment.
- if ($tokenised_params) {
- // We know the URL will already have the '?'
- $data .= '&' . implode('&', $tokenised_params);
- }
- if (!empty($parsed[3])) {
- $data .= $parsed[3];
- }
- return $data;
- }
-
- /**
- * @param $url
- * @param $mailing_id
- *
- * @return int
- * Url id of the given url and mail
- */
- public static function getTrackerURLId($url, $mailing_id) {
- $tracker = new CRM_Mailing_BAO_TrackableURL();
- $tracker->url = $url;
- $tracker->mailing_id = $mailing_id;
- if ($tracker->find(TRUE)) {
- return $tracker->id;
- }
-
- return NULL;
- }
-
-}
+class_alias('CRM_Mailing_BAO_MailingTrackableURL', 'CRM_Mailing_BAO_TrackableURL');
--- /dev/null
+<?php
+
+/**
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ *
+ * Generated from xml/schema/CRM/Mailing/MailingTrackableURL.xml
+ * DO NOT EDIT. Generated by CRM_Core_CodeGen
+ * (GenCodeChecksum:5da2465e098de06d8a90975560c1cd91)
+ */
+
+/**
+ * Database access object for the MailingTrackableURL entity.
+ */
+class CRM_Mailing_DAO_MailingTrackableURL extends CRM_Core_DAO {
+ const EXT = 'civicrm';
+ const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
+
+ /**
+ * Static instance to hold the table name.
+ *
+ * @var string
+ */
+ public static $_tableName = 'civicrm_mailing_trackable_url';
+
+ /**
+ * Should CiviCRM log any modifications to this table in the civicrm_log table.
+ *
+ * @var bool
+ */
+ public static $_log = FALSE;
+
+ /**
+ * @var int|string|null
+ * (SQL type: int unsigned)
+ * Note that values will be retrieved from the database as a string.
+ */
+ public $id;
+
+ /**
+ * The URL to be tracked.
+ *
+ * @var string
+ * (SQL type: text)
+ * Note that values will be retrieved from the database as a string.
+ */
+ public $url;
+
+ /**
+ * FK to the mailing
+ *
+ * @var int|string
+ * (SQL type: int unsigned)
+ * Note that values will be retrieved from the database as a string.
+ */
+ public $mailing_id;
+
+ /**
+ * Class constructor.
+ */
+ public function __construct() {
+ $this->__table = 'civicrm_mailing_trackable_url';
+ parent::__construct();
+ }
+
+ /**
+ * Returns localized title of this entity.
+ *
+ * @param bool $plural
+ * Whether to return the plural version of the title.
+ */
+ public static function getEntityTitle($plural = FALSE) {
+ return $plural ? ts('Mailing Links') : ts('Mailing Link');
+ }
+
+ /**
+ * Returns foreign keys and entity references.
+ *
+ * @return array
+ * [CRM_Core_Reference_Interface]
+ */
+ public static function getReferenceColumns() {
+ if (!isset(Civi::$statics[__CLASS__]['links'])) {
+ Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
+ Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
+ CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
+ }
+ return Civi::$statics[__CLASS__]['links'];
+ }
+
+ /**
+ * Returns all the column names of this table
+ *
+ * @return array
+ */
+ public static function &fields() {
+ if (!isset(Civi::$statics[__CLASS__]['fields'])) {
+ Civi::$statics[__CLASS__]['fields'] = [
+ 'id' => [
+ 'name' => 'id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Trackable URL ID'),
+ 'required' => TRUE,
+ 'usage' => [
+ 'import' => FALSE,
+ 'export' => FALSE,
+ 'duplicate_matching' => FALSE,
+ 'token' => FALSE,
+ ],
+ 'where' => 'civicrm_mailing_trackable_url.id',
+ 'table_name' => 'civicrm_mailing_trackable_url',
+ 'entity' => 'MailingTrackableURL',
+ 'bao' => 'CRM_Mailing_BAO_MailingTrackableURL',
+ 'localizable' => 0,
+ 'html' => [
+ 'type' => 'Number',
+ ],
+ 'readonly' => TRUE,
+ 'add' => NULL,
+ ],
+ 'url' => [
+ 'name' => 'url',
+ 'type' => CRM_Utils_Type::T_TEXT,
+ 'title' => ts('Url'),
+ 'description' => ts('The URL to be tracked.'),
+ 'required' => TRUE,
+ 'usage' => [
+ 'import' => FALSE,
+ 'export' => FALSE,
+ 'duplicate_matching' => FALSE,
+ 'token' => FALSE,
+ ],
+ 'where' => 'civicrm_mailing_trackable_url.url',
+ 'table_name' => 'civicrm_mailing_trackable_url',
+ 'entity' => 'MailingTrackableURL',
+ 'bao' => 'CRM_Mailing_BAO_MailingTrackableURL',
+ 'localizable' => 0,
+ 'add' => NULL,
+ ],
+ 'mailing_id' => [
+ 'name' => 'mailing_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Mailing ID'),
+ 'description' => ts('FK to the mailing'),
+ 'required' => TRUE,
+ 'usage' => [
+ 'import' => FALSE,
+ 'export' => FALSE,
+ 'duplicate_matching' => FALSE,
+ 'token' => FALSE,
+ ],
+ 'where' => 'civicrm_mailing_trackable_url.mailing_id',
+ 'table_name' => 'civicrm_mailing_trackable_url',
+ 'entity' => 'MailingTrackableURL',
+ 'bao' => 'CRM_Mailing_BAO_MailingTrackableURL',
+ 'localizable' => 0,
+ 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
+ 'html' => [
+ 'type' => 'EntityRef',
+ 'label' => ts("Mailing"),
+ ],
+ 'add' => NULL,
+ ],
+ ];
+ CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
+ }
+ return Civi::$statics[__CLASS__]['fields'];
+ }
+
+ /**
+ * Return a mapping from field-name to the corresponding key (as used in fields()).
+ *
+ * @return array
+ * Array(string $name => string $uniqueName).
+ */
+ public static function &fieldKeys() {
+ if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
+ Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
+ }
+ return Civi::$statics[__CLASS__]['fieldKeys'];
+ }
+
+ /**
+ * Returns the names of this table
+ *
+ * @return string
+ */
+ public static function getTableName() {
+ return self::$_tableName;
+ }
+
+ /**
+ * Returns if this table needs to be logged
+ *
+ * @return bool
+ */
+ public function getLog() {
+ return self::$_log;
+ }
+
+ /**
+ * Returns the list of fields that can be imported
+ *
+ * @param bool $prefix
+ *
+ * @return array
+ */
+ public static function &import($prefix = FALSE) {
+ $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_trackable_url', $prefix, []);
+ return $r;
+ }
+
+ /**
+ * Returns the list of fields that can be exported
+ *
+ * @param bool $prefix
+ *
+ * @return array
+ */
+ public static function &export($prefix = FALSE) {
+ $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_trackable_url', $prefix, []);
+ return $r;
+ }
+
+ /**
+ * Returns the list of indices
+ *
+ * @param bool $localize
+ *
+ * @return array
+ */
+ public static function indices($localize = TRUE) {
+ $indices = [];
+ return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
+ }
+
+}
<?php
/**
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- *
- * Generated from xml/schema/CRM/Mailing/TrackableURL.xml
- * DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f43da49ddd6befd1cebeb8044c43618b)
+ * Class was renamed in 5.62
+ * @deprecated
*/
-
-/**
- * Database access object for the TrackableURL entity.
- */
-class CRM_Mailing_DAO_TrackableURL extends CRM_Core_DAO {
- const EXT = 'civicrm';
- const TABLE_ADDED = '';
- const COMPONENT = 'CiviMail';
-
- /**
- * Static instance to hold the table name.
- *
- * @var string
- */
- public static $_tableName = 'civicrm_mailing_trackable_url';
-
- /**
- * Should CiviCRM log any modifications to this table in the civicrm_log table.
- *
- * @var bool
- */
- public static $_log = FALSE;
-
- /**
- * @var int|string|null
- * (SQL type: int unsigned)
- * Note that values will be retrieved from the database as a string.
- */
- public $id;
-
- /**
- * The URL to be tracked.
- *
- * @var string
- * (SQL type: text)
- * Note that values will be retrieved from the database as a string.
- */
- public $url;
-
- /**
- * FK to the mailing
- *
- * @var int|string
- * (SQL type: int unsigned)
- * Note that values will be retrieved from the database as a string.
- */
- public $mailing_id;
-
- /**
- * Class constructor.
- */
- public function __construct() {
- $this->__table = 'civicrm_mailing_trackable_url';
- parent::__construct();
- }
-
- /**
- * Returns localized title of this entity.
- *
- * @param bool $plural
- * Whether to return the plural version of the title.
- */
- public static function getEntityTitle($plural = FALSE) {
- return $plural ? ts('Trackable URLs') : ts('Trackable URL');
- }
-
- /**
- * Returns foreign keys and entity references.
- *
- * @return array
- * [CRM_Core_Reference_Interface]
- */
- public static function getReferenceColumns() {
- if (!isset(Civi::$statics[__CLASS__]['links'])) {
- Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
- Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
- CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
- }
- return Civi::$statics[__CLASS__]['links'];
- }
-
- /**
- * Returns all the column names of this table
- *
- * @return array
- */
- public static function &fields() {
- if (!isset(Civi::$statics[__CLASS__]['fields'])) {
- Civi::$statics[__CLASS__]['fields'] = [
- 'id' => [
- 'name' => 'id',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Trackable URL ID'),
- 'required' => TRUE,
- 'usage' => [
- 'import' => FALSE,
- 'export' => FALSE,
- 'duplicate_matching' => FALSE,
- 'token' => FALSE,
- ],
- 'where' => 'civicrm_mailing_trackable_url.id',
- 'table_name' => 'civicrm_mailing_trackable_url',
- 'entity' => 'TrackableURL',
- 'bao' => 'CRM_Mailing_BAO_TrackableURL',
- 'localizable' => 0,
- 'html' => [
- 'type' => 'Number',
- ],
- 'readonly' => TRUE,
- 'add' => NULL,
- ],
- 'url' => [
- 'name' => 'url',
- 'type' => CRM_Utils_Type::T_TEXT,
- 'title' => ts('Url'),
- 'description' => ts('The URL to be tracked.'),
- 'required' => TRUE,
- 'usage' => [
- 'import' => FALSE,
- 'export' => FALSE,
- 'duplicate_matching' => FALSE,
- 'token' => FALSE,
- ],
- 'where' => 'civicrm_mailing_trackable_url.url',
- 'table_name' => 'civicrm_mailing_trackable_url',
- 'entity' => 'TrackableURL',
- 'bao' => 'CRM_Mailing_BAO_TrackableURL',
- 'localizable' => 0,
- 'add' => NULL,
- ],
- 'mailing_id' => [
- 'name' => 'mailing_id',
- 'type' => CRM_Utils_Type::T_INT,
- 'title' => ts('Mailing ID'),
- 'description' => ts('FK to the mailing'),
- 'required' => TRUE,
- 'usage' => [
- 'import' => FALSE,
- 'export' => FALSE,
- 'duplicate_matching' => FALSE,
- 'token' => FALSE,
- ],
- 'where' => 'civicrm_mailing_trackable_url.mailing_id',
- 'table_name' => 'civicrm_mailing_trackable_url',
- 'entity' => 'TrackableURL',
- 'bao' => 'CRM_Mailing_BAO_TrackableURL',
- 'localizable' => 0,
- 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
- 'html' => [
- 'label' => ts("Mailing"),
- ],
- 'add' => NULL,
- ],
- ];
- CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
- }
- return Civi::$statics[__CLASS__]['fields'];
- }
-
- /**
- * Return a mapping from field-name to the corresponding key (as used in fields()).
- *
- * @return array
- * Array(string $name => string $uniqueName).
- */
- public static function &fieldKeys() {
- if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
- Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
- }
- return Civi::$statics[__CLASS__]['fieldKeys'];
- }
-
- /**
- * Returns the names of this table
- *
- * @return string
- */
- public static function getTableName() {
- return self::$_tableName;
- }
-
- /**
- * Returns if this table needs to be logged
- *
- * @return bool
- */
- public function getLog() {
- return self::$_log;
- }
-
- /**
- * Returns the list of fields that can be imported
- *
- * @param bool $prefix
- *
- * @return array
- */
- public static function &import($prefix = FALSE) {
- $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_trackable_url', $prefix, []);
- return $r;
- }
-
- /**
- * Returns the list of fields that can be exported
- *
- * @param bool $prefix
- *
- * @return array
- */
- public static function &export($prefix = FALSE) {
- $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_trackable_url', $prefix, []);
- return $r;
- }
-
- /**
- * Returns the list of indices
- *
- * @param bool $localize
- *
- * @return array
- */
- public static function indices($localize = TRUE) {
- $indices = [];
- return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
- }
-
-}
+class_alias('CRM_Mailing_DAO_MailingTrackableURL', 'CRM_Mailing_DAO_TrackableURL');
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
-class CRM_Mailing_Event_BAO_MailingEventClickThrough extends CRM_Mailing_Event_DAO_MailingEventClickThrough {
+class CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen extends CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen {
/**
* Track a click-through and return the URL to redirect.
// prevents foreign key violations.
$job = CRM_Utils_Type::escape(CRM_Mailing_BAO_MailingJob::getTableName(), 'MysqlColumnNameOrAlias');
$eq = CRM_Utils_Type::escape(CRM_Mailing_Event_BAO_MailingEventQueue::getTableName(), 'MysqlColumnNameOrAlias');
- $turl = CRM_Utils_Type::escape(CRM_Mailing_BAO_TrackableURL::getTableName(), 'MysqlColumnNameOrAlias');
+ $turl = CRM_Utils_Type::escape(CRM_Mailing_BAO_MailingTrackableURL::getTableName(), 'MysqlColumnNameOrAlias');
if (!$queue_id) {
$search = CRM_Core_DAO::executeQuery(
return $search->url;
}
- $open = new CRM_Mailing_Event_BAO_MailingEventClickThrough();
+ $open = new CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen();
$open->event_queue_id = $queue_id;
$open->trackable_url_id = $url_id;
$open->time_stamp = date('YmdHis');
$dao = new CRM_Core_DAO();
$click = self::getTableName();
- $url = CRM_Mailing_BAO_TrackableURL::getTableName();
+ $url = CRM_Mailing_BAO_MailingTrackableURL::getTableName();
$queue = CRM_Mailing_Event_BAO_MailingEventQueue::getTableName();
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$job = CRM_Mailing_BAO_MailingJob::getTableName();
<?php
/**
- * BAO class was renamed in 5.57
+ * BAO class was renamed in 5.62
+ * @deprecated
*/
-class_alias('CRM_Mailing_Event_BAO_MailingEventClickThrough', 'CRM_Mailing_Event_BAO_TrackableURLOpen');
+class_alias('CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen', 'CRM_Mailing_Event_BAO_TrackableURLOpen');
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
- * Generated from xml/schema/CRM/Mailing/Event/MailingEventClickThrough.xml
+ * Generated from xml/schema/CRM/Mailing/Event/MailingEventTrackableURLOpen.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:11c64e5e8108784fe8e844616abc997e)
+ * (GenCodeChecksum:6b5080d5367785fa44add485df62cba5)
*/
/**
- * Database access object for the MailingEventClickThrough entity.
+ * Database access object for the MailingEventTrackableURLOpen entity.
*/
-class CRM_Mailing_Event_DAO_MailingEventClickThrough extends CRM_Core_DAO {
+class CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
const COMPONENT = 'CiviMail';
* Whether to return the plural version of the title.
*/
public static function getEntityTitle($plural = FALSE) {
- return $plural ? ts('Mailing Event Click Throughs') : ts('Mailing Event Click Through');
+ return $plural ? ts('Mailing Link Clickthroughs') : ts('Mailing Link Clickthrough');
}
/**
],
'where' => 'civicrm_mailing_event_trackable_url_open.id',
'table_name' => 'civicrm_mailing_event_trackable_url_open',
- 'entity' => 'MailingEventClickThrough',
- 'bao' => 'CRM_Mailing_Event_BAO_MailingEventClickThrough',
+ 'entity' => 'MailingEventTrackableURLOpen',
+ 'bao' => 'CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen',
'localizable' => 0,
'html' => [
'type' => 'Number',
],
'where' => 'civicrm_mailing_event_trackable_url_open.event_queue_id',
'table_name' => 'civicrm_mailing_event_trackable_url_open',
- 'entity' => 'MailingEventClickThrough',
- 'bao' => 'CRM_Mailing_Event_BAO_MailingEventClickThrough',
+ 'entity' => 'MailingEventTrackableURLOpen',
+ 'bao' => 'CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen',
'localizable' => 0,
'FKClassName' => 'CRM_Mailing_Event_DAO_MailingEventQueue',
'html' => [
+ 'type' => 'EntityRef',
'label' => ts("Recipient"),
],
'add' => NULL,
],
'where' => 'civicrm_mailing_event_trackable_url_open.trackable_url_id',
'table_name' => 'civicrm_mailing_event_trackable_url_open',
- 'entity' => 'MailingEventClickThrough',
- 'bao' => 'CRM_Mailing_Event_BAO_MailingEventClickThrough',
+ 'entity' => 'MailingEventTrackableURLOpen',
+ 'bao' => 'CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen',
'localizable' => 0,
- 'FKClassName' => 'CRM_Mailing_DAO_TrackableURL',
+ 'FKClassName' => 'CRM_Mailing_DAO_MailingTrackableURL',
'html' => [
- 'label' => ts("Trackable Url"),
+ 'type' => 'EntityRef',
+ 'label' => ts("Mailing Link"),
],
'add' => NULL,
],
'where' => 'civicrm_mailing_event_trackable_url_open.time_stamp',
'default' => 'CURRENT_TIMESTAMP',
'table_name' => 'civicrm_mailing_event_trackable_url_open',
- 'entity' => 'MailingEventClickThrough',
- 'bao' => 'CRM_Mailing_Event_BAO_MailingEventClickThrough',
+ 'entity' => 'MailingEventTrackableURLOpen',
+ 'bao' => 'CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen',
'localizable' => 0,
+ 'html' => [
+ 'type' => 'Date',
+ 'label' => ts("Opened Date"),
+ ],
'add' => NULL,
],
];
<?php
/**
- * DAO class was renamed in 5.57
+ * DAO class was renamed in 5.62
* @deprecated
*/
-class_alias('CRM_Mailing_Event_DAO_MailingEventClickThrough', 'CRM_Mailing_Event_DAO_TrackableURLOpen');
+class_alias('CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen', 'CRM_Mailing_Event_DAO_TrackableURLOpen');
public function run() {
$queue_id = CRM_Utils_Request::retrieveValue('qid', 'Integer');
$url_id = CRM_Utils_Request::retrieveValue('u', 'Integer', NULL, TRUE);
- $url = trim(CRM_Mailing_Event_BAO_MailingEventClickThrough::track($queue_id, $url_id));
+ $url = trim(CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($queue_id, $url_id));
$query_string = $this->extractPassthroughParameters();
if (strlen($query_string) > 0) {
break;
case 'click':
- $dateSort = CRM_Mailing_Event_BAO_MailingEventClickThrough::getTableName() . '.time_stamp';
+ $dateSort = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTableName() . '.time_stamp';
$this->_columnHeaders = array_merge($this->_columnHeaders, [
[
'name' => ts('URL'),
return $result;
case 'click':
- $event = new CRM_Mailing_Event_BAO_MailingEventClickThrough();
+ $event = new CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen();
$result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct,
return $rows;
case 'click':
- $rows = CRM_Mailing_Event_BAO_MailingEventClickThrough::getRows(
+ $rows = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getRows(
$this->_mailing_id, $this->_job_id,
$this->_is_distinct, $this->_url_id,
$offset, $rowCount, $sort
];
$this->_columns['civicrm_mailing_trackable_url'] = [
- 'dao' => 'CRM_Mailing_DAO_TrackableURL',
+ 'dao' => 'CRM_Mailing_DAO_MailingTrackableURL',
'fields' => [
'url' => [
'title' => ts('Click through URL'),
];
$this->_columns['civicrm_mailing_event_trackable_url_open'] = [
- 'dao' => 'CRM_Mailing_Event_DAO_MailingEventClickThrough',
+ 'dao' => 'CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen',
'fields' => [
'time_stamp' => [
'title' => ts('Click Date'),
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+namespace Civi\Api4;
+
+/**
+ * Tracks clickthrough events when users open links in mailings.
+ *
+ * @see \Civi\Api4\MailingTrackableURL
+ * @since 5.62
+ * @package Civi\Api4
+ */
+class MailingEventTrackableURLOpen extends Generic\DAOEntity {
+ use \Civi\Api4\Generic\Traits\ReadOnlyEntity;
+
+}
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+namespace Civi\Api4;
+
+/**
+ * Links in mailings which can be tracked when users click on them.
+ *
+ * @see \Civi\Api4\MailingEventTrackableURLOpen
+ * @since 5.62
+ * @package Civi\Api4
+ */
+class MailingTrackableURL extends Generic\DAOEntity {
+
+}
*/
function civicrm_api3_mailing_event_click($params) {
civicrm_api3_verify_mandatory($params,
- 'CRM_Mailing_Event_DAO_MailingEventClickThrough',
+ 'CRM_Mailing_Event_DAO_MailingEventTrackableURLOpen',
['event_queue_id', 'url_id'],
FALSE
);
$url_id = $params['url_id'];
$queue = $params['event_queue_id'];
- $url = CRM_Mailing_Event_BAO_MailingEventClickThrough::track($queue, $url_id);
+ $url = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($queue, $url_id);
$values = [];
$values['url'] = $url;
case 'Unique Clicks':
$stats[$params['mailing_id']] += [
- $detail => CRM_Mailing_Event_BAO_MailingEventClickThrough::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], NULL, $params['date']),
+ $detail => CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], (bool) $params['is_distinct'], NULL, $params['date']),
];
break;
break;
case 'total unique clicks':
- $result = CRM_Mailing_Event_BAO_MailingEventClickThrough::getRows($mailingAB['mailing_id_a'], NULL, TRUE, 0, 1, "civicrm_mailing_event_trackable_url_open.time_stamp ASC");
+ $result = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getRows($mailingAB['mailing_id_a'], NULL, TRUE, 0, 1, "civicrm_mailing_event_trackable_url_open.time_stamp ASC");
$startDate = CRM_Utils_Date::processDate($result[0]['date']);
$targetDate = CRM_Utils_Date::processDate($params['target_date']);
$dateDuration = round(abs(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']);
$toDate = date('YmdHis', $toDate);
$graphStats[$name] = [
$params['split_count_select'] => [
- 'count' => CRM_Mailing_Event_BAO_MailingEventClickThrough::getTotalCount($params['mailing_id'], NULL, FALSE, NULL, $toDate),
+ 'count' => CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, NULL, $toDate),
'time' => CRM_Utils_Date::customFormat($toDate),
],
];
throw new CRM_Core_Exception("Provide url to get stats result for total clicks on a particular link");
}
// FIXME: doesn't make sense to get url_id mailing_id_(a|b) while getting start date in mailing_id_a
- $url_id = CRM_Mailing_BAO_TrackableURL::getTrackerURLId($mailingAB[$column], $params['target_url']);
- $result = CRM_Mailing_Event_BAO_MailingEventClickThrough::getRows($mailingAB['mailing_id_a'], NULL, FALSE, $url_id, 0, 1, "civicrm_mailing_event_trackable_url_open.time_stamp ASC");
+ $url_id = CRM_Mailing_BAO_MailingTrackableURL::getTrackerURLId($mailingAB[$column], $params['target_url']);
+ $result = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getRows($mailingAB['mailing_id_a'], NULL, FALSE, $url_id, 0, 1, "civicrm_mailing_event_trackable_url_open.time_stamp ASC");
$startDate = CRM_Utils_Date::processDate($result[0]['date']);
$targetDate = CRM_Utils_Date::processDate($params['target_date']);
$dateDuration = round(abs(strtotime($targetDate) - strtotime($startDate)) / $params['split_count']);
$toDate = CRM_Utils_Date::processDate($toDate);
$graphStats[$name] = [
$params['split_count_select'] => [
- 'count' => CRM_Mailing_Event_BAO_MailingEventClickThrough::getTotalCount($params['mailing_id'], NULL, FALSE, $url_id, $toDate),
+ 'count' => CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTotalCount($params['mailing_id'], NULL, FALSE, $url_id, $toDate),
'time' => CRM_Utils_Date::customFormat($toDate),
],
];
public function filterContent($msg, $mailing_id, $queue_id) {
return self::replaceHrefUrls($msg,
function ($url) use ($mailing_id, $queue_id) {
- $data = \CRM_Mailing_BAO_TrackableURL::getTrackerURL(
+ $data = \CRM_Mailing_BAO_MailingTrackableURL::getTrackerURL(
html_entity_decode($url), $mailing_id, $queue_id);
$data = htmlentities($data, ENT_NOQUOTES);
return $data;
public function filterContent($msg, $mailing_id, $queue_id) {
return self::replaceTextUrls($msg,
function ($url) use ($mailing_id, $queue_id) {
- return \CRM_Mailing_BAO_TrackableURL::getTrackerURL($url, $mailing_id,
+ return \CRM_Mailing_BAO_MailingTrackableURL::getTrackerURL($url, $mailing_id,
$queue_id);
}
);
// Mock the getTrackerURL call; we don't need to test creating a row in a table.
// If you want this to work without runkit, then either (a) make the dummy rows or (b) switch this to a hook/event that is runtime-configurable.
require_once 'CRM/Mailing/BAO/TrackableURL.php';
- \runkit7_method_rename('\CRM_Mailing_BAO_TrackableURL', 'getBasicTrackerURL', 'orig_getBasicTrackerURL');
- \runkit7_method_add('\CRM_Mailing_BAO_TrackableURL', 'getBasicTrackerURL', '$a, $b, $c', 'return \'http://example.com/extern?u=1&qid=1\';', RUNKIT7_ACC_STATIC | RUNKIT7_ACC_PRIVATE);
+ \runkit7_method_rename('\CRM_Mailing_BAO_MailingTrackableURL', 'getBasicTrackerURL', 'orig_getBasicTrackerURL');
+ \runkit7_method_add('\CRM_Mailing_BAO_MailingTrackableURL', 'getBasicTrackerURL', '$a, $b, $c', 'return \'http://example.com/extern?u=1&qid=1\';', RUNKIT7_ACC_STATIC | RUNKIT7_ACC_PRIVATE);
parent::setUp();
}
public function tearDown(): void {
// Reset the class.
- \runkit7_method_remove('\CRM_Mailing_BAO_TrackableURL', 'getBasicTrackerURL');
- \runkit7_method_rename('\CRM_Mailing_BAO_TrackableURL', 'orig_getBasicTrackerURL', 'getBasicTrackerURL');
+ \runkit7_method_remove('\CRM_Mailing_BAO_MailingTrackableURL', 'getBasicTrackerURL');
+ \runkit7_method_rename('\CRM_Mailing_BAO_MailingTrackableURL', 'orig_getBasicTrackerURL', 'getBasicTrackerURL');
parent::tearDown();
}
}
require_once 'CRM/Mailing/Event/BAO/TrackableURLOpen.php';
-$url = CRM_Mailing_Event_BAO_MailingEventClickThrough::track($queue_id, $url_id);
+$url = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($queue_id, $url_id);
// CRM-7103
// Looking for additional query variables and append them when redirecting.
// ensure that total unique clicked mail count is same while
// fetching rows and row count for mailing_id = 14 and
// trackable_url_id 12
- $totalDistinctTrackableUrlCount = CRM_Mailing_Event_BAO_MailingEventClickThrough::getTotalCount(14, NULL, TRUE, 13);
- $totalTrackableUrlCount = CRM_Mailing_Event_BAO_MailingEventClickThrough::getTotalCount(14, NULL, FALSE, 13);
- $totalTrackableUrlMail = CRM_Mailing_Event_BAO_MailingEventClickThrough::getRows(14, NULL, TRUE, 13);
+ $totalDistinctTrackableUrlCount = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTotalCount(14, NULL, TRUE, 13);
+ $totalTrackableUrlCount = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getTotalCount(14, NULL, FALSE, 13);
+ $totalTrackableUrlMail = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::getRows(14, NULL, TRUE, 13);
$this->assertEquals(3, $totalDistinctTrackableUrlCount, "Accurately display distinct count of unique trackable URLs");
$this->assertEquals(4, $totalTrackableUrlCount, "Accurately display count of unique trackable URLs");
$dao = CRM_Core_DAO::executeQuery($sql);
$this->assertTrue($dao->fetch());
- $url = CRM_Mailing_Event_BAO_MailingEventClickThrough::track($dao->queue_id, $dao->url_id);
+ $url = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($dao->queue_id, $dao->url_id);
$this->assertStringContainsString('https://civicrm.org', $url);
// Now delete the event queue hashes and see if the tracking still works.
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_mailing_event_queue');
- $url = CRM_Mailing_Event_BAO_MailingEventClickThrough::track($dao->queue_id, $dao->url_id);
+ $url = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($dao->queue_id, $dao->url_id);
$this->assertStringContainsString('https://civicrm.org', $url);
// Ensure that Google CSS link is not tracked.
$dao = CRM_Core_DAO::executeQuery($sql);
$this->assertTrue($dao->fetch());
- $url = CRM_Mailing_Event_BAO_MailingEventClickThrough::track($dao->queue_id, $dao->url_id);
+ $url = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($dao->queue_id, $dao->url_id);
$this->assertStringContainsString($unicodeURL, $url);
// Now delete the event queue hashes and see if the tracking still works.
CRM_Core_DAO::executeQuery('DELETE FROM civicrm_mailing_event_queue');
- $url = CRM_Mailing_Event_BAO_MailingEventClickThrough::track($dao->queue_id, $dao->url_id);
+ $url = CRM_Mailing_Event_BAO_MailingEventTrackableURLOpen::track($dao->queue_id, $dao->url_id);
$this->assertStringContainsString($unicodeURL, $url);
}
<table>
<base>CRM/Mailing/Event</base>
- <class>MailingEventClickThrough</class>
+ <class>MailingEventTrackableURLOpen</class>
<name>civicrm_mailing_event_trackable_url_open</name>
+ <title>Mailing Link Clickthrough</title>
+ <titlePlural>Mailing Link Clickthroughs</titlePlural>
<comment>Tracks when a TrackableURL is clicked by a recipient.</comment>
<archive>true</archive>
<component>CiviMail</component>
<comment>FK to EventQueue</comment>
<html>
<label>Recipient</label>
+ <type>EntityRef</type>
</html>
</field>
<foreignKey>
<required>true</required>
<comment>FK to TrackableURL</comment>
<html>
- <label>Trackable Url</label>
+ <label>Mailing Link</label>
+ <type>EntityRef</type>
</html>
</field>
<foreignKey>
<type>timestamp</type>
<default>CURRENT_TIMESTAMP</default>
<required>true</required>
+ <html>
+ <label>Opened Date</label>
+ <type>Date</type>
+ </html>
<comment>When this trackable URL open occurred.</comment>
</field>
</table>
<xi:include href="MailingEventReply.xml" parse="xml" />
<xi:include href="MailingEventSubscribe.xml" parse="xml" />
<xi:include href="MailingEventConfirm.xml" parse="xml" />
-<xi:include href="MailingEventClickThrough.xml" parse="xml" />
+<xi:include href="MailingEventTrackableURLOpen.xml" parse="xml" />
<xi:include href="MailingEventUnsubscribe.xml" parse="xml" />
</tables>
<table>
<base>CRM/Mailing</base>
- <class>TrackableURL</class>
+ <class>MailingTrackableURL</class>
<name>civicrm_mailing_trackable_url</name>
+ <title>Mailing Link</title>
+ <titlePlural>Mailing Links</titlePlural>
<comment>Stores URLs for which we should track click-throughs from mailings</comment>
<archive>true</archive>
<component>CiviMail</component>
<required>true</required>
<html>
<label>Mailing</label>
+ <type>EntityRef</type>
</html>
<comment>FK to the mailing</comment>
</field>
<xi:include href="Mailing.xml" parse="xml" />
<xi:include href="MailingAB.xml" parse="xml" />
<xi:include href="MailingGroup.xml" parse="xml" />
-<xi:include href="TrackableURL.xml" parse="xml" />
+<xi:include href="MailingTrackableURL.xml" parse="xml" />
<xi:include href="MailingJob.xml" parse="xml" />
<xi:include href="MailingRecipients.xml" parse="xml" />
<xi:include href="BounceType.xml" parse="xml" />