From 13b3f8a2782839159ec409b72fdf1506ea5f229f Mon Sep 17 00:00:00 2001 From: CamilleBeau <51176779+CamilleBeau@users.noreply.github.com> Date: Tue, 20 Dec 2022 13:58:17 -0500 Subject: [PATCH] [new_timepoint] only show null language option when multiple exist (#8253) The language drop down for timepoints is only contains a null option when creating a new timepoint if there are more than one languages to choose from in the language table. Otherwise the field automatically selected. --- modules/create_timepoint/jsx/createTimepointIndex.js | 4 +++- modules/create_timepoint/php/timepoint.class.inc | 6 +----- modules/create_timepoint/test/TestPlan.md | 6 +++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/create_timepoint/jsx/createTimepointIndex.js b/modules/create_timepoint/jsx/createTimepointIndex.js index 8e5ab357c26..2a6ec30b77e 100644 --- a/modules/create_timepoint/jsx/createTimepointIndex.js +++ b/modules/create_timepoint/jsx/createTimepointIndex.js @@ -401,6 +401,8 @@ class CreateTimepoint extends React.Component { /> ) : null; // Include languages select. + const emptyLangOption = + Object.keys(this.state.form.options.languages).length > 1; const languages = this.state.form.display.languages ? ( 1) { - $languages = [null] + $languages; - } - $values['languages'] = $languages; + $values['languages'] = \Utility::getLanguageList(); if (!empty($conflict)) { return new \LORIS\Http\Response\JSON\Conflict( diff --git a/modules/create_timepoint/test/TestPlan.md b/modules/create_timepoint/test/TestPlan.md index 5c2445d1834..2f551df6df6 100644 --- a/modules/create_timepoint/test/TestPlan.md +++ b/modules/create_timepoint/test/TestPlan.md @@ -40,6 +40,10 @@ visit label already exists for the candidate. successful form submission. Click on "Ok" button and ensure that it brings you back to timepoint list page for that candidate and confirm that the new timepoint appears in the list. [Manual Testing] -14. Check that page is inaccessible if either the user does not have data_entry +14. Ensure that there is no empty option in the language select element and a language is automatically selected when only one +language exists in the `language` table. +15. Ensure that there is an empty option in the language select element and the field is required when more than one +lagnuage exists in the `language` table +16. Check that page is inaccessible if either the user does not have data_entry permission or the user and candidate are not the same site. [Manual Testing]