Fix count of leads on admin view. track by download.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Aug 2018 13:59:17 +0000 (09:59 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Aug 2018 13:59:17 +0000 (09:59 -0400)
Tracking by downloads.

models/admin/ajax/leadCsvExport.php
models/admin/ajax/leadPdfExport.php
models/admin/travel/index.php
models/admin/travel/members.php

index 3f85069..8eff7ee 100644 (file)
@@ -84,6 +84,19 @@ class GlmMembersAdmin_ajax_leadCsvExport extends GlmDataTravelLeads
         $list    = false;
         $lead_id = false;
 
+        // Every Time a user request a Download
+        // They need to have a logged in contact.
+        // Need to get the member id.
+        if ( isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) ) {
+            if ( $member_id = filter_var( $this->config['loggedInUser']['contactUser']['ref_dest'], FILTER_VALIDATE_INT ) ) {
+                $this->wpdb->insert(
+                    GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'search_reports',
+                    array( 'member_id' => $member_id, 'search_date' => date( 'Y-m-d H:i:s' ) ),
+                    array( '%d', '%s' )
+                );
+            }
+        }
+
         // Get registration event ID if supplied
         if (isset($_REQUEST['lead_id'])) {
 
index 4155b0e..187a136 100644 (file)
@@ -85,6 +85,19 @@ class GlmMembersAdmin_ajax_leadPdfExport extends GlmDataTravelLeads
         $list    = false;
         $lead_id = false;
 
+        // Every Time a user request a Download
+        // They need to have a logged in contact.
+        // Need to get the member id.
+        if ( isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) ) {
+            if ( $member_id = filter_var( $this->config['loggedInUser']['contactUser']['ref_dest'], FILTER_VALIDATE_INT ) ) {
+                $this->wpdb->insert(
+                    GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'search_reports',
+                    array( 'member_id' => $member_id, 'search_date' => date( 'Y-m-d H:i:s' ) ),
+                    array( '%d', '%s' )
+                );
+            }
+        }
+
         // Get registration event ID if supplied
         if (isset($_REQUEST['lead_id'])) {
 
index d098b38..739661d 100644 (file)
@@ -336,13 +336,14 @@ class GlmMembersAdmin_travel_index extends GlmDataTravelLeads
             }
 
             // $entry = $this->getList( $where );
-            $orderBy = 'T.company ASC,T.lname ASC,T.fname ASC,T.updated DESC';
+            $orderBy      = 'T.company ASC,T.lname ASC,T.fname ASC,T.updated DESC';
             $entryResults = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
+            $stats        = $this->getStats( $where );
 
             // Get paging results
             $params        = '';
             $numbDisplayed = $entryResults['returned'];
-            $leadCount     = $numbDisplayed;
+            // $leadCount     = $numbDisplayed;
             $lastDisplayed = $entryResults['last'];
             if ( $start == 1 ) {
                 $prevStart = false;
@@ -360,7 +361,7 @@ class GlmMembersAdmin_travel_index extends GlmDataTravelLeads
                 $haveLeads = true;
             }
 
-            $leadCount = count( $entry );
+            $leadCount = $stats;
 
             $view = 'index.html';
 
index 10c2546..516d8c8 100644 (file)
@@ -242,15 +242,15 @@ class GlmMembersAdmin_travel_members extends GlmDataTravelLeads
                 // Every Time a user request a search store a report.
                 // They need to have a logged in contact.
                 // Need to get the member id.
-                if ( $searching && isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) ) {
-                    if ( $member_id = filter_var( $this->config['loggedInUser']['contactUser']['ref_dest'], FILTER_VALIDATE_INT ) ) {
-                        $this->wpdb->insert(
-                            GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'search_reports',
-                            array( 'member_id' => $member_id, 'search_date' => date( 'Y-m-d H:i:s' ) ),
-                            array( '%d', '%s' )
-                        );
-                    }
-                }
+                // if ( $searching && isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) ) {
+                //     if ( $member_id = filter_var( $this->config['loggedInUser']['contactUser']['ref_dest'], FILTER_VALIDATE_INT ) ) {
+                //         $this->wpdb->insert(
+                //             GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'search_reports',
+                //             array( 'member_id' => $member_id, 'search_date' => date( 'Y-m-d H:i:s' ) ),
+                //             array( '%d', '%s' )
+                //         );
+                //     }
+                // }
 
             }