Add new contact type and new field
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 5 May 2016 16:36:48 +0000 (12:36 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 5 May 2016 16:36:48 +0000 (12:36 -0400)
New field for the last_access for contacts
New contact type for contacts

.htaccess
Toolkit/Contacts/ContactUs.php
Toolkit/Contacts/config.ini
Toolkit/LeadManager/Contact.php
admin/Contact/contact_setup.inc
admin/Contact/index.phtml
admin/Contact/query_contact.phtml

index 573c329..2430cb5 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -26,6 +26,8 @@ RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
 RewriteCond %{REQUEST_URI} v/[0-9\.]+/
 RewriteRule ^v/[0-9\.]+/(.*) $1 [L]
 
+RewriteRule ^winaround/? index.php?catid=65 [L]
+
 ############
 ## Events ##
 ############
index f1830d1..2579b6a 100755 (executable)
@@ -1058,6 +1058,7 @@ class Toolkit_Contacts_ContactUs
         $this->newInterest = $values['interest'];
         // update create_date for this contact
         $values['create_date'] = date('m/d/Y');
+        $values['last_access'] = date('m/d/Y');
 
         // set up interest field values
         if (is_array($values['interest']) && !empty($values['interest'])) {
index 7b7b5c6..9b9f2c0 100644 (file)
@@ -16,6 +16,7 @@ sequence = "contact_id_seq"
 6 = "Golf Passport"
 7 = "Golf Giveaway"
 8 = "Golf Show"
+9 = "Win A Round"
 
 ; ini file for the setup of the How did you hear about us
 ; used in the contact form and the vacation guide form.
index a7e5f4c..b15bd33 100644 (file)
@@ -49,6 +49,7 @@ class Toolkit_LeadManager_Contact
     private $_golfvacation;
     private $_gender;
     private $_handicap;
+    private $_last_access; 
 
     /**
      * Contructor for class Contact Objects
@@ -73,7 +74,8 @@ class Toolkit_LeadManager_Contact
             ->setEclub($eclub)
             ->setBig_giveaway($big_giveaway)
             ->setGender($gender)
-            ->setHandicap($handicap);
+            ->setHandicap($handicap)
+            ->setLast_access($last_access);
         if ($id) {
             $this->setId($id);
         }
@@ -339,6 +341,11 @@ class Toolkit_LeadManager_Contact
         return $this->_big_giveaway;
     }
 
+    function getLast_access()
+    {
+        return $this->_last_access;
+    }
+
     function getGolfvacation()
     {
         return $this->_golfvacation;
@@ -368,6 +375,12 @@ class Toolkit_LeadManager_Contact
         return $this;
     }
 
+    function setLast_access($last_access)
+    {
+        $this->_last_access = $last_access;
+        return $this;
+    }
+
     function getGender()
     {
         return $this->_gender;
index 97001b3..062eb44 100755 (executable)
@@ -403,6 +403,8 @@ function dateSelector($M, $D, $Y, array $m = null, array $d = null, array $y = n
 $c_date_from  = GLM_TOOLBOX::contact_date_entry("", "", "", "fc_month", "fc_day", "fc_year");
 $c_date_to    = GLM_TOOLBOX::contact_date_entry("", "", "", "tc_month", "tc_day", "tc_year");
 
+$a_date_from  = GLM_TOOLBOX::contact_date_entry("", "", "", "fa_month", "fa_day", "fa_year");
+$a_date_to    = GLM_TOOLBOX::contact_date_entry("", "", "", "ta_month", "ta_day", "ta_year");
 // The Following $DB_fields array is no longer used for the edit contact page
 // You must alter the class Toolkit_Contacts_Admin_EditContact
 // The following is only used for the search form and the listing pages
@@ -437,6 +439,7 @@ define("WHERE", ID." IS NOT NULL");
 // $DB_fields are used for edit and updating contacts
 $DB_fields[] = array("name" => "id",            "title" => "id",            "type" => "hide");
 $DB_fields[] = array("name" => "create_date",   "title" => "Create Date",   "type" => "static");
+$DB_fields[] = array("name" => "last_access",   "title" => "Last Access Date",   "type" => "static");
 $DB_fields[] = array("name" => "fname",         "title" => "First Name",    "type" => "text");
 $DB_fields[] = array("name" => "lname",         "title" => "Last Name",     "type" => "text");
 if (TABLE == 'customer') {
index 0428884..d5ffe07 100755 (executable)
@@ -134,12 +134,20 @@ GLM_TOOLBOX::html_nav_table($nav,$navWidth);
   </tr>
   <tr>
       <td align="left" colspan=4 nowrap>
-                 <div style="float:left;width:240px;height:35px;">Created From:<br>
+          <div style="float:left;width:240px;height:35px;">Created From:<br>
               <input id="contactFromDate" name="contact_from_date" <?php echo ($contact_from_date) ? 'value="'.$contact_from_date.'"': '';?>></div>
-                 <div style="float:left;width:240px;height:35px;">Created To:<br>
+          <div style="float:left;width:240px;height:35px;">Created To:<br>
               <input id="contactToDate" name="contact_to_date" <?php echo ($contact_to_date) ? 'value="'.$contact_to_date.'"': '';?>></div>
       </td>
   </tr>
+  <tr>
+      <td align="left" colspan=4 nowrap>
+          <div style="float:left;width:240px;height:35px;">Last Access From:<br>
+              <input id="lastAccessFromDate" name="last_access_from_date" <?php echo ($last_access_from_date) ? 'value="'.$last_access_from_date.'"': '';?>></div>
+          <div style="float:left;width:240px;height:35px;">Last Access To:<br>
+              <input id="lastAccessToDate" name="last_access_to_date" <?php echo ($last_access_to_date) ? 'value="'.$last_access_to_date.'"': '';?>></div>
+      </td>
+  </tr>
   <tr>
     <td class="small" valign=top>
     <b>In Fields:</b><br>
@@ -301,7 +309,7 @@ GLM_TOOLBOX::html_nav_table($nav,$navWidth);
   <?php }
   if($a_date_from)
   {?>
-  <option value="access_date" <?php echo (strstr($dates,"access_date"))?"selected":""?>>Last Access Date
+  <option value="last_access" <?php echo (strstr($dates,"last_access"))?"selected":""?>>Last Access Date
   <?php }?>
     </select>
   </td>
@@ -343,6 +351,17 @@ GLM_TOOLBOX::html_nav_table($nav,$navWidth);
             dateFormat: "mm/dd/yy",
             buttonText: "Calendar"
         });
+        $("#lastAccessFromDate").datepicker({
+            altField: "#lastAccessToDate",
+            showOn: "both",
+            dateFormat: "mm/dd/yy",
+            buttonText: "Calendar"
+        });
+        $("#lastAccessToDate").datepicker({
+            showOn: "both",
+            dateFormat: "mm/dd/yy",
+            buttonText: "Calendar"
+        });
     });
 </script>
 <?php
index ffdf651..f15fbcb 100755 (executable)
@@ -212,6 +212,7 @@ if (!$query_no) {
             $query_string .= ' and ('.implode(" $compare ",$cstring).')  ';
         }
     }
+
     $contactFromDate = filter_var(
         $_REQUEST['contact_from_date'],
         FILTER_VALIDATE_REGEXP,
@@ -238,6 +239,34 @@ if (!$query_no) {
     } else if ($contactToDate) {
         $query_string .= " AND create_date <= '{$contactToDate}'";
     }
+
+    $lastAccessFromDate = filter_var(
+        $_REQUEST['last_access_from_date'],
+        FILTER_VALIDATE_REGEXP,
+        array(
+            'options' =>
+            array(
+            'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%')
+        )
+    );
+    $lastAccessToDate = filter_var(
+        $_REQUEST['last_access_to_date'],
+        FILTER_VALIDATE_REGEXP,
+        array(
+            'options' =>
+            array(
+            'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%')
+        )
+    );
+    if ($lastAccessFromDate && $lastAccessToDate) {
+        $query_string .= " AND last_access >= '{$lastAccessFromDate}'"
+        . " AND last_access <= '{$lastAccessToDate}'";
+    } else if ($lastAccessFromDate) {
+        $query_string .= " AND last_access >= '{$lastAccessFromDate}'";
+    } else if ($lastAccessToDate) {
+        $query_string .= " AND last_access <= '{$lastAccessToDate}'";
+    }
+
     if (isset($gender) && $gender != "''") {
         $query_string .= " AND gender >= '$gender'";
     }
@@ -260,8 +289,8 @@ if (!$query_no) {
         if ($fa_str<$ta_str) {
             $fa_date = $fa_month."/".$fa_day."/".$fa_year;
             $ta_date = $ta_month."/".$ta_day."/".$ta_year;
-            $query_string .= " AND access_date >= '$fa_date'
-                               AND access_date <= '$ta_date'";
+            $query_string .= " AND last_access >= '$fa_date'
+                               AND last_access <= '$ta_date'";
         }
         if ($fp_str>$tp_str) {
             $fp_date = $fp_month."/".$fp_day."/".$fp_year;