From: Steve Sutton Date: Mon, 13 Aug 2018 18:01:02 +0000 (-0400) Subject: Test with more data X-Git-Tag: v1.0.0^2~11 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=81553960aef12541eee702208eea3ae9c3833902;p=WP-Plugins%2Fglm-member-db-travel.git Test with more data Select month searched if given. --- diff --git a/models/admin/travel/reports.php b/models/admin/travel/reports.php index 9352551..bdfa353 100644 --- a/models/admin/travel/reports.php +++ b/models/admin/travel/reports.php @@ -87,6 +87,7 @@ class GlmMembersAdmin_travel_reports //extends GlmDataTravelLeads $where = ' true '; $option = false; $hasSearch = false; + $s_month = false; // Get any provided option if ( isset( $_REQUEST['option'] ) ) { @@ -103,6 +104,7 @@ class GlmMembersAdmin_travel_reports //extends GlmDataTravelLeads if ( isset( $_REQUEST['report_month'] ) && $monthYear = filter_var( $_REQUEST['report_month'] ) ) { + $s_month = $_REQUEST['report_month']; if ($monthYear) { list($month, $year) = explode("|", $monthYear); } else { @@ -137,14 +139,16 @@ class GlmMembersAdmin_travel_reports //extends GlmDataTravelLeads $months = $this->wpdb->get_results( "SELECT MONTH(search_date) as month, YEAR(search_date) as year FROM " . GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . "search_reports - GROUP BY month, year", + GROUP BY month, year + ORDER BY year DESC, month DESC", ARRAY_A ); // Add Month name to $months if ( isset( $months ) && !empty( $months ) ) { foreach ( $months as $key => $row ) { - $months[$key]['full_month'] = date( 'F', mktime( 0, 0, 0, $row['month'], $row['year']) ); + $months[$key]['full_month'] = date( 'F', mktime( 0, 0, 0, $row['month'], $row['year']) ); + $months[$key]['option_value'] = $row['month'] . '|' .$row['year']; } } @@ -153,6 +157,7 @@ class GlmMembersAdmin_travel_reports //extends GlmDataTravelLeads 'hasSearch' => $hasSearch, 'list' => $list, 'months' => $months, + 's_month' => $s_month, ); diff --git a/views/admin/travel/reports.html b/views/admin/travel/reports.html index 3389b0e..a92c0a2 100644 --- a/views/admin/travel/reports.html +++ b/views/admin/travel/reports.html @@ -49,7 +49,7 @@ Show Summary for Month