|
From: <afc...@us...> - 2017-09-18 22:09:36
|
Revision: 7836
http://sourceforge.net/p/web-erp/reponame/7836
Author: afcouling
Date: 2017-09-18 22:09:33 +0000 (Mon, 18 Sep 2017)
Log Message:
-----------
Geocode bug fixes. http://www.weberp.org/forum/showthread.php?tid=4380
Modified Paths:
--------------
trunk/CustomerBranches.php
trunk/SelectSupplier.php
trunk/Suppliers.php
trunk/doc/Change.log
Modified: trunk/CustomerBranches.php
===================================================================
--- trunk/CustomerBranches.php 2017-09-17 01:39:01 UTC (rev 7835)
+++ trunk/CustomerBranches.php 2017-09-18 22:09:33 UTC (rev 7836)
@@ -109,25 +109,18 @@
// check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway.
echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>';
} else {
- $address = $_POST['BrAddress1'] . ', ' . $_POST['BrAddress2'] . ', ' . $_POST['BrAddress3'] . ', ' . $_POST['BrAddress4'];
- $base_url = 'http://' . MAPS_HOST . '/maps/geo?output=xml&key=' . KEY;
- $request_url = $base_url . '&q=' . urlencode($address);
+ $address = urlencode($_POST['BrAddress1'] . ', ' . $_POST['BrAddress2'] . ', ' . $_POST['BrAddress3'] . ', ' . $_POST['BrAddress4']);
+ $base_url = "http://" . MAPS_HOST . "/maps/api/geocode/xml?address=";
+ $request_url = $base_url . $address . ',&sensor=true';
$xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or die('url not loading');
- $Coordinates = $xml->Response->Placemark->Point->Coordinates;
- $CoordinatesSplit = explode(",", $Coordinates);
- // Format: Longitude, Latitude, Altitude
- $Latitude = $CoordinatesSplit[1];
- $Longitude = $CoordinatesSplit[0];
- $Status = $xml->Response->Status->code;
- if (strcmp($Status, '200') == 0) {
+ $Status = $xml->status;
+ if (strcmp($Status, 'OK') == 0) {
// Successful geocode
$Geocode_Pending = false;
- $Coordinates = $xml->Response->Placemark->Point->Coordinates;
- $CoordinatesSplit = explode(",", $Coordinates);
// Format: Longitude, Latitude, Altitude
- $Latitude = $CoordinatesSplit[1];
- $Longitude = $CoordinatesSplit[0];
+ $Latitude = $xml->result->geometry->location->lat;
+ $Longitude = $xml->result->geometry->location->lng;
} else {
// failure to geocode
$Geocode_Pending = false;
Modified: trunk/SelectSupplier.php
===================================================================
--- trunk/SelectSupplier.php 2017-09-17 01:39:01 UTC (rev 7835)
+++ trunk/SelectSupplier.php 2017-09-18 22:09:33 UTC (rev 7836)
@@ -16,6 +16,16 @@
if (isset($_GET['SupplierID'])) {
$_SESSION['SupplierID']=$_GET['SupplierID'];
}
+if (isset($_POST['Select'])) { /*User has hit the button selecting a supplier */
+ $_SESSION['SupplierID'] = $_POST['Select'];
+ unset($_POST['Select']);
+ unset($_POST['Keywords']);
+ unset($_POST['SupplierCode']);
+ unset($_POST['Search']);
+ unset($_POST['Go']);
+ unset($_POST['Next']);
+ unset($_POST['Previous']);
+}
// only get geocode information if integration is on, and supplier has been selected
if ($_SESSION['geocode_integration'] == 1 AND isset($_SESSION['SupplierID'])) {
$sql = "SELECT * FROM geocode_param WHERE 1";
@@ -39,7 +49,7 @@
$map_height = $myrow['map_height'];
$map_width = $myrow['map_width'];
$map_host = $myrow['map_host'];
- echo '<script src="http://maps.google.com/maps?file=api&v=2&key=' . $api_key . '"';
+ echo '<script src="https://maps.google.com/maps?file=api&v=2&key=' . $api_key . '"';
echo ' type="text/javascript"></script>';
echo ' <script type="text/javascript">';
echo 'function load() {
@@ -67,16 +77,6 @@
$_POST['PageOffset'] = 1;
}
}
-if (isset($_POST['Select'])) { /*User has hit the button selecting a supplier */
- $_SESSION['SupplierID'] = $_POST['Select'];
- unset($_POST['Select']);
- unset($_POST['Keywords']);
- unset($_POST['SupplierCode']);
- unset($_POST['Search']);
- unset($_POST['Go']);
- unset($_POST['Next']);
- unset($_POST['Previous']);
-}
if (isset($_POST['Search'])
OR isset($_POST['Go'])
OR isset($_POST['Next'])
Modified: trunk/Suppliers.php
===================================================================
--- trunk/Suppliers.php 2017-09-17 01:39:01 UTC (rev 7835)
+++ trunk/Suppliers.php 2017-09-18 22:09:33 UTC (rev 7836)
@@ -422,29 +422,22 @@
if ($map_host=="") {
echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>';
} else {
- $address = $_POST['Address1'] . ', ' . $_POST['Address2'] . ', ' . $_POST['Address3'] . ', ' . $_POST['Address4'] . ', ' . $_POST['Address5']. ', ' . $_POST['Address6'];
+ $address = urlencode($_POST['Address1'] . ', ' . $_POST['Address2'] . ', ' . $_POST['Address3'] . ', ' . $_POST['Address4'] . ', ' . $_POST['Address5'] . ', ' . $_POST['Address6']);
+ $base_url = "http://" . MAPS_HOST . "/maps/api/geocode/xml?address=";
+ $request_url = $base_url . $address . ',&sensor=true';
- $base_url = 'http://' . MAPS_HOST . '/maps/geo?output=xml' . '&key=' . KEY;
- $request_url = $base_url . '&q=' . urlencode($address);
-
- $xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or prnMsg(_('Goole map url not loading'),'warn');
+ $xml = simplexml_load_string(utf8_encode(file_get_contents($request_url))) or die("url not loading");
// $xml = simplexml_load_file($request_url) or die("url not loading");
$coordinates = $xml->Response->Placemark->Point->coordinates;
- $coordinatesSplit = explode(',', $coordinates);
- // Format: Longitude, Latitude, Altitude
- $latitude = $coordinatesSplit[1];
- $longitude = $coordinatesSplit[0];
- $status = $xml->Response->Status->code;
- if (strcmp($status, '200') == 0) {
+ $status = $xml->status;
+ if (strcmp($status, 'OK') == 0) {
// Successful geocode
$geocode_pending = false;
- $coordinates = $xml->Response->Placemark->Point->coordinates;
- $coordinatesSplit = explode(",", $coordinates);
// Format: Longitude, Latitude, Altitude
- $latitude = $coordinatesSplit[1];
- $longitude = $coordinatesSplit[0];
+ $latitude = $xml->result->geometry->location->lat;
+ $longitude = $xml->result->geometry->location->lng;
} else {
// failure to geocode
$geocode_pending = false;
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2017-09-17 01:39:01 UTC (rev 7835)
+++ trunk/doc/Change.log 2017-09-18 22:09:33 UTC (rev 7836)
@@ -1,5 +1,6 @@
webERP Change Log
+18/9/2017 Tim (committed by Andy): Geocode bug fixes. http://www.weberp.org/forum/showthread.php?tid=4380
17/9/17 VortecCPI: SelectProduct.php made image dispay code match that used in WorkOrderEntry.php
11/9/17 Andy Couling: Fixed the onclick delete confirmation box call in ContractBOM.php, was 'MakeConfirm'.
11/9/17 Andy Couling: Code consistency in PO_Items.php. http://www.weberp.org/forum/showthread.php?tid=4355
|