From 1c31d150680ae5d320edb063c7d4d1253c14eaba Mon Sep 17 00:00:00 2001 From: QuickCRM Date: Wed, 27 Jun 2018 09:42:07 +0200 Subject: [PATCH] Update genJSfromSugar.php Add support for Google Maps keys --- modules/Administration/genJSfromSugar.php | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/modules/Administration/genJSfromSugar.php b/modules/Administration/genJSfromSugar.php index e7e3f12..ecfa5d6 100644 --- a/modules/Administration/genJSfromSugar.php +++ b/modules/Administration/genJSfromSugar.php @@ -218,10 +218,26 @@ function createDefaultLocalization() { $str .= ' aos_installed = false,'; } $str .= ' securitysuite = '.(in_array ('SecurityGroups',$moduleList)?'true':'false').','; - $str .= ' offline_max_days = 0;'; - $str .= 'var quickcrm_upd_time = "'.time().'";'; - $str .= "var CustomHTML=".(file_exists("custom/QuickCRM/home.html")?"true":"false").";"; - $str .= "var CustomJS=".(file_exists("custom/QuickCRM/custom.js")?"true":"false").";"; + $str .= ' offline_max_days = 0;'; + $str .= 'var quickcrm_upd_time = "'.time().'";'; + + $google_key = ''; + if (isset($administration->settings['jjwg_google_maps_api_key'])){ + $google_key=$administration->settings['jjwg_google_maps_api_key']; + } + else if (isset($sugar_config['google_maps_api_key'])) { + $google_key = $sugar_config['google_maps_api_key']; + } + if ($google_key !='') { + $str .= 'QCRM.google_api_key="'.$google_key.'";'; + } + if (isset($sugar_config['google_api_ios_key'])) { + $str .= 'QCRM.google_api_ios_key="'.$sugar_config['google_api_ios_key'].'";'; + } + if (isset($sugar_config['google_api_android_key'])) { + $str .= 'QCRM.google_api_android_key="'.$sugar_config['google_api_android_key'].'";'; + } + $saveDir = realpath(dirname(__FILE__).'/../../../mobile/');