Update search and back to keep sql
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 8 Jun 2018 15:46:03 +0000 (11:46 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 8 Jun 2018 15:46:03 +0000 (11:46 -0400)
From edit screen to go back to a search in progress.

models/admin/travel/index.php

index bf5a22b..a819b19 100644 (file)
@@ -139,6 +139,7 @@ class GlmMembersAdmin_travel_index extends GlmDataTravelLeads
             }
         }
 
+        echo '<pre>$_SESSION: ' . print_r( $_SESSION, true ) . '</pre>';
         // If we have a back request then go through the PHP_SESSION
         // and extract them into the REQUEST array.
         if ( isset( $_REQUEST['back'] ) && filter_var( $_REQUEST['back'], FILTER_VALIDATE_BOOLEAN ) ) {
@@ -299,6 +300,16 @@ class GlmMembersAdmin_travel_index extends GlmDataTravelLeads
             } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['prevStart'] ) ) {
                 unset( $_SESSION['search']['prevStart'] );
             }
+            if ( isset( $_REQUEST['company'] ) ) {
+                $_SESSION['search']['company'] = $_REQUEST['company'];
+            } else if ( isset( $_REQUEST['search'] ) && !isset( $_REQUEST['company'] ) ) {
+                unset( $_SESSION['search']['company'] );
+            }
+            if ( isset( $_REQUEST['contact'] ) ) {
+                $_SESSION['search']['contact'] = $_REQUEST['contact'];
+            } else if ( isset( $_REQUEST['search'] ) && !isset( $_REQUEST['contact'] ) ) {
+                unset( $_SESSION['search']['contact'] );
+            }
 
             if ( ( isset( $search ) && $search ) || $searching ) {
                 if ( isset( $where_parts ) && !empty( $where_parts ) ) {