From 7ca9a2bfd16c90ccf4cc233af4b5c66b9ca624ce Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 9 Feb 2021 11:38:22 -0500 Subject: [PATCH] lp1863252 make Geo::Coder::Free optional Restore Geo::Coder::Google to the CPAN module list and remove the Googlev3 package. Geo::Coder::Google requires an API key, and Geo::Coder::Googlev3 purports not to but is currently giving a REQUEST_DENIED to requests and is a known issue. Signed-off-by: Jason Etheridge Signed-off-by: Terran McCanna --- Open-ILS/src/extras/install/Makefile.debian-buster | 3 +-- Open-ILS/src/extras/install/Makefile.debian-jessie | 3 +-- Open-ILS/src/extras/install/Makefile.debian-stretch | 3 +-- Open-ILS/src/extras/install/Makefile.fedora | 1 - Open-ILS/src/extras/install/Makefile.ubuntu-bionic | 3 +-- Open-ILS/src/extras/install/Makefile.ubuntu-focal | 3 +-- Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm | 15 ++++++++++++--- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/extras/install/Makefile.debian-buster b/Open-ILS/src/extras/install/Makefile.debian-buster index 0222574162..682f650e31 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-buster +++ b/Open-ILS/src/extras/install/Makefile.debian-buster @@ -41,7 +41,6 @@ export DEBS = \ libemail-mime-perl\ libexcel-writer-xlsx-perl\ libgd-graph3d-perl\ - libgeo-coder-googlev3-perl\ libgeo-coder-osm-perl\ liblocale-maketext-lexicon-perl\ liblog-log4perl-perl\ @@ -96,7 +95,7 @@ export DEB_APACHE_DISCONF = \ serve-cgi-bin export CPAN_MODULES = \ - Geo::Coder::Free \ + Geo::Coder::Google \ Business::OnlinePayment::PayPal \ Email::Send diff --git a/Open-ILS/src/extras/install/Makefile.debian-jessie b/Open-ILS/src/extras/install/Makefile.debian-jessie index e79c709e13..a10484bc86 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-jessie +++ b/Open-ILS/src/extras/install/Makefile.debian-jessie @@ -41,7 +41,6 @@ export DEBS = \ libemail-mime-perl\ libexcel-writer-xlsx-perl\ libgd-graph3d-perl\ - libgeo-coder-googlev3-perl\ libgeo-coder-osm-perl\ liblocale-maketext-lexicon-perl\ liblog-log4perl-perl\ @@ -97,7 +96,7 @@ export DEB_APACHE_DISCONF = \ serve-cgi-bin export CPAN_MODULES = \ - Geo::Coder::Free \ + Geo::Coder::Google \ Business::OnlinePayment::PayPal \ Email::Send diff --git a/Open-ILS/src/extras/install/Makefile.debian-stretch b/Open-ILS/src/extras/install/Makefile.debian-stretch index 2964b473a3..e773dd1602 100644 --- a/Open-ILS/src/extras/install/Makefile.debian-stretch +++ b/Open-ILS/src/extras/install/Makefile.debian-stretch @@ -41,7 +41,6 @@ export DEBS = \ libemail-mime-perl\ libexcel-writer-xlsx-perl\ libgd-graph3d-perl\ - libgeo-coder-googlev3-perl\ libgeo-coder-osm-perl\ liblocale-maketext-lexicon-perl\ liblog-log4perl-perl\ @@ -96,7 +95,7 @@ export DEB_APACHE_DISCONF = \ serve-cgi-bin export CPAN_MODULES = \ - Geo::Coder::Free \ + Geo::Coder::Google \ Business::OnlinePayment::PayPal \ Email::Send diff --git a/Open-ILS/src/extras/install/Makefile.fedora b/Open-ILS/src/extras/install/Makefile.fedora index ae6d4b03d0..754e6e1abb 100644 --- a/Open-ILS/src/extras/install/Makefile.fedora +++ b/Open-ILS/src/extras/install/Makefile.fedora @@ -72,7 +72,6 @@ FEDORA_RPMS = \ yaz export CPAN_MODULES = \ - Geo::Coder::Free \ Geo::Coder::OSM \ Geo::Coder::Google \ Excel::Writer::XLSX \ diff --git a/Open-ILS/src/extras/install/Makefile.ubuntu-bionic b/Open-ILS/src/extras/install/Makefile.ubuntu-bionic index ab6bfbc4fa..21525b2356 100644 --- a/Open-ILS/src/extras/install/Makefile.ubuntu-bionic +++ b/Open-ILS/src/extras/install/Makefile.ubuntu-bionic @@ -40,7 +40,6 @@ export DEBS = \ libemail-mime-perl\ libexcel-writer-xlsx-perl\ libgd-graph3d-perl\ - libgeo-coder-googlev3-perl\ libgeo-coder-osm-perl\ liblocale-maketext-lexicon-perl\ liblog-log4perl-perl\ @@ -92,7 +91,7 @@ export DEB_APACHE_DISCONF = \ serve-cgi-bin export CPAN_MODULES = \ - Geo::Coder::Free \ + Geo::Coder::Google \ Business::OnlinePayment::PayPal \ Email::Send \ MARC::Charset \ diff --git a/Open-ILS/src/extras/install/Makefile.ubuntu-focal b/Open-ILS/src/extras/install/Makefile.ubuntu-focal index e4d06ff63d..eba60febcd 100644 --- a/Open-ILS/src/extras/install/Makefile.ubuntu-focal +++ b/Open-ILS/src/extras/install/Makefile.ubuntu-focal @@ -40,7 +40,6 @@ export DEBS = \ libemail-mime-perl\ libexcel-writer-xlsx-perl\ libgd-graph3d-perl\ - libgeo-coder-googlev3-perl\ libgeo-coder-osm-perl\ liblocale-maketext-lexicon-perl\ liblog-log4perl-perl\ @@ -92,7 +91,7 @@ export DEB_APACHE_DISCONF = \ serve-cgi-bin export CPAN_MODULES = \ - Geo::Coder::Free \ + Geo::Coder::Google \ Business::OnlinePayment::PayPal \ Email::Send \ MARC::Charset \ diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm index 05874ded24..cb0d92adfb 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Geo.pm @@ -16,7 +16,11 @@ my $U = "OpenILS::Application::AppUtils"; use OpenSRF::Utils::Logger qw/$logger/; -use Geo::Coder::Free; +my $have_geocoder_free = eval { + require Geo::Coder::Free; + Geo::Coder::Free->import(); + 1; +}; use Geo::Coder::OSM; use Geo::Coder::Google; @@ -162,8 +166,13 @@ sub retrieve_coordinates { # invoke 3rd party API for latitude/longitude lookup my $geo_coder; eval { if ($service->service_code eq 'Free') { - $logger->debug("Using Geo::Coder::Free (service id $service_id)"); - $geo_coder = Geo::Coder::Free->new(); + if ($have_geocoder_free) { + $logger->debug("Using Geo::Coder::Free (service id $service_id)"); + $geo_coder = Geo::Coder::Free->new(); + } else { + $logger->error("geosort: Geo::Coder::Free not installed but referenced."); + return OpenILS::Event->new('GEOCODING_LOCATION_NOT_FOUND'); + } } elsif ($service->service_code eq 'Google') { $logger->debug("Using Geo::Coder::Google (service id $service_id)"); $geo_coder = Geo::Coder::Google->new(key => $service->api_key); -- 2.11.0