Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
02-22-2016, 01:06 AM, (This post was last modified: 02-22-2016, 06:51 AM by janb.)
GeoIntegration for Google Maps (v3) does not work for me with http requests (showing a blank map), only with https (SSL)
Has anyone else experienced this?
I can't see anything in API Manager (Google Developers Console) about SSL and whenever this is mandatory or not.
FYI i only accept SSL on my Apache Server for WebERP.

Changing SelectSupplier.php line 42 from:
echo '<script src=";v=2&amp;key=' . $api_key . '"';
echo '<script src=";v=2&amp;key=' . $api_key . '"';

The same with
geo_displaymap_suppliers.php Line 35
SelectCustomer.php Line 55
geo_displaymap_customers.php Line 35
geocode.php Line 40

..and everything looks good.

Found the source of this problem.
My web-browser is blocking "Mixed-Content"
Error message from javascript console:
Mixed Content: The page at https://(my server url) was loaded over HTTPS, but received an insecure script ''
This request has been blocked; the content must be served over HTTPS.

Suppose this could be fixed by using $_SERVER['HTTPS']
For example:
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
    $Map_Host = 'https://' . $myrow['map_host'];
} else {
    $Map_Host = 'http://' . $myrow['map_host'];

and change
echo '<script src="http://' . $Map_Host . '/maps/api/js?key=' . $Api_Key . '&sensor=false"';
echo '<script src="' . $Map_Host . '/maps/api/js?key=' . $Api_Key . '&sensor=false"';

Another minor problem in both SelectCustomer.php and SelectSupplier.php is that map does not show when a Customer or Supplier is selected from Search.
A message show: "Mapping is enabled, but no Mapping data to display for this Customer"
After a page refresh map shows up as it should.

Edit SelectSupplier.php at line 18 should fix this:

} else if (isset($_POST['Select']) AND $_POST['Select'] != 0) {

For SelectCustomer.php its a bit more trickier
$_SESSION['CustomerID'] is not set before line 203.
Is it a problem moving this code lines up before geocode lines starting on line 28?
if (isset($_POST['JustSelectedACustomer'])) {
    /*Need to figure out the number of the form variable that the user clicked on */
    for ($i = 0; $i < count($_POST); $i++) { //loop through the returned customers
        if (isset($_POST['SubmitCustomerSelection' . $i])) {
    } //end loop through $_POST array
    if ($i == count($_POST)) {
        prnMsg(_('Unable to identify the selected customer'), 'error');
    } else {
        $_SESSION['CustomerID'] = $_POST['SelectedCustomer' . $i];
        $_SESSION['BranchCode'] = $_POST['SelectedBranch' . $i];
} // end if Just Selected A Customer

This works fine for me but it could of course be something I've overlooked..

02-29-2016, 11:48 PM,
RE: GeoIntegration
Had a closer look at this and discovered a missing condition to the geocode SQL
Also, this script is using Goggle maps API v.2, should be upgraded to v.3

WHERE debtorsmaster.debtorno = '" . $_SESSION['CustomerID'] . "'
AND custbranch.branchcode = '" . $_SESSION['BranchCode'] . "'
03-01-2016, 11:02 AM,
RE: GeoIntegration
Hi, Jan,

Thank you for your contribution, I'll commit your change later.
Best regards!

03-02-2016, 06:24 AM, (This post was last modified: 03-02-2016, 10:05 AM by janb.)
RE: GeoIntegration
Thanks Exon

I have done some further modification to SelectCustomer.php for my own convenience.

* Some improvement to how to detect SubmitCustomerSelection
* Updated to Google Maps API v.3
* Updated Google Map links to https
* Integrated code lines from ceocode.php to update Customers (custbranch table) without lat (0) but width brpostaddr1
* Added code to show Branch Contact when branch is selected (beneath Customer Contacts)

If this is of interest i can submit this as a diff (after some cleanup)

Update: Done cleanup and submitted diff

03-02-2016, 11:25 AM,
RE: GeoIntegration
Hi, Jan,

Thank you very much!

You can post it and I'll merge it to trunk when I return back to my office.

Thanks and best regards!

04-25-2016, 08:03 PM,
RE: GeoIntegration
Just applied this ... sorry for the delay Jan!
Phil Daintree
webERP Admin
Logic Works Ltd

Forum Jump:

Users browsing this thread: 1 Guest(s)