View Issue Details

This issue affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
17913Bug reportsTheme editorpublic2022-03-01 13:40
ReporterMazi Assigned Toc_schmitz  
PrioritynoneSeverityblock 
Status closedResolutionnot fixable 
Product Version5.2.x 
Summary17913: Asterisk for mandatory questions is always shown after updating from LS 3.x to 5.x
Description

At the fruity template at LS 3 we have this default code for showing the mandatory mark (red asterisk):
{% if aQuestion.mandatory != '' %}
<!-- Add a visual information + just Mandatory string for aria : can be improved -->
<div class="{{ aSurveyInfo.class.questionasterix }} pull-left" {{ aSurveyInfo.attr.questionasterix }} >
<small class="{{ aSurveyInfo.class.questionasterixsmall }} text-danger fa fa-asterisk small" {{ aSurveyInfo.attr.questionasterixsmall }}></small>
<span class="{{ aSurveyInfo.class.questionasterixspan }} sr-only text-danger" {{ aSurveyInfo.attr.questionasterixspan }} >
{{ gT("(This question is mandatory)") }}
</span>
</div>
{% endif %}

If you extend the fruity theme and edit that file a little and then update your system, all questions are shown as mandatory. The reason is that at v5.x this variable is NOT empty anymore by default for non-mandatory questions:
{{ aQuestion.mandatory }}

LS 5.x returns these values:
mandatory: Y
soft mandatory: S
not mandatory: N

While for LS 3.x we only have "1" if the question is mandartory and otherwise the value is empty.

Because of this adjustment, the code above marks all questions as mandatory due to this check:
{% if aQuestion.mandatory != '' %}

At LS 5.x we have a new twig file for the asterisk code and the check is adjusted to this:
{% if (aQuestion.mandatory == 'Y') %}
{{ include('./subviews/survey/question_subviews/asterisk.twig') }}
{% endif %}

BUT: If you update from 3.x to 5.x the old code is kept and all questions are marked mandatory.

Steps To Reproduce

Steps to reproduce

Import the attached template at an LS 3.x system.
Update to 5.x
Run a survey with some non mandatory questions with this template at the updated 5.x version

Expected result

Only mark mandatory questions as mandatory

Actual result

All questions are marked as mandatory.

TagsNo tags attached.
Attached Files
extends_fruity_ls3.zip (173,014 bytes)
Bug heat6
Complete LimeSurvey version number (& build)Version 5.2.14+220214
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionMariaDB 10.1.48
Server OS (if known)Ubuntu 18
Webserver software & version (if known)Apache 2.0
PHP VersionPHP 7.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2022-02-28 14:29

administrator   ~68438

I don't see how that is a bug.
The mandatory attribute was extended and changed it's value slightly. Just update your custom template to take 'N' into consideration.

Mazi

Mazi

2022-02-28 14:39

updater   ~68439

@c_schmitz, this will affect every customer who updates from 3.x to 5.x and uses a theme we had created for them in the past. There are about 50-100 such customers. We can not really adjust this.

Why have the variable values been changed from " " (empty) and "1" to "N", "Y" and "S"? Why did you not keep " " and "1" and add "2" for soft mandatory. That adjustment breaks backward compatibility of templates and causes quite some problems.

DenisChenu

DenisChenu

2022-02-28 16:02

developer   ~68452

3 to 4 : API update not really an issue.
Keep "" for No can be a better idea. But "Y"/"S" is better than 1/2

c_schmitz

c_schmitz

2022-02-28 17:26

administrator   ~68460

The probably some theme update system is missing.
We cannot stop changing things because it is inconvenient. A major version indicates that things might not be backward compatible.
"Soft mandatory" is a new feature in LS4/5 and did not exist in LS3, btw.

Mazi

Mazi

2022-02-28 20:37

updater   ~68463

I think two things are needed:

  1. We need he menioned theme update system to fix this and make templates compatible.

  2. Furthermore, developers should be more carefully when chaning such things. Of course, new features get introduced and may break existing features. But in this case guaranteering backgwards compatibility would have been really simple. They would just have to keep things as is and use "2" or "S" for the new soft mandatory feature while keeping the existing variable values.
    A lot of work was put into making LS 3.x templates compatible with LS 5.x and users are happy that templates don't need to be re-created. So fixing this issue would contribute to the compatibility you already focussed on.

DenisChenu

DenisChenu

2022-03-01 08:26

developer   ~68464

  1. We need he menioned theme update system to fix this and make templates compatible.

We need a complete API update history system on https://manual.limesurvey.org

c_schmitz

c_schmitz

2022-03-01 13:40

administrator   ~68471

Well. at this point in time this cannot be reverted, anymore, otherwise this would break all custom templates on 4.

For the template update system feel free to open a feature request (if there is none).

Issue History

Date Modified Username Field Change
2022-02-28 13:02 Mazi New Issue
2022-02-28 13:02 Mazi File Added: extends_fruity_ls3.zip
2022-02-28 14:29 c_schmitz Note Added: 68438
2022-02-28 14:29 c_schmitz Bug heat 0 => 2
2022-02-28 14:39 Mazi Note Added: 68439
2022-02-28 14:39 Mazi Bug heat 2 => 4
2022-02-28 16:02 DenisChenu Note Added: 68452
2022-02-28 16:02 DenisChenu Bug heat 4 => 6
2022-02-28 17:26 c_schmitz Note Added: 68460
2022-02-28 20:37 Mazi Note Added: 68463
2022-03-01 08:26 DenisChenu Note Added: 68464
2022-03-01 13:40 c_schmitz Assigned To => c_schmitz
2022-03-01 13:40 c_schmitz Status new => closed
2022-03-01 13:40 c_schmitz Resolution open => not fixable
2022-03-01 13:40 c_schmitz Note Added: 68471