From f9ab9adcf66a6e0a0cae40deab4a27dac4cb6939 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 18 Oct 2018 16:14:01 -0400 Subject: [PATCH] adding name and date search to the dashboard widget --- models/admin/leads/index.php | 2 +- setup/adminHooks.php | 36 +++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/models/admin/leads/index.php b/models/admin/leads/index.php index 6b32a12..ee73f13 100644 --- a/models/admin/leads/index.php +++ b/models/admin/leads/index.php @@ -167,7 +167,7 @@ class GlmMembersAdmin_leads_index extends GlmDataLeadEntry // Verify mm/dd/YYYY date format for the from and to dates. if ( !isset( $search_params ) ) { $search_params = filter_var_array( - $_POST, + $_REQUEST, array( 'source_id' => FILTER_VALIDATE_INT, 'company' => FILTER_SANITIZE_STRING, diff --git a/setup/adminHooks.php b/setup/adminHooks.php index e6f55fb..0df8d44 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -70,23 +70,23 @@ add_filter( $limit = false; // Save the current fields array and make a copy. Will be restored before the return. - $fSave = $Events->fields; + $fSave = $Leads->fields; // Remove what we don't want from the copy and get the list - $Events->fields = array( - 'id' => $fSave['id'], - 'name' => $fSave['name'], - 'name_slug' => $fSave['name_slug'], - 'ref_type' => $fSave['ref_type'], - 'ref_dest' => $fSave['ref_dest'], - 'ref_dest_id' => $fSave['ref_dest_id'], - 'status' => $fSave['status'], - ); + // $Leads->fields = array( + // 'id' => $fSave['id'], + // 'name' => $fSave['name'], + // 'name_slug' => $fSave['name_slug'], + // 'ref_type' => $fSave['ref_type'], + // 'ref_dest' => $fSave['ref_dest'], + // 'ref_dest_id' => $fSave['ref_dest_id'], + // 'status' => $fSave['status'], + // ); $leadsIndexPage = GLM_MEMBERS_LEADS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-leads-index&glm_action=edit'; $leadsTable = GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX . "lead_entry"; $leadsEditPage = GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE.'leads-index&glm_action=list&option=edit'; - $leadsListPage = GLM_MEMBERS_LEADS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-leads-list'; + $leadsListPage = GLM_MEMBERS_LEADS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-leads-index'; $leadsRefLink = GLM_MEMBERS_LEADS_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-member&glm_action=index'; $content = [ 'title' => 'Leads', @@ -139,6 +139,16 @@ add_filter( 'url' => $leadsIndexPage . "&option=search", 'result' => $Leads->getStats() ], + [ + 'id' => 'dateSearch', + 'order' => 3, + 'template' => 'dateSearch', + 'entityID' => 'lead', + 'fromDate' => 'from_date', + 'toDate' => 'to_date', + 'defaultFromDate' => date('m/d/Y'), + 'resultUrl' => $leadsListPage."&search=1" + ], [ 'id' => 'textSearch', 'order' => 2, @@ -146,14 +156,14 @@ add_filter( 'entityID' => 'event', 'table' => $leadsTable, 'fields' => 'concat(fname," ",lname) as name,id', - 'resultUrl' => $leadsEditPage.'&lead=', + 'resultUrl' => $leadsEditPage, 'where' => 'concat(fname," ",lname)' ], ] ]; // Restore the fields list - $Events->fields = $fSave; + $Leads->fields = $fSave; return $content; }, -- 2.17.1