Skip to content

Commit

Permalink
Merge branch 'release/v0.21.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenarslan committed Jul 10, 2024
2 parents aee83e0 + d8130ef commit 50bea4c
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 12 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [v0.21.4] - 10.07.2024
- implement JS changes for material design too
- bug fix for default session code regex
- default to exporting items when exporting run JSONs
- all newly created surveys have a default field "iteration" which is simply an auto-increment number from 1 to number of responses to survey

## [v0.21.3] - 21.06.2024
- autoset timezone for timezone inputs
- make user id/session code length flexible/configurable
- webshim number inputs to make the regional number formatting configurable

## [v0.21.2] - 02.06.2024
- bug fix (minify changed JS correctly)

## [v0.21.1] - 01.06.2024
- simplify integration with labjs et al by
- not changing file names on upload
- allowing larger amounts of data to be stored in text fields
- allowing uploadable file types to be configurable
- add Reply-To option for email accounts
- allow default email accounts to be configured in settings.php, Reply-To defaults to admin email address
- allow superadmins to manually set admin account email addresses as verified


## [v0.21.0] - 07.03.2024
- make it easier to dockerise formr
- track bower_components to make it easier to collaborate on changes in CSS/JS
- improve cookie handling, so that formr works similarly, whether you use study-specific subdomains or not.

## [v0.20.7] - 02.05.2023


## [v0.20.7] - 02.05.2023
### Fixed
* Adding SMTP accounts that do not support password
Expand Down
8 changes: 3 additions & 5 deletions application/Model/SurveyStudy.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ private function getResultsTableSyntax($columns) {
CREATE TABLE `{$this->results_table}` (
`session_id` INT UNSIGNED NOT NULL ,
`study_id` INT UNSIGNED NOT NULL ,
`iteration` INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,
`created` DATETIME NULL DEFAULT NULL ,
`modified` DATETIME NULL DEFAULT NULL ,
`ended` DATETIME NULL DEFAULT NULL ,
Expand Down Expand Up @@ -704,10 +705,7 @@ public function getResults($items = null, $filter = null, array $paginate = null
);
*/
} else {
$columns = array('survey_run_sessions.session', "`{$results_table}`.`created`", "`{$results_table}`.`modified`", "`{$results_table}`.`ended`, `survey_unit_sessions`.`expired`");
}
foreach ($items as $item) {
$columns[] = "{$results_table}.{$item}";
$columns = array('survey_run_sessions.session', "`{$results_table}`.*");
}

$select = $this->db->select($columns)
Expand Down Expand Up @@ -957,7 +955,7 @@ public function deleteResults($run_id = null) {
return true;
} elseif ($run_id !== null) {
//@todo implement deleting results only for a particular run
$this->error[] = 'Deleting run specific results for a survey is not yet implemented';
$this->errors[] = 'Deleting run specific results for a survey is not yet implemented';
return false;
} elseif ($this->backupResults()) {
$delete = $this->db->query("TRUNCATE TABLE `{$this->results_table}`");
Expand Down
8 changes: 8 additions & 0 deletions application/Model/UnitSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,17 @@ protected function getRunDataNeeded($q, $token_add = null) {
$items = $this->db->select('name')->from('survey_items')
->where(['study_id' => $study_id])
->where("type NOT IN ('mc_heading', 'note', 'submit', 'block', 'note_iframe')")
->where("name != 'iteration'")
->fetchAll();

$variable_names_in_table[$table_name] = array("created", "modified", "ended"); // should avoid modified, sucks for caching
$res_table = $results_tables[$table_name];
$has_iter = $this->db->prepare("DESCRIBE `$res_table` `iteration`");
$has_iter->execute();
if($has_iter->fetch(PDO::FETCH_ASSOC) !== false) {
$variable_names_in_table[$table_name][] = "iteration";
}

foreach ($items as $res) {
$variable_names_in_table[$table_name][] = $res['name']; // search set for user defined tables
}
Expand Down
2 changes: 1 addition & 1 deletion application/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function expire_session($expiry) {
public function loginUser($user) {
// came here with a login link
$code_rule = Config::get("user_code_regular_expression");
pr($_GET['code']);die;

if (isset($_GET['run_name']) && isset($_GET['code']) && preg_match($code_rule, $_GET['code'])) {
$login_code = $_GET['code'];
// this user came here with a session code that he wasn't using before.
Expand Down
2 changes: 1 addition & 1 deletion application/Spreadsheet/SpreadsheetReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ private function readSurveySheet(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $
$this->errors[] = __("The variable name '%s' is invalid. It has to be between 1 and 64 characters. It needs to start with a letter and can only contain the characters from <strong>a</strong> to <strong>Z</strong>, <strong>0</strong> to <strong>9</strong> and the underscore.", $cellValue);
}

if (in_array($cellValue, array('session_id', 'created', 'modified', 'ended', 'id', 'study_id'))) {
if (in_array($cellValue, array('session_id', 'created', 'modified', 'ended', 'id', 'study_id', 'iteration'))) {
$this->errors[] = __("Row %s: variable name '%s' is not permitted.", $rowNumber, $cellValue);
}

Expand Down
2 changes: 1 addition & 1 deletion config-dist/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
$settings['display_errors'] = 0;
$settings['error_to_stderr'] = 0;

$settings['user_code_regular_expression'] = "/^[A-Za-z0-9+]{64}$/";
$settings['user_code_regular_expression'] = "/^[A-Za-z0-9+-_~]{64}$/";

// Session expiration related settings
// (for unregistered users. in seconds (defaults to a year))
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

define('FORMR_VERSION', 'v0.21.3');
define('FORMR_VERSION', 'v0.21.4');

define('APPLICATION_ROOT', __DIR__ . '/');
define('INCLUDE_ROOT', APPLICATION_ROOT);
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/run/run_modals.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<div class="col-md-6">
<div class="form-group checkbox">
<label><input type="checkbox" name="include_survey_details" value="true"> Include Survey Details </label>
<label><input type="checkbox" name="include_survey_details" value="true" checked> Include survey items </label>
</div>
</div>
<div class="clearfix"></div>
Expand Down
2 changes: 1 addition & 1 deletion webroot/assets/build/js/formr-material.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webroot/assets/build/js/formr.min.js

Large diffs are not rendered by default.

1 comment on commit 50bea4c

@cyriltata
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rubenarslan Please could you also document config changes in the changelog since v0.21.0? Upgrade from v0.20.x breaks otherwise for users not using docker.

Please sign in to comment.