From: Steve Sutton Date: Thu, 7 Jun 2018 19:38:03 +0000 (-0400) Subject: Updates to the Travel leads from last meeting. X-Git-Tag: v1.0.0^2~17 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=89b802a03446b0f6c74e98b3b4f9aaadb55266cb;p=WP-Plugins%2Fglm-member-db-travel.git Updates to the Travel leads from last meeting. Adding title to lead table and the lead_contact table. Adding code to the data classes and the forms to save the data. Moving the fields in the main screen for lead edit. Working on the pdf output. Restrict them so they can only edit one note at a time. Have the referred by grouped. --- diff --git a/assets/user_edit.png b/assets/user_edit.png new file mode 100755 index 0000000..c1974cd Binary files /dev/null and b/assets/user_edit.png differ diff --git a/classes/data/dataContacts.php b/classes/data/dataContacts.php index 13d99fe..f421f07 100644 --- a/classes/data/dataContacts.php +++ b/classes/data/dataContacts.php @@ -133,6 +133,13 @@ class GlmDataTravelContacts extends GlmDataAbstract 'use' => 'a', ), + 'title' => array( + 'field' => 'title', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + 'name' => array( 'field' => 'name', 'type' => 'text', diff --git a/classes/data/dataLeads.php b/classes/data/dataLeads.php index 585e5dc..819e7ab 100644 --- a/classes/data/dataLeads.php +++ b/classes/data/dataLeads.php @@ -153,6 +153,13 @@ class GlmDataTravelLeads extends GlmDataAbstract 'use' => 'a' ), + 'title' => array( + 'field' => 'title', + 'type' => 'text', + 'required' => false, + 'use' => 'a', + ), + 'fname' => array( 'field' => 'fname', 'type' => 'text', diff --git a/css/admin.css b/css/admin.css index 1001f96..88d089c 100644 --- a/css/admin.css +++ b/css/admin.css @@ -29,6 +29,16 @@ text-indent: -9000px; margin: 10px; } +.glm-travel-edit .tlEdit { + display: inline-block; + width: 16px; + height: 16px; + background: url(../assets/user_edit.png) no-repeat; + margin: 10px; +} +.edit-log { + width: 100%; +} #addLog textarea { width: 100%; @@ -290,23 +300,6 @@ div.webform td { div.webform table, div.webform td { border: 1px solid #aaa !important; } -/* Overriding JqueryUI */ -/* #travel-admin .ui-state-highlight { */ -/* margin-bottom: .5em; */ -/* padding: 15px; */ -/* } */ -/* #travel-admin .ui-state-highlight p { */ -/* margin: 0; */ -/* } */ -/* #travel-admin .ui-icon { */ -/* float: left; */ -/* margin-right: .3em; */ -/* display: block; */ -/* } */ -/* #tabs li a { */ -/* font-size: 13px; */ -/* font-size: 1.3rem; */ -/* } */ #travel-admin .tsLog { margin: 10px 0; border-top: 1px dotted #369; @@ -341,12 +334,6 @@ div.webform table, div.webform td { /* Member travel leads */ #file_export fieldset { - /* border-width: 2px; */ - /* border-style: groove; */ - /* border-color: grey; */ - /* position: relative; */ - /* width: 90%; */ - /* padding: 30px; */ } .clearfix { display: inline-block; @@ -379,7 +366,6 @@ div.webform table, div.webform td { display: inline-block; } - /* Members Travel Leads */ #intTogParent, #disTogParent, #intTogParent2, #intTogParent1, #locTogParent { diff --git a/index.php b/index.php index b827350..9f14c7a 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if (!defined('ABSPATH')) { * version from this plugin. */ define('GLM_MEMBERS_TRAVEL_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_TRAVEL_PLUGIN_DB_VERSION', '0.0.3'); +define('GLM_MEMBERS_TRAVEL_PLUGIN_DB_VERSION', '0.0.4'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_TRAVEL_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); diff --git a/models/admin/ajax/leadPdfExport.php b/models/admin/ajax/leadPdfExport.php index 484fa43..cf89f04 100644 --- a/models/admin/ajax/leadPdfExport.php +++ b/models/admin/ajax/leadPdfExport.php @@ -212,31 +212,86 @@ class GlmMembersAdmin_ajax_leadPdfExport extends GlmDataTravelLeads $contacts = $this->formatContacts( $lead['contacts'] ); $referred_by = $this->formatReferredBy( $lead['refs'] ); - $pdf->ezText( $lead['company'], $size ); + $curY = $pdf->ezText( $lead['company'], $size ); + $saveY = $curY; $pdf->selectFont( $mainFont ); - $pdf->ezText( $lead['address'], $size ); - $pdf->ezText( $lead['city'] . ', ' . $lead['state']['value'] . ' ' . $lead['zip'], $size ); - $pdf->ezText( $lead['website'], $size ); - $pdf->ezText( "\n", $size ); + $curY = $pdf->ezText( $lead['address'], $size ); + $curY = $pdf->ezText( $lead['city'] . ', ' . $lead['state']['value'] . ' ' . $lead['zip'], $size ); + if ( $lead['website'] ) { + $curY = $pdf->ezText( $lead['website'], $size ); + } + if ( $lead['phone'] ) { + $pdf->ezText( 'Phone: ' . $lead['phone'], $size, $option ); + } + if ( $lead['fax'] ) { + $pdf->ezText( 'Fax: ' . $lead['fax'], $size, $option ); + } + $curY = $pdf->ezText( "\n", $size ); + $endMainY = $curY; + + // Main contact + $pdf->ezSetY( $saveY + 10 ); + $option = array( + 'left' => 310 + ); + $lead_contact = ''; + if ( $lead['fname'] ) { + $lead_contact .= $lead['fname'] . ' ' . $lead['lname']; + } + if ( $lead['title'] ) { + $lead_contact .= ', ' . $lead['title']; + } + $pdf->ezText( $lead_contact, $size, $option ); + if ( $lead['email'] ) { + $pdf->ezText( $lead['email'], $size, $option ); + } + $curY = $pdf->ezText( "\n", $size ); + // Contacts if ( $lead['contacts'] ) { + $pdf->ezSetY( $endMainY ); + $curY = $pdf->ezText( 'Additional Contacts', $size ); + $column = 1; + $saveY = $curY; + $contact_string = ''; foreach ( $lead['contacts'] as $contact ) { - $pdf->ezText( $contact['name'], $size ); - $pdf->ezText( $contact['email'], $size ); - $pdf->ezText( $contact['phone'], $size ); - $pdf->ezText( "\n", $size ); - } - } - // Notes - if ( $lead['notes'] ) { - foreach ( $lead['notes'] as $note ) { - $pdf->selectFont( $mainFontBold ); - $pdf->ezText( $note['updated']['datetime'], $size ); - $pdf->selectFont( $mainFont ); - $pdf->ezText( $note['notes'], $size ); - $pdf->ezText( "\n", $size ); + if ( $column > 3 ) { + $column = 1; + $saveY = $curY; + } + if ( $column > 1 ) { + $pdf->ezSetY( $saveY ); + } + switch ( $column ) { + case 1: + $options = array( 'left' => 0 ); + break; + case 2: + $options = array( 'left' => 160 ); + break; + case 3: + $options = array( 'left' => 310 ); + break; + } + $contact_name = ''; + if ( $contact['name'] ) { + $contact_name .= $contact['name']; + } + if ( $contact['title'] ) { + $contact_name .= ', ' . $contact['title']; + } + $pdf->ezText( $contact_name, $size, $options ); + if ( $contact['email'] ) { + $pdf->ezText( $contact['email'], $size, $options ); + } + if ( $contact['phone'] ) { + $pdf->ezText( $contact['phone'], $size, $options ); + } + $curY = $pdf->ezText( "\n", $size ); + $column++; } } + // Referred By if ( $lead['refs'] ) { $pdf->selectFont( $mainFontBold ); @@ -247,6 +302,16 @@ class GlmMembersAdmin_ajax_leadPdfExport extends GlmDataTravelLeads } $pdf->ezText( "\n", $size ); } + // Notes + if ( $lead['notes'] ) { + foreach ( $lead['notes'] as $note ) { + $pdf->selectFont( $mainFontBold ); + $pdf->ezText( $note['updated']['datetime'], $size ); + $pdf->selectFont( $mainFont ); + $pdf->ezText( $note['notes'], $size ); + $pdf->ezText( "\n", $size ); + } + } $lead_count++; } diff --git a/models/admin/ajax/travelContacts.php b/models/admin/ajax/travelContacts.php index 419a7c2..5888f48 100644 --- a/models/admin/ajax/travelContacts.php +++ b/models/admin/ajax/travelContacts.php @@ -106,6 +106,7 @@ class GlmMembersAdmin_ajax_travelContacts extends GlmDataTravelContacts 'updated' => date( 'Y-m-d H:i:s' ), 'lead' => $lead_id, 'name' => filter_var( $_REQUEST['name'] ), + 'title' => filter_var( $_REQUEST['title'] ), 'email' => filter_var( $_REQUEST['email'] ), 'phone' => filter_var( $_REQUEST['phone'] ), @@ -113,6 +114,7 @@ class GlmMembersAdmin_ajax_travelContacts extends GlmDataTravelContacts array( '%s', // updated '%d', // lead + '%s', // title '%s', // name '%s', // email '%s', // phone diff --git a/models/admin/ajax/travelReferredby.php b/models/admin/ajax/travelReferredby.php index 7700459..5f2ac0d 100644 --- a/models/admin/ajax/travelReferredby.php +++ b/models/admin/ajax/travelReferredby.php @@ -133,7 +133,6 @@ class GlmMembersAdmin_ajax_travelReferredBy extends GlmDataReferredBy default: $lead_id = filter_var( $_REQUEST['lead_id'], FILTER_VALIDATE_INT ); $allReferredBy = $this->getList(); - // echo '
$allReferredBy: ' . print_r( $allReferredBy, true ) . '
'; $LeadReferredBy = new GlmDataTravelLeadsReferredBy( $this->wpdb, $this->config ); $leadReferredByData = $LeadReferredBy->getList( "T.lead = $lead_id" ); if ( $leadReferredByData ) { @@ -142,6 +141,10 @@ class GlmMembersAdmin_ajax_travelReferredBy extends GlmDataReferredBy } } + // Sort results by hierarchy (Parent/Child and Alpha) + $allReferredBy = $this->sortParentChild($allReferredBy); + // echo '
$allReferredBy: ' . print_r( $allReferredBy, true ) . '
'; + $view = 'list.html'; break; } diff --git a/setup/databaseScripts/create_database_V0.0.3.sql b/setup/databaseScripts/create_database_V0.0.3.sql index ac012da..ac3c647 100644 --- a/setup/databaseScripts/create_database_V0.0.3.sql +++ b/setup/databaseScripts/create_database_V0.0.3.sql @@ -15,6 +15,7 @@ CREATE TABLE {prefix}leads ( status INT NOT NULL DEFAULT 0, -- Lead Status (active, inactive) create_date DATE NOT NULL, -- Date contact was created updated DATETIME NOT NULL, -- Updated Timestamp + title TEXT NULL, -- Title of Lead fname TEXT NULL, -- First Name lname TEXT NULL, -- Last Name email TINYTEXT NULL, -- Email @@ -78,6 +79,7 @@ CREATE TABLE {prefix}lead_contacts ( id INT NOT NULL AUTO_INCREMENT, lead INT NOT NULL, -- Reference to lead table updated DATETIME NOT NULL, -- Updated Timestamp + title TINYTEXT NULL, -- Title of Contact name TINYTEXT, -- Name of Contact email TINYTEXT, -- Email of Contact phone TINYTEXT, -- Phone of Contact diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 078f484..afded64 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -29,5 +29,6 @@ $glmMembersTravelDbVersions = array( '0.0.1' => array('version' => '0.0.1', 'tables' => 4, 'date' => '05/18/18'), '0.0.2' => array('version' => '0.0.2', 'tables' => 5, 'date' => '05/23/18'), '0.0.3' => array('version' => '0.0.3', 'tables' => 6, 'date' => '05/31/18'), + '0.0.4' => array('version' => '0.0.4', 'tables' => 6, 'date' => '06/07/18'), ); diff --git a/setup/databaseScripts/update_database_V0.0.4.sql b/setup/databaseScripts/update_database_V0.0.4.sql new file mode 100644 index 0000000..90e837b --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.4.sql @@ -0,0 +1,15 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 05/31/2018 +-- Database Version: 0.0.3 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Add Title to lead +ALTER TABLE {prefix}leads ADD title TEXT NULL; -- Title for lead + +---- + +-- Add Title to lead_contacts +ALTER TABLE {prefix}leads_contacts ADD TINYTEXT NULL; -- Title for Contact diff --git a/views/admin/ajax/contacts/list.html b/views/admin/ajax/contacts/list.html index 44a2f85..aa09613 100644 --- a/views/admin/ajax/contacts/list.html +++ b/views/admin/ajax/contacts/list.html @@ -7,17 +7,21 @@
Add New Contact + + + + - + - + - +
@@ -31,6 +35,7 @@ {* List of contacts *} + @@ -40,6 +45,7 @@ {if $contacts} {foreach $contacts as $c} + diff --git a/views/admin/ajax/notes/list.html b/views/admin/ajax/notes/list.html index d7a2e3e..bc6791c 100644 --- a/views/admin/ajax/notes/list.html +++ b/views/admin/ajax/notes/list.html @@ -11,7 +11,7 @@ {if $notes} {foreach $notes as $n}
-

{$n.updated.datetime}

+

{$n.updated.datetime} 

{$n.notes|nl2br}

Title Name Phone Email
{$c.title} {$c.name} {$c.phone} {$c.email}
Referred By
{foreach $referredby as $r} - + {if $r.parent.value == 0} +

{$r.name}

+ {else} + + {/if} {/foreach}
Company: - + {if $lead.fieldFail.company}

{$lead.fieldFail.company}

{/if}
First Name: - - {if $lead.fieldFail.fname}

{$lead.fieldFail.fname}

{/if} -
Last Name: - - {if $lead.fieldFail.lname}

{$lead.fieldFail.lname}

{/if} -
Address: - + {if $lead.fieldFail.address}

{$lead.fieldFail.address}

{/if}
Address 2: - + {if $lead.fieldFail.address2}

{$lead.fieldFail.address2}

{/if}
City: - + {if $lead.fieldFail.city}

{$lead.fieldFail.city}

{/if}
ZIP/Postal Code: - + {if $lead.fieldFail.zip}

{$lead.fieldFail.zip}

{/if}
Title: + + {if $lead.fieldFail.title}

{$lead.fieldFail.title}

{/if} +
First Name: + + {if $lead.fieldFail.fname}

{$lead.fieldFail.fname}

{/if} +
Last Name: + + {if $lead.fieldFail.lname}

{$lead.fieldFail.lname}

{/if} +
Email: - + {if $lead.fieldFail.email}

{$lead.fieldFail.email}

{/if}
Phone: - + {if $lead.fieldFail.phone}

{$lead.fieldFail.phone}

{/if}
Fax: - + {if $lead.fieldFail.fax}

{$lead.fieldFail.fax}

{/if}
Website: - + {if $lead.fieldFail.website}

{$lead.fieldFail.website}

{/if}