From 1b73d0ec54ad7e8faa21052f37fb3d5b938e1911 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 19 May 2015 22:04:19 -0400 Subject: [PATCH] #204 Save lat/lon when creating new ticket --- inc/posting_functions.inc.php | 8 ++++++-- index.php | 12 ++++++++++++ install/mods-for-hesk/sql/installSql.php | 5 ++++- submit_ticket.php | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/inc/posting_functions.inc.php b/inc/posting_functions.inc.php index bb0b81dd..6a518064 100644 --- a/inc/posting_functions.inc.php +++ b/inc/posting_functions.inc.php @@ -95,7 +95,9 @@ function hesk_newTicket($ticket, $isVerified = true) `custom18`, `custom19`, `custom20`, - `status` + `status`, + `latitude`, + `longitude` ) VALUES ( @@ -136,7 +138,9 @@ function hesk_newTicket($ticket, $isVerified = true) '".hesk_dbEscape($ticket['custom18'])."', '".hesk_dbEscape($ticket['custom19'])."', '".hesk_dbEscape($ticket['custom20'])."', - '".intval($ticket['status'])."' + '".intval($ticket['status'])."', + '".hesk_dbEscape($ticket['latitude'])."', + '".hesk_dbEscape($ticket['longitude'])."' ) "); diff --git a/index.php b/index.php index 408facee..334f0167 100644 --- a/index.php +++ b/index.php @@ -1002,6 +1002,8 @@ if ( ! isset($_SESSION['c_category']) && ! $hesk_settings['select_cat']) ?>
+ +
@@ -1025,6 +1027,16 @@ if ( ! isset($_SESSION['c_category']) && ! $hesk_settings['select_cat']) + requestUserLocation(); + + '; +} + hesk_cleanSessionVars('iserror'); hesk_cleanSessionVars('isnotice'); diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index bd06df5d..97974648 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -448,7 +448,10 @@ function execute230Scripts() { executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` SET `Key` = `ShortNameContentKey`"); executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` DROP COLUMN `ShortNameContentKey`"); executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` DROP COLUMN `TicketViewContentKey`"); - executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `Location` VARCHAR(100) NOT NULL DEFAULT 'N/A-0'"); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'"); executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.3.0' WHERE `Key` = 'modsForHeskVersion'"); } diff --git a/submit_ticket.php b/submit_ticket.php index eea8f368..44e6774f 100644 --- a/submit_ticket.php +++ b/submit_ticket.php @@ -427,6 +427,10 @@ if ($hesk_settings['attachments']['use'] && ! empty($attachments) ) } } +// Set latitude and longitude +$tmpvar['latitude'] = hesk_POST('latitude'); +$tmpvar['longitude'] = hesk_POST('longitude'); + // Should the helpdesk validate emails? $createTicket = true; if ($modsForHesk_settings['customer_email_verification_required'])