Skip to content

Commit

Permalink
Merge branch 'release/3.3.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbchase committed Oct 14, 2019
2 parents 0668063 + a87c08d commit 411414d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
All notable changes to the Form Render Skip Logic module will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).


## [3.3.10] - 2019-10-14
### Changed
- Document the limited repeating event support in FRSL (Philip Chase)
- Document how to use FRSL with surveys (Philip Chase)
- Go to correct instance when using Save and Go to Next Form (Kyle Chesney)
- Fix bug on Record Home wherein FRSL would quietly fail to hide forms when returning from Save and Exit Record (Kyle Chesney)
- Address cosmetic error caused by "Delete all data on event" row of Record Home (Kyle Chesney)


## [3.3.9] - 2019-10-11
### Changed
- Use only the records for the DAG if one is specified in Record Status Dashboard (Kyle Chesney)
Expand Down
12 changes: 7 additions & 5 deletions ExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function redcap_every_page_top($project_id) {
}

// Do not load FRSL on the add/edit record splash page
if ( strpos(PAGE, 'DataEntry/record_home.php') !== false && (!$_GET['arm'] || !$_GET['id']) ) {
if ( strpos(PAGE, 'DataEntry/record_home.php') !== false && !$_GET['id'] ) {
return;
}

Expand All @@ -59,12 +59,12 @@ function redcap_every_page_top($project_id) {
/**
* @inheritdoc
*/
function redcap_data_entry_form_top($project_id, $record = null, $instrument, $event_id, $group_id = null) {
function redcap_data_entry_form_top($project_id, $record = null, $instrument, $event_id, $group_id = null, $instance = null) {
if (empty($record)) {
$record = $this->getQueryParam('id');
}

$this->loadFRSL('data_entry_form', $record, $event_id, $instrument);
$this->loadFRSL('data_entry_form', $record, $event_id, $instrument, $instance);
}

/**
Expand Down Expand Up @@ -388,8 +388,10 @@ function getFormsAccessMatrix($event_id = null, $record = null) {
* The event ID. Only required when $location = "data_entry_form".
* @param string $instrument
* The form/instrument name.
* @param int $instance
* The repeat instance number. Only required when $location = "data_entry_form" and the form is a repeating instance
*/
protected function loadFRSL($location, $record = null, $event_id = null, $instrument = null) {
protected function loadFRSL($location, $record = null, $event_id = null, $instrument = null, $instance = null) {
global $Proj;

$next_step_path = '';
Expand All @@ -413,7 +415,7 @@ protected function loadFRSL($location, $record = null, $event_id = null, $instru

if (isset($next_instrument)) {
// Path to the next available form in the current event.
$next_step_path = APP_PATH_WEBROOT . 'DataEntry/index.php?pid=' . $Proj->project_id . '&id=' . $record . '&event_id=' . $event_id . '&page=' . $next_instrument;
$next_step_path = APP_PATH_WEBROOT . 'DataEntry/index.php?pid=' . $Proj->project_id . '&id=' . $record . '&event_id=' . $event_id . '&page=' . $next_instrument . '&instance=' . $instance;
}

// Access denied to the current page.
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,19 @@ If you want to make sure no filled forms will be affected by FRSL rules, check "
![Prevent hiding of filled forms](img/prevent_hidden_data_checkbox.png)


## Upgrading From Version 2.x - 3.x
## Survey support

FRSL works in surveys, but you must enable the `Auto-continue to next survey` option of `Survey Termination Options`.

Survey queues and FRSL are somewhat redundant in their ability to skip forms based on logic. If you want to use them together, you must skip the survey in both places, the queue and FRSL. Given that one constraint, they are completely compatible.


## Repeating event support

Repeating events are not fully supported by FRSL. FRSL should not be used to hide any repeating form. Repeating events work correctly only if FRSL *does not* control them. Proper repeating events support is planned for a future release.


## Upgrading from Version 2.x - 3.x

Note that version 3.0.0 introduced a breaking change in the configuration. When you upgrade to version 3.x all of your old configurations in 2.x will be converted into the 3.x configuration scheme. Thereafter, if you decided to switch back and forth between the two versions, your configurations will not transfer. This is to ensure that all of your old 2.x configurations will still be available to you if you decide to go back to version 2.x.

Expand Down
11 changes: 9 additions & 2 deletions js/frsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ document.addEventListener('DOMContentLoaded', function() {
}

var params = getQueryParameters(this.href,this.getAttribute('onclick'));
if (!formRenderSkipLogic.formsAccess[params.id][params.event_id][params.page]) {
disableForm(this);
try {
if (!formRenderSkipLogic.formsAccess[params.id][params.event_id][params.page]) {
disableForm(this);
}
} catch (err) {
if (this.firstChild.getAttribute('title') === 'Delete this event') {
// on record home the final row is "delete all data on event" buttons and should not be processed
return;
}
}
});

Expand Down

0 comments on commit 411414d

Please sign in to comment.