Skip to content

Commit

Permalink
Fixed issue #13111: Google Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Jan 8, 2018
1 parent b6c06ef commit 1713cd0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions application/controllers/admin/database.php
Expand Up @@ -72,6 +72,7 @@ class database extends Survey_Common_Action
'emailresponseto' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'emailnotificationto' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'googleanalyticsapikeysetting' => ['type'=> 'default', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'googleanalyticsapikey' => ['type'=> 'default', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'googleanalyticsstyle' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'tokenlength' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'adminemail' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
Expand Down Expand Up @@ -948,12 +949,14 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
$oSurvey->usecaptcha = Survey::saveTranscribeCaptchaOptions($oSurvey);
$oSurvey->emailresponseto = $this->_filterEmptyFields($oSurvey, 'emailresponseto');
$oSurvey->emailnotificationto = $this->_filterEmptyFields($oSurvey, 'emailnotificationto');
$oSurvey->googleanalyticsapikeysetting = $this->_filterEmptyFields($oSurvey, 'googleanalyticsapikeysetting');
if ($oSurvey->googleanalyticsapikeysetting == "Y") {
$googleanalyticsapikeysetting = $this->_filterEmptyFields($oSurvey, 'googleanalyticsapikeysetting');
$oSurvey->googleanalyticsapikeysetting = $googleanalyticsapikeysetting;

if ($googleanalyticsapikeysetting == "Y") {
$oSurvey->googleanalyticsapikey = $this->_filterEmptyFields($oSurvey, 'googleanalyticsapikey');
} elseif ($oSurvey->googleanalyticsapikeysetting == "G") {
} elseif ($googleanalyticsapikeysetting == "G") {
$oSurvey->googleanalyticsapikey = "9999useGlobal9999";
} elseif ($oSurvey->googleanalyticsapikeysetting == "N") {
} elseif ($googleanalyticsapikeysetting == "N") {
$oSurvey->googleanalyticsapikey = "";
}

Expand Down Expand Up @@ -1152,6 +1155,7 @@ private function _filterEmptyFields($oSurvey, $fieldArrayName, $newValue = null)
$newValue = trim($newValue);

$options = $this->updateableFields[$fieldArrayName];

switch ($options['type']) {
case 'yesno':
if ($newValue != 'Y' && $newValue != 'N') {
Expand All @@ -1161,7 +1165,7 @@ private function _filterEmptyFields($oSurvey, $fieldArrayName, $newValue = null)
break;
case 'Int':
$newValue = (int) $newValue;
break;
break;
}

return $newValue;
Expand Down

0 comments on commit 1713cd0

Please sign in to comment.