From: Steve Sutton Date: Thu, 16 Aug 2018 13:59:17 +0000 (-0400) Subject: Fix count of leads on admin view. track by download. X-Git-Tag: v1.0.0^2~6 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=b9b8c117f4cd78bf39b77fc2aed68ce448aafc3b;p=WP-Plugins%2Fglm-member-db-travel.git Fix count of leads on admin view. track by download. Tracking by downloads. --- diff --git a/models/admin/ajax/leadCsvExport.php b/models/admin/ajax/leadCsvExport.php index 3f85069..8eff7ee 100644 --- a/models/admin/ajax/leadCsvExport.php +++ b/models/admin/ajax/leadCsvExport.php @@ -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'])) { diff --git a/models/admin/ajax/leadPdfExport.php b/models/admin/ajax/leadPdfExport.php index 4155b0e..187a136 100644 --- a/models/admin/ajax/leadPdfExport.php +++ b/models/admin/ajax/leadPdfExport.php @@ -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'])) { diff --git a/models/admin/travel/index.php b/models/admin/travel/index.php index d098b38..739661d 100644 --- a/models/admin/travel/index.php +++ b/models/admin/travel/index.php @@ -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'; diff --git a/models/admin/travel/members.php b/models/admin/travel/members.php index 10c2546..516d8c8 100644 --- a/models/admin/travel/members.php +++ b/models/admin/travel/members.php @@ -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' ) + // ); + // } + // } }