worked CRM-12357, added stats to mailing tab and removed it from activity selector
authorKurund Jalmi <kurund@civicrm.org>
Wed, 1 May 2013 07:27:21 +0000 (00:27 -0700)
committerKurund Jalmi <kurund@civicrm.org>
Wed, 1 May 2013 07:27:21 +0000 (00:27 -0700)
CRM/Activity/BAO/Activity.php
CRM/Activity/Page/AJAX.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/Page/AJAX.php
templates/CRM/Activity/Selector/Selector.tpl
templates/CRM/Mailing/Page/Tab.tpl

index c63ffddeb5a163ff8efd28bead4a9e3ac27bd6e4..432b3c857a13b827d2d4fbd224df8cf11a7ab445 100644 (file)
@@ -2438,18 +2438,6 @@ INNER JOIN  civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
             }
           }
         }
-        if ( $values['activity_type'] == 'Bulk Email'){
-          $contactActivities[$activityId]['openstats'] = "Opens: ".
-            count(CRM_Mailing_Event_BAO_Opened::getRows(
-               CRM_Utils_Array::value('source_record_id', $values), NULL, FALSE, NULL, NULL, NULL, $params['contact_id']
-            )
-          )."<br />Clicks:" .
-            count(CRM_Mailing_Event_BAO_TrackableURLOpen::getRows(
-               CRM_Utils_Array::value('source_record_id', $values), NULL, FALSE, NULL, NULL, NULL, NULL, $params['contact_id']
-          ) );
-        }else {
-          $contactActivities[$activityId]['openstats'] = '';
-        }
 
         $contactActivities[$activityId]['activity_date'] = CRM_Utils_Date::customFormat($values['activity_date_time']);
         $contactActivities[$activityId]['status'] = $activityStatus[$values['status_id']];
index 6f9db5c588e00d918a31e3a3aae842301a09942c..f20cc038f091287d9207658000909c3610475b43 100644 (file)
@@ -410,7 +410,7 @@ class CRM_Activity_Page_AJAX {
 
     $sortMapper = array(
       0 => 'activity_type', 1 => 'subject', 2 => 'source_contact_name',
-      3 => '', 4 => '', 5 => 'activity_date_time', 6 => 'status_id',
+      3 => '', 4 => 'activity_date_time', 5 => 'status_id',
     );
 
     $sEcho     = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
@@ -453,7 +453,7 @@ class CRM_Activity_Page_AJAX {
     $selectorElements = array(
       'activity_type', 'subject', 'source_contact',
       'target_contact', 'assignee_contact',
-      'activity_date', 'status', 'openstats','links', 'class',
+      'activity_date', 'status','links', 'class',
     );
 
     echo CRM_Utils_JSON::encodeDataTableSelector($activities, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
index a942cb02f40f3bf7234666b12f37be9ea03cff23..4d47c1452ab4d7cda43c06f25c9b61bbfc1184b4 100644 (file)
@@ -2763,6 +2763,15 @@ AND        m.id = %1
           'civicrm/contact/view',
           "reset=1&cid={$values['creator_id']}");
 
+      $contactMailings[$mailingId]['openstats'] = "Opens: ".
+        count(CRM_Mailing_Event_BAO_Opened::getRows(
+            $values['mailing_id'], NULL, FALSE, NULL, NULL, NULL, $values['creator_id']
+          )
+        )."<br />Clicks:" .
+        count(CRM_Mailing_Event_BAO_TrackableURLOpen::getRows(
+          $values['mailing_id'], NULL, FALSE, NULL, NULL, NULL, NULL, $values['creator_id']
+        ) );
+
       $actionLinks = array(
         CRM_Core_Action::VIEW => array(
           'name'  => ts('View'),
index 2c9d84c01c7535963f1814947c6d06a6ab9a1c96..fa5a69ddeb14c38d3f30f8692c64d7f2552d9aad 100644 (file)
@@ -68,7 +68,7 @@ class CRM_Mailing_Page_AJAX {
     //$context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
 
     $sortMapper = array(
-      0 => 'subject', 1 => 'creator_name', 2 => 'recipients', 3 => 'start_date', 4 => 'links',
+      0 => 'subject', 1 => 'creator_name', 2 => '', 3 => 'start_date', 4 => '', 5 => 'links',
     );
 
     $sEcho     = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
@@ -94,7 +94,7 @@ class CRM_Mailing_Page_AJAX {
     $iFilteredTotal = $iTotal = $params['total'];
     $selectorElements = array(
       'subject', 'mailing_creator', 'recipients',
-      'start_date', 'links',
+      'start_date', 'openstats', 'links',
     );
 
     echo CRM_Utils_JSON::encodeDataTableSelector($mailings, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
index 449dc892bc1a7b4b6500f37305219b7068afa974..4fb4e0fc4eba2a5ccd1f9ec38ef8317167b7af3b 100644 (file)
@@ -50,7 +50,6 @@
       <th class='crm-contact-activity-assignee_contact nosort'>{ts}Assigned{/ts}</th>
       <th class='crm-contact-activity-activity_date'>{ts}Date{/ts}</th>
       <th class='crm-contact-activity-activity_status'>{ts}Status{/ts}</th>
-      <th class='crm-contact-activity-activity_openstats'>{ts}Opens/ Clicks{/ts}</th>
       <th class='crm-contact-activity-links nosort'>&nbsp;</th>
       <th class='hiddenElement'>&nbsp;</th>
     </tr>
@@ -109,7 +108,6 @@ function buildContactActivities{/literal}{$context}{literal}( filterSearch ) {
       {sClass:'crm-contact-activity-assignee_contact', bSortable:false},
       {sClass:'crm-contact-activity-activity_date'},
       {sClass:'crm-contact-activity-activity_status'},
-      {sClass:'crm-contact-activity-activity_openstats', bSortable:false},
       {sClass:'crm-contact-activity-links', bSortable:false},
       {sClass:'hiddenElement', bSortable:false}
     ],
index 5e3c38774c7cb45a45a3fb0407fdac4a9ffd9ec2..57c2cb29cd3235a2562eb42fa89220b03b63b14f 100644 (file)
@@ -32,6 +32,7 @@
       <th class='crm-mailing-contact_created'>{ts}Added By{/ts}</th>
       <th class='crm-contact-activity_contact nosort'>{ts}With{/ts}</th>
       <th class='crm-mailing-contact-date'>{ts}Date{/ts}</th>
+      <th class='crm-mailing_openstats'>{ts}Opens/ Clicks{/ts}</th>
       <th class='crm-mailing-contact-links nosort'>&nbsp;</th>
     </tr>
     </thead>
@@ -59,6 +60,7 @@
           {sClass: 'crm-mailing-contact_created'},
           {sClass: 'crm-contact-activity_contact'},
           {sClass: 'crm-mailing-contact-date'},
+          {sClass: 'crm-mailing_openstats', bSortable:false},
           {sClass: 'crm-mailing-contact-links', bSortable: false}
         ],
         "bProcessing": true,