Menu

REQUEST_DENIED when geocoding in CustomerBranches.php

JanB
2021-02-28
2021-06-21
  • JanB

    JanB - 2021-02-28

    The API key is missing In line 113 causing Google geocoding request message: REQUEST_DENIED

    Change line 113 fix that:

    $request_url = $base_url . $address . ',&sensor=true';
    

    to:

    $request_url = $base_url . $address . "&key=" . KEY . '&sensor=true';
    

    Isn't there a bug reporting forum somewhere?

     

    Last edit: Paul 2021-02-28
  • Paul

    Paul - 2021-02-28

    Thanks for the report and the fix, Jan!

    A similar change was needed in a few other places too.
    The GitLab commit credited to you.

    Yes, there is a webERP forum for bugs, development discussions, and more.

     
  • JanB

    JanB - 2021-02-28

    Thanks Paul for quick answer, and link to the bugs, development etc.
    i knew it was there in the "old days" :)

     
  • JanB

    JanB - 2021-03-05

    Paul, i discovered a typo (double quote AND single quote) in Suppliers.php when updating my files
    Line 418:

    $request_url = $base_url . $address . '&key="'. KEY . '&sensor=true';
    

    should be:

    $request_url = $base_url . $address . '&key=' . KEY . '&sensor=true';
    
     

    Last edit: Paul 2021-03-06
  • Paul

    Paul - 2021-03-06

    Doh! ... thought I double-checked all those!

    Thanks for the report Jan, file updated.

     

    Last edit: Paul 2021-03-06
  • JanB

    JanB - 2021-03-06

    One more error in geocoding scripts;

    <geocoderesponse>
    <status>REQUEST_DENIED</status>
    <error_message>Requests to this API must be over SSL. Load the API with "https://" instead of "http://".</error_message>
    </geocoderesponse>

    So change to https in:
    1. Suppliers.php Line 417
    2. CustomerBranches.php Line 112
    3. geocode.php Line 40
    4. geo_displaymap_customers.php Line 34
    5. geo_displaymap_suppliers.php Line 34
    6. SelectCustomer.php is OK but
    deleted line 619
    changed line 618 to:

    <script src="https://' . $map_host . '/maps/api/js?key=' . $API_key . '&callback=initMap"></script>;
    

    I am sure there should be more cleanup reg. geocoding.
    At my production site (v.4.12.3 ) everything works fine showing maps, but at my developer site (4.15.1) no maps shows up, no JavaScript error messages, just an empty page (??)
    Have to dive deeper into this, but for now, just trying to find obvious errors in code.
    Maybe we should wait a bit before commit changes to GitHub?

    Jan

     

    Last edit: Paul 2021-03-07
  • Paul

    Paul - 2021-03-06

    I'll commit as we go, I don't have an API key to test, so your efforts are helpful.

    sounds like that area broke sometime between 4.12 and 4.15, there have been some minor changes to geocoding since then.

     
  • JanB

    JanB - 2021-03-06

    Thank's Paul
    Will go through the branches and see what i can find.

     
  • Paul

    Paul - 2021-03-07
     
  • JanB

    JanB - 2021-03-10

    Hi Paul
    I have re-wrote most of the code in GeoIntegration for Google Maps API v3 for
    SelectCusomer.php and SelectSupplier.php
    and converted the code from Google Maps API v2 to v3 for
    geo_displaymap_customers.php and geo_displaymap_suppliers.php, (that's why those pages didn't show anything)
    For the last two files I struggled to find a way but found the solution from a site, and the "missing" piece from another, should these been credited? ...but I did some changes but don't want to be credited for others work.
    https://www.creare.co.uk/blog/js/loading-google-map-markers-via-xml
    https://stackoverflow.com/questions/32922017/google-maps-individual-marker-infowindow-how-to
    Btw, "sensor=false" is deprecated in v3 so I dropped that.
    This is too much code changes, so I decided to attach all four files in a zip-file if that's ok?

     
  • Paul

    Paul - 2021-03-13

    Thanks, yes, that is ok. I've haven't yet had a chance to take a look, but I will.

     

    Last edit: Paul 2021-03-13
  • David Jones

    David Jones - 2021-03-25

    Thanks for this mygroundbiz

     
  • Couponswa com

    Couponswa com - 2021-06-04

    I'll commit as we go, I don't have an API key to test, so your efforts are helpful.
    Really, I hope it's always true | couponswa

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.