From 50fa9dc194ec4a3b0d965db504c2e99307c49724 Mon Sep 17 00:00:00 2001 From: Nicolas Ducoulombier Date: Fri, 16 Nov 2018 09:37:50 +0100 Subject: [PATCH 1/8] Minor : change translation variable -refs BT#15033 --- main/survey/surveyUtil.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index 7f340a2d88..37e365d53f 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -2848,7 +2848,7 @@ class SurveyUtil ); $actions[] = Display::url( - Display::return_icon('multiplicate_survey.png', get_lang('MultiplicateSurvey')), + Display::return_icon('multiplicate_survey.png', get_lang('MultiplicateQuestions')), $codePath.'survey/survey_list.php?' .http_build_query($params + ['action' => 'multiplicate', 'survey_id' => $survey_id]) ); From a2e63833aeeee637839dbb5c9c1bdcd1567a78f9 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 16 Nov 2018 12:09:36 +0100 Subject: [PATCH 2/8] Fix survey export to xls/csv see BT#15033 --- main/survey/reporting.php | 12 +- main/survey/surveyUtil.class.php | 253 +++++++++++++++++-------------- 2 files changed, 143 insertions(+), 122 deletions(-) diff --git a/main/survey/reporting.php b/main/survey/reporting.php index 8ce4b1fac0..b9eea6ca35 100755 --- a/main/survey/reporting.php +++ b/main/survey/reporting.php @@ -62,21 +62,13 @@ if (!empty($exportReport) && !empty($format)) { switch ($format) { case 'xls': $filename = 'survey_results_'.$survey_id.'.xlsx'; - $data = SurveyUtil::export_complete_report_xls( - $survey_data, - $filename, - $userId - ); + $data = SurveyUtil::export_complete_report_xls($survey_data, $filename, $userId); exit; break; case 'csv': default: - $data = SurveyUtil::export_complete_report( - $survey_data, - $userId - ); + $data = SurveyUtil::export_complete_report($survey_data, $userId); $filename = 'survey_results_'.$survey_id.'.csv'; - header('Content-type: application/octet-stream'); header('Content-Type: application/force-download'); diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index 37e365d53f..c99310402a 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -225,7 +225,7 @@ class SurveyUtil */ public static function handle_reporting_actions($survey_data, $people_filled) { - $action = isset($_GET['action']) ? $_GET['action'] : null; + $action = isset($_GET['action']) ? $_GET['action'] : ''; // Getting the number of question $temp_questions_data = SurveyManager::get_questions($_GET['survey_id']); @@ -243,20 +243,22 @@ class SurveyUtil // Counting the number of questions that are relevant for the reporting $survey_data['number_of_questions'] = count($questions_data); - if ($action == 'questionreport') { - self::display_question_report($survey_data); - } - if ($action == 'userreport') { - self::display_user_report($people_filled, $survey_data); - } - if ($action == 'comparativereport') { - self::display_comparative_report(); - } - if ($action == 'completereport') { - self::display_complete_report($survey_data); - } - if ($action == 'deleteuserreport') { - self::delete_user_report($_GET['survey_id'], $_GET['user']); + switch ($action) { + case 'questionreport': + self::display_question_report($survey_data); + break; + case 'userreport': + self::display_user_report($people_filled, $survey_data); + break; + case 'comparativereport': + self::display_comparative_report(); + break; + case 'completereport': + self::display_complete_report($survey_data); + break; + case 'deleteuserreport': + self::delete_user_report($_GET['survey_id'], $_GET['user']); + break; } } @@ -373,7 +375,7 @@ class SurveyUtil echo '