Relationship Graph

Relationship Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
16669Bug reportsPluginspublic2021-07-12 11:53
ReporterDenisChenu Assigned Togabrieljenik  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version4.3.16 
Summary16669: getQuestionAttributes function don't get the plugins attribute
DescriptionThe getQuestionAttributes are not compatible with plugins Question Attribute
Steps To Reproduce1. Download and activate https://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion
2. Login in 3.X as super admin, import included lss : see "It work" in help
3. Login in 4.X as super admin, import included lss : see "The addScriptToQuestion plugin didn't work." in help.
Additional Informationhttps://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion/-/blob/master/addScriptToQuestion.php#L64

`QuestionAttribute::model()->getQuestionAttributes` seems to return only core attribute ?
**I didn't check with a Question Theme**
TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)4.3.15
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database & DB-Versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP Versionnot relevant

Relationships

related to 15224 closedp_teichmann Bug reports newQuestionAttributes deprecated : need a replacer 
related to 16772 closedgabrieljenik Bug reports Allow plugin to add question attributes 
related to 17049 closedollehar Bug reports newQuestionAttributes event didn't add attribute 
related to 17169 closedc_schmitz Bug reports QuestionAttribute::model()->findByAttributes() only returns DB values which does NOT include default values 
related to 17242 resolvedgabrieljenik Development  Remove unused invocations to getOwnQuestionAttributesViaPlugin() and some QuestionBaseDataSet methods 
related to 17261 reviewgabrieljenik Development  Create new code artifacts to handle QuestionAttributes fetching (& saving) 

Activities

DenisChenu

DenisChenu

2020-09-15 15:14

developer  

ollehar

ollehar

2020-10-28 11:31

administrator   ~60435

Would it make sense to re-introduce the method questionHelper::getAttributesDefinitions to LS4?
ollehar

ollehar

2020-10-28 11:32

administrator   ~60436

Last edited: 2020-10-28 11:39

View 2 revisions

Question and question group import also use the newQuestionAttribute event, through questionHelper::getAttributesDefinitions.
DenisChenu

DenisChenu

2020-10-28 12:38

developer   ~60437

> Would it make sense to re-introduce the method questionHelper::getAttributesDefinitions to LS4?

I don't know … personally i think current code is a lot more complex than previous one …
DenisChenu

DenisChenu

2020-10-28 12:39

developer   ~60438

PS : see https://bugs.limesurvey.org/view.php?id=16772
gabrieljenik

gabrieljenik

2021-04-09 21:03

manager   ~63905

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1843
gabrieljenik

gabrieljenik

2021-04-09 21:06

manager   ~63906

On the other side.

QuestionAttribute::getOwnQuestionAttributesViaPlugin() is used on QuestionTheme::getQuestionThemeAttributeValues (see attachment)

That method is used on application\models\QuestionBaseDataSet.php
- getPreformattedBlockOfAdvancedSettings --> never called
- getAdvancedOptions --> said to be deprectaed


Shall we just
1) remove those unused and deprecated methods \QuestionBaseDataSet.php ?
2) remove the getOwnQuestionAttributesViaPlugin() call from QuestionTheme::getQuestionThemeAttributeValues ?

Thanks!
image.png (69,411 bytes)   
image.png (69,411 bytes)   
gabrieljenik

gabrieljenik

2021-04-13 16:24

manager   ~63923

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31574
DenisChenu

DenisChenu

2021-04-13 19:11

developer   ~63926

After update to last version
Mise à jour bea35ee924..a028dce420


Still not working for survey (beforeQuestionrender)
Plugin https://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion

Never set
https://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion/-/blob/master/addScriptToQuestion.php#L74
limesurvey_survey_287188.lss (23,460 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<document>
 <LimeSurveyDocType>Survey</LimeSurveyDocType>
 <DBVersion>444</DBVersion>
 <languages>
  <language>en</language>
 </languages>
 <groups>
  <fields>
   <fieldname>gid</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>group_order</fieldname>
   <fieldname>randomization_group</fieldname>
   <fieldname>grelevance</fieldname>
  </fields>
  <rows>
   <row>
    <gid><![CDATA[492]]></gid>
    <sid><![CDATA[287188]]></sid>
    <group_order><![CDATA[1]]></group_order>
    <randomization_group/>
    <grelevance/>
   </row>
  </rows>
 </groups>
 <group_l10ns>
  <fields>
   <fieldname>id</fieldname>
   <fieldname>gid</fieldname>
   <fieldname>group_name</fieldname>
   <fieldname>description</fieldname>
   <fieldname>language</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>group_order</fieldname>
   <fieldname>randomization_group</fieldname>
   <fieldname>grelevance</fieldname>
  </fields>
  <rows>
   <row>
    <id><![CDATA[897]]></id>
    <gid><![CDATA[492]]></gid>
    <group_name><![CDATA[Test]]></group_name>
    <description/>
    <language><![CDATA[en]]></language>
    <sid><![CDATA[287188]]></sid>
    <group_order><![CDATA[1]]></group_order>
    <randomization_group/>
    <grelevance/>
   </row>
  </rows>
 </group_l10ns>
 <questions>
  <fields>
   <fieldname>qid</fieldname>
   <fieldname>parent_qid</fieldname>
   <fieldname>sid</fieldname>
   <fieldname>gid</fieldname>
   <fieldname>type</fieldname>
   <fieldname>title</fieldname>
   <fieldname>preg</fieldname>
   <fieldname>other</fieldname>
   <fieldname>mandatory</fieldname>
   <fieldname>question_order</fieldname>
   <fieldname>scale_id</fieldname>
   <fieldname>same_default</fieldname>
   <fieldname>relevance</fieldname>
   <fieldname>modulename</fieldname>
   <fieldname>encrypted</fieldname>
  </fields>
  <rows>
   <row>
    <qid><![CDATA[7589]]></qid>
    <parent_qid><![CDATA[0]]></parent_qid>
    <sid><![CDATA[287188]]></sid>
    <gid><![CDATA[492]]></gid>
    <type><![CDATA[S]]></type>
    <title><![CDATA[G01Q01]]></title>
    <preg/>
    <other><![CDATA[N]]></other>
    <mandatory><![CDATA[N]]></mandatory>
    <question_order><![CDATA[1]]></question_order>
    <scale_id><![CDATA[0]]></scale_id>
    <same_default><![CDATA[0]]></same_default>
    <relevance><![CDATA[1]]></relevance>
    <modulename/>
    <encrypted><![CDATA[N]]></encrypted>
   </row>
  </rows>
 </questions>
 <question_l10ns>
  <fields>
   <fieldname>id</fieldname>
   <fieldname>qid</fieldname>
   <fieldname>question</fieldname>
   <fieldname>help</fieldname>
   <fieldname>language</fieldname>
   <fieldname>script</fieldname>
  </fields>
  <rows>
   <row>
    <id><![CDATA[17284]]></id>
    <qid><![CDATA[7589]]></qid>
    <question><![CDATA[Color with text success ?]]></question>
    <help/>
    <language><![CDATA[en]]></language>
    <script/>
   </row>
  </rows>
 </question_l10ns>
 <question_attributes>
  <fields>
   <fieldname>qid</fieldname>
   <fieldname>attribute</fieldname>
   <fieldname>value</fieldname>
   <fieldname>language</fieldname>
  </fields>
  <rows>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[clear_default]]></attribute>
    <value><![CDATA[N]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[cssclass]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[display_rows]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[em_validation_q]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[em_validation_q_tip]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[hidden]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[hide_tip]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[input_size]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[javascript]]></attribute>
    <value><![CDATA[$("#answer{SGQ}").css("background:red");
$("#question{QID}").addClass("text-succes");
alert('toto');]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_city]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_country]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_defaultcoordinates]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_mapheight]]></attribute>
    <value><![CDATA[300]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_mapservice]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_mapwidth]]></attribute>
    <value><![CDATA[500]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_mapzoom]]></attribute>
    <value><![CDATA[11]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_nodefaultfromip]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_postal]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[location_state]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[maximum_chars]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[numbers_only]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[page_break]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[prefix]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[question_template]]></attribute>
    <value><![CDATA[shortfreetext]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[random_group]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[save_as_default]]></attribute>
    <value><![CDATA[N]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[script_activate]]></attribute>
    <value><![CDATA[1]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[scriptPosition]]></attribute>
    <value><![CDATA[4]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[statistics_graphtype]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[statistics_showgraph]]></attribute>
    <value><![CDATA[1]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[statistics_showmap]]></attribute>
    <value><![CDATA[1]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[suffix]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[text_input_width]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_action]]></attribute>
    <value><![CDATA[1]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_countdown_message]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_disable_next]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_disable_prev]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_message]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_message_delay]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_message_style]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_timer_style]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_2]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_2_display_time]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_2_message]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_2_style]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_display_time]]></attribute>
    <value/>
    <language/>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_message]]></attribute>
    <value/>
    <language><![CDATA[en]]></language>
   </row>
   <row>
    <qid><![CDATA[7589]]></qid>
    <attribute><![CDATA[time_limit_warning_style]]></attribute>
    <value/>
    <language/>
   </row>
  </rows>
 </question_attributes>
 <surveys>
  <fields>
   <fieldname>sid</fieldname>
   <fieldname>gsid</fieldname>
   <fieldname>admin</fieldname>
   <fieldname>expires</fieldname>
   <fieldname>startdate</fieldname>
   <fieldname>adminemail</fieldname>
   <fieldname>anonymized</fieldname>
   <fieldname>faxto</fieldname>
   <fieldname>format</fieldname>
   <fieldname>savetimings</fieldname>
   <fieldname>template</fieldname>
   <fieldname>language</fieldname>
   <fieldname>additional_languages</fieldname>
   <fieldname>datestamp</fieldname>
   <fieldname>usecookie</fieldname>
   <fieldname>allowregister</fieldname>
   <fieldname>allowsave</fieldname>
   <fieldname>autonumber_start</fieldname>
   <fieldname>autoredirect</fieldname>
   <fieldname>allowprev</fieldname>
   <fieldname>printanswers</fieldname>
   <fieldname>ipaddr</fieldname>
   <fieldname>refurl</fieldname>
   <fieldname>showsurveypolicynotice</fieldname>
   <fieldname>publicstatistics</fieldname>
   <fieldname>publicgraphs</fieldname>
   <fieldname>listpublic</fieldname>
   <fieldname>htmlemail</fieldname>
   <fieldname>sendconfirmation</fieldname>
   <fieldname>tokenanswerspersistence</fieldname>
   <fieldname>assessments</fieldname>
   <fieldname>usecaptcha</fieldname>
   <fieldname>usetokens</fieldname>
   <fieldname>bounce_email</fieldname>
   <fieldname>attributedescriptions</fieldname>
   <fieldname>emailresponseto</fieldname>
   <fieldname>emailnotificationto</fieldname>
   <fieldname>tokenlength</fieldname>
   <fieldname>showxquestions</fieldname>
   <fieldname>showgroupinfo</fieldname>
   <fieldname>shownoanswer</fieldname>
   <fieldname>showqnumcode</fieldname>
   <fieldname>bouncetime</fieldname>
   <fieldname>bounceprocessing</fieldname>
   <fieldname>bounceaccounttype</fieldname>
   <fieldname>bounceaccounthost</fieldname>
   <fieldname>bounceaccountpass</fieldname>
   <fieldname>bounceaccountencryption</fieldname>
   <fieldname>bounceaccountuser</fieldname>
   <fieldname>showwelcome</fieldname>
   <fieldname>showprogress</fieldname>
   <fieldname>questionindex</fieldname>
   <fieldname>navigationdelay</fieldname>
   <fieldname>nokeyboard</fieldname>
   <fieldname>alloweditaftercompletion</fieldname>
   <fieldname>googleanalyticsstyle</fieldname>
   <fieldname>googleanalyticsapikey</fieldname>
   <fieldname>tokenencryptionoptions</fieldname>
   <fieldname>ipanonymize</fieldname>
  </fields>
  <rows>
   <row>
    <sid><![CDATA[287188]]></sid>
    <gsid><![CDATA[1]]></gsid>
    <admin><![CDATA[inherit]]></admin>
    <adminemail><![CDATA[inherit]]></adminemail>
    <anonymized><![CDATA[N]]></anonymized>
    <format><![CDATA[I]]></format>
    <savetimings><![CDATA[I]]></savetimings>
    <template><![CDATA[inherit]]></template>
    <language><![CDATA[en]]></language>
    <additional_languages/>
    <datestamp><![CDATA[I]]></datestamp>
    <usecookie><![CDATA[I]]></usecookie>
    <allowregister><![CDATA[I]]></allowregister>
    <allowsave><![CDATA[I]]></allowsave>
    <autonumber_start><![CDATA[0]]></autonumber_start>
    <autoredirect><![CDATA[I]]></autoredirect>
    <allowprev><![CDATA[I]]></allowprev>
    <printanswers><![CDATA[I]]></printanswers>
    <ipaddr><![CDATA[I]]></ipaddr>
    <refurl><![CDATA[I]]></refurl>
    <showsurveypolicynotice><![CDATA[0]]></showsurveypolicynotice>
    <publicstatistics><![CDATA[I]]></publicstatistics>
    <publicgraphs><![CDATA[I]]></publicgraphs>
    <listpublic><![CDATA[I]]></listpublic>
    <htmlemail><![CDATA[I]]></htmlemail>
    <sendconfirmation><![CDATA[I]]></sendconfirmation>
    <tokenanswerspersistence><![CDATA[I]]></tokenanswerspersistence>
    <assessments><![CDATA[I]]></assessments>
    <usecaptcha><![CDATA[E]]></usecaptcha>
    <usetokens><![CDATA[N]]></usetokens>
    <bounce_email><![CDATA[inherit]]></bounce_email>
    <emailresponseto><![CDATA[inherit]]></emailresponseto>
    <emailnotificationto><![CDATA[inherit]]></emailnotificationto>
    <tokenlength><![CDATA[-1]]></tokenlength>
    <showxquestions><![CDATA[I]]></showxquestions>
    <showgroupinfo><![CDATA[I]]></showgroupinfo>
    <shownoanswer><![CDATA[I]]></shownoanswer>
    <showqnumcode><![CDATA[I]]></showqnumcode>
    <bounceprocessing><![CDATA[N]]></bounceprocessing>
    <showwelcome><![CDATA[I]]></showwelcome>
    <showprogress><![CDATA[I]]></showprogress>
    <questionindex><![CDATA[-1]]></questionindex>
    <navigationdelay><![CDATA[-1]]></navigationdelay>
    <nokeyboard><![CDATA[I]]></nokeyboard>
    <alloweditaftercompletion><![CDATA[I]]></alloweditaftercompletion>
    <tokenencryptionoptions/>
    <ipanonymize><![CDATA[I]]></ipanonymize>
   </row>
  </rows>
 </surveys>
 <surveys_languagesettings>
  <fields>
   <fieldname>surveyls_survey_id</fieldname>
   <fieldname>surveyls_language</fieldname>
   <fieldname>surveyls_title</fieldname>
   <fieldname>surveyls_description</fieldname>
   <fieldname>surveyls_welcometext</fieldname>
   <fieldname>surveyls_endtext</fieldname>
   <fieldname>surveyls_policy_notice</fieldname>
   <fieldname>surveyls_policy_error</fieldname>
   <fieldname>surveyls_policy_notice_label</fieldname>
   <fieldname>surveyls_url</fieldname>
   <fieldname>surveyls_urldescription</fieldname>
   <fieldname>surveyls_email_invite_subj</fieldname>
   <fieldname>surveyls_email_invite</fieldname>
   <fieldname>surveyls_email_remind_subj</fieldname>
   <fieldname>surveyls_email_remind</fieldname>
   <fieldname>surveyls_email_register_subj</fieldname>
   <fieldname>surveyls_email_register</fieldname>
   <fieldname>surveyls_email_confirm_subj</fieldname>
   <fieldname>surveyls_email_confirm</fieldname>
   <fieldname>surveyls_dateformat</fieldname>
   <fieldname>surveyls_attributecaptions</fieldname>
   <fieldname>email_admin_notification_subj</fieldname>
   <fieldname>email_admin_notification</fieldname>
   <fieldname>email_admin_responses_subj</fieldname>
   <fieldname>email_admin_responses</fieldname>
   <fieldname>surveyls_numberformat</fieldname>
   <fieldname>attachments</fieldname>
  </fields>
  <rows>
   <row>
    <surveyls_survey_id><![CDATA[287188]]></surveyls_survey_id>
    <surveyls_language><![CDATA[en]]></surveyls_language>
    <surveyls_title><![CDATA[Test addScriptToQuestion]]></surveyls_title>
    <surveyls_description/>
    <surveyls_welcometext/>
    <surveyls_endtext/>
    <surveyls_policy_notice/>
    <surveyls_policy_notice_label/>
    <surveyls_url/>
    <surveyls_urldescription/>
    <surveyls_email_invite_subj><![CDATA[Invitation to participate in a survey]]></surveyls_email_invite_subj>
    <surveyls_email_invite><![CDATA[Dear {FIRSTNAME},<br />
<br />
you have been invited to participate in a survey.<br />
<br />
The survey is titled:<br />
"{SURVEYNAME}"<br />
<br />
"{SURVEYDESCRIPTION}"<br />
<br />
To participate, please click on the link below.<br />
<br />
Sincerely,<br />
<br />
{ADMINNAME} ({ADMINEMAIL})<br />
<br />
----------------------------------------------<br />
Click here to do the survey:<br />
{SURVEYURL}<br />
<br />
If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:<br />
{OPTOUTURL}<br />
<br />
If you are blacklisted but want to participate in this survey and want to receive invitations please click the following link:<br />
{OPTINURL}]]></surveyls_email_invite>
    <surveyls_email_remind_subj><![CDATA[Reminder to participate in a survey]]></surveyls_email_remind_subj>
    <surveyls_email_remind><![CDATA[Dear {FIRSTNAME},<br />
<br />
Recently we invited you to participate in a survey.<br />
<br />
We note that you have not yet completed the survey, and wish to remind you that the survey is still available should you wish to take part.<br />
<br />
The survey is titled:<br />
"{SURVEYNAME}"<br />
<br />
"{SURVEYDESCRIPTION}"<br />
<br />
To participate, please click on the link below.<br />
<br />
Sincerely,<br />
<br />
{ADMINNAME} ({ADMINEMAIL})<br />
<br />
----------------------------------------------<br />
Click here to do the survey:<br />
{SURVEYURL}<br />
<br />
If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:<br />
{OPTOUTURL}]]></surveyls_email_remind>
    <surveyls_email_register_subj><![CDATA[Survey registration confirmation]]></surveyls_email_register_subj>
    <surveyls_email_register><![CDATA[Dear {FIRSTNAME},<br />
<br />
You, or someone using your email address, have registered to participate in an online survey titled {SURVEYNAME}.<br />
<br />
To complete this survey, click on the following URL:<br />
<br />
{SURVEYURL}<br />
<br />
If you have any questions about this survey, or if you did not register to participate and believe this email is in error, please contact {ADMINNAME} at {ADMINEMAIL}.]]></surveyls_email_register>
    <surveyls_email_confirm_subj><![CDATA[Confirmation of your participation in our survey]]></surveyls_email_confirm_subj>
    <surveyls_email_confirm><![CDATA[Dear {FIRSTNAME},<br />
<br />
this email is to confirm that you have completed the survey titled {SURVEYNAME} and your response has been saved. Thank you for participating.<br />
<br />
If you have any further questions about this email, please contact {ADMINNAME} on {ADMINEMAIL}.<br />
<br />
Sincerely,<br />
<br />
{ADMINNAME}]]></surveyls_email_confirm>
    <surveyls_dateformat><![CDATA[9]]></surveyls_dateformat>
    <email_admin_notification_subj><![CDATA[Response submission for survey {SURVEYNAME}]]></email_admin_notification_subj>
    <email_admin_notification><![CDATA[Hello,<br />
<br />
A new response was submitted for your survey '{SURVEYNAME}'.<br />
<br />
Click the following link to see the individual response:<br />
{VIEWRESPONSEURL}<br />
<br />
Click the following link to edit the individual response:<br />
{EDITRESPONSEURL}<br />
<br />
View statistics by clicking here:<br />
{STATISTICSURL}]]></email_admin_notification>
    <email_admin_responses_subj><![CDATA[Response submission for survey {SURVEYNAME} with results]]></email_admin_responses_subj>
    <email_admin_responses><![CDATA[Hello,<br />
<br />
A new response was submitted for your survey '{SURVEYNAME}'.<br />
<br />
Click the following link to see the individual response:<br />
{VIEWRESPONSEURL}<br />
<br />
Click the following link to edit the individual response:<br />
{EDITRESPONSEURL}<br />
<br />
View statistics by clicking here:<br />
{STATISTICSURL}<br />
<br />
<br />
The following answers were given by the participant:<br />
{ANSWERTABLE}]]></email_admin_responses>
    <surveyls_numberformat><![CDATA[0]]></surveyls_numberformat>
   </row>
  </rows>
 </surveys_languagesettings>
 <themes>
  <theme>
   <sid>287188</sid>
   <template_name>fruity</template_name>
   <config>
    <options>inherit</options>
   </config>
  </theme>
 </themes>
 <themes_inherited>
  <theme>
   <sid>287188</sid>
   <template_name>fruity</template_name>
   <config>
    <options>
     <ajaxmode>off</ajaxmode>
     <brandlogo>on</brandlogo>
     <container>on</container>
     <backgroundimage>off</backgroundimage>
     <animatebody>off</animatebody>
     <bodyanimation>fadeInRight</bodyanimation>
     <bodyanimationduration>500</bodyanimationduration>
     <animatequestion>off</animatequestion>
     <questionanimation>flipInX</questionanimation>
     <questionanimationduration>500</questionanimationduration>
     <animatealert>off</animatealert>
     <alertanimation>shake</alertanimation>
     <alertanimationduration>500</alertanimationduration>
     <font>noto</font>
     <bodybackgroundcolor>#ffffff</bodybackgroundcolor>
     <fontcolor>#444444</fontcolor>
     <questionbackgroundcolor>#ffffff</questionbackgroundcolor>
     <questionborder>on</questionborder>
     <questioncontainershadow>on</questioncontainershadow>
     <checkicon>f00c</checkicon>
     <animatecheckbox>on</animatecheckbox>
     <checkboxanimation>rubberBand</checkboxanimation>
     <checkboxanimationduration>500</checkboxanimationduration>
     <animateradio>on</animateradio>
     <radioanimation>zoomIn</radioanimation>
     <radioanimationduration>500</radioanimationduration>
     <zebrastriping>off</zebrastriping>
     <stickymatrixheaders>off</stickymatrixheaders>
     <greyoutselected>off</greyoutselected>
     <hideprivacyinfo>off</hideprivacyinfo>
     <crosshover>off</crosshover>
     <showpopups>1</showpopups>
     <off>false</off>
     <cssframework>css/variations/purple_tentacle.css</cssframework>
     <notables>off</notables>
     <showclearall>off</showclearall>
     <questionhelptextposition>off</questionhelptextposition>
     <fixnumauto>off</fixnumauto>
    </options>
   </config>
  </theme>
 </themes_inherited>
</document>
limesurvey_survey_287188.lss (23,460 bytes)   
DenisChenu

DenisChenu

2021-04-13 19:15

developer   ~63927

Admin part seems OK :) :+1:
gabrieljenik

gabrieljenik

2021-04-14 18:45

manager   ~63942

@DenisChenu about https://bugs.limesurvey.org/view.php?id=16669#c63926
Are you saying the attributes don't get saved on the DB?
Can you confirm / clarify the situation?
We have double checked and they are being saved.

Thanks
DenisChenu

DenisChenu

2021-04-14 18:52

developer   ~63943

No issue on admin part :

Save OK, load OK, edit OK.
Default seems OK

But : when use $aAttributes = QuestionAttribute::model()->getQuestionAttributes($oEvent->get('qid'));

in beforeQuestionRender : plugin settings are not set.

I can use `QuestionAttribute::model()->find('qid = :qid and attribute = attribute', ['qid'=> $oEvent->get('qid')),'attribute' => javascript]);`

Or another function , but it must be set somewhere … QuestionAttribute::model()->getQuestionAttributes take the plugin settings since 2.50
DenisChenu

DenisChenu

2021-04-14 18:53

developer   ~63944

See : https://gitlab.com/SondagesPro/QuestionSettingsType/addScriptToQuestion/-/blob/master/addScriptToQuestion.php#L72
gabrieljenik

gabrieljenik

2021-04-14 19:13

manager   ~63945

Last edited: 2021-04-14 19:21

View 2 revisions

ok, got it.
As we were dealing with 17120 before this, we focused on the admin area.
Was a problem to be fixed, but not the specific one mentioned on this ticket.

Will review the getQuestionAttributes().

Basically, plugin attributes definitions are not picked up on questionHelper::getAttributesDefinitions() as it used to happen on v3.
We will review an approach. Need to be carefull as this method is used 70 times across the codebase.
DenisChenu

DenisChenu

2021-04-15 12:13

developer   ~63949

Maybe best is to create a LimeSurveyAPI function ?
Then : plugin dev have a way to know if it can broke or not.

@ollehar : there are no LimeSurveyAPI function list in Manual ? Maybe need to be created ? A Category ?

Issue reported : No manual or documentation for API functions https://bugs.limesurvey.org/view.php?id=17248
ollehar

ollehar

2021-04-15 14:25

administrator   ~63957

The LimeSurvey API had a separate page that was generated automatically from the docblocks in the class.
DenisChenu

DenisChenu

2021-04-15 15:06

developer   ~63958

I report the issue as issue , maybe feature request (and i explain why https://api.limesurvey.org/classes/LimeSurvey.PluginManager.LimesurveyApi.html need something in manual too)
gabrieljenik

gabrieljenik

2021-04-15 16:09

manager   ~63975

OK, so I agree a PluginAPI endpoint could be very usefull and could be a good time to add it.
application/libraries/PluginManager/LimesurveyApi.php

Still, we do have to patch 'QuestionAttribute::model()->getQuestionAttributes()' as to fetch the attributes from the plugin?
I believe so.

This method does a lot of work picking the attribute definition, just for later usage on the i18n matters.
Maybe we can create a new one which just picks the values from the DB. Like a "lite" version.
When coding, devs will know what's their best choice balancing performance / features needed.

And at last, I would create a version that just returns a single attribute value.
Sometimes, that's all is needed.

What do you think?
DenisChenu

DenisChenu

2021-04-15 16:19

developer   ~63976

> Maybe we can create a new one which just picks the values from the DB. Like a "lite" version.

I don't like this … you muts always check empty

About quetsion attribute and theme i think, we need :

1. Return All the attribute with default value and with **current language only** no key by language. Then QuestionTheme can use (for example) questionattribute.dualscale_headerA to have the current dual scame header (and not check questionattribute.dualscale_headerA[language] because it's complex for twig)
2. Return previous questionAttributes (no update to do)
3. Have a getCurrentAttributeValue to have the current value in current language in DB, default if not set for a single attribute.

All of this can use caching when we are ready.
DenisChenu

DenisChenu

2021-04-15 16:23

developer   ~63977

Last edited: 2021-04-15 16:23

View 2 revisions

We can have a lite on for a single attribute only maybe ?

/**
 * @param integer $qid
 * @param string $attributeName
 * @param string $language : if attribute use i18nn, return this language, if null : return for current language
 * @param boolean $default : return the default if not in DB
 */
getCurrentAttributeValue($qid, $attributeName, $language = null, $default = true)


And offer this function to Twig function too \o/
ollehar

ollehar

2021-04-15 20:11

administrator   ~63980

If you want a method to fetch both one attribute and all attributes, the latter should use the former:

function getQuestionAttributes()
{
  return forall getQuestionAttribute($attributeName);
}

function getQuestionAttribute($attributeName); {} ...

(Pseudo-code.)
ollehar

ollehar

2021-04-15 20:19

administrator   ~63981

NB: Do we really need getQuestionAttributeValue()? Shouldn't the value always be fetched?
gabrieljenik

gabrieljenik

2021-04-16 01:42

manager   ~63985

I think it will be faser, as less extra work fetching definitions need to be done.
Is not needed. I just feel it could be faster. Still, with cache in there, maybe it doesn't worth spending tme thinking about performance enhancements
DenisChenu

DenisChenu

2021-04-16 07:59

developer   ~63986

`getQuestionAttributeValue` i just think of a function to return a single value of a single attribute.

Not necessary.
ollehar

ollehar

2021-04-16 15:38

administrator   ~63989

Readability and testability should go before optimization, unless there's actually a proven bottleneck there, I think. Or a big/obvious risk of a bottleneck.
DenisChenu

DenisChenu

2021-04-16 16:01

developer   ~63990

PS : i just speak for `QuestionAttribute::model()->getQuestionAttributes($oEvent->get('qid'))` from 3.0 system
to a new API
`LimeSurveyApi::getQuestionAttributes($oEvent->get('qid'))`

Since getQuestionAttributes is broken since 4.0
gabrieljenik

gabrieljenik

2021-04-17 01:30

manager   ~63996

Last edited: 2021-04-17 01:31

View 3 revisions

>> NB: Do we really need getQuestionAttributeValue()? Shouldn't the value always be fetched?

Name should be `getQuestionAttributeSingle()`
It should increase readability as code will be easer to read.
Right now getQuestionAttributes() is called and then filtering.
After, filtering wouldn't be needed.
ollehar

ollehar

2021-04-17 10:30

administrator   ~63999

Last edited: 2021-04-17 10:31

View 2 revisions

The adjective should come before the noun: getSingleQuestionAttribute.

As I said, getQuestionAttributes() can call getSingleQuestionAttribute(). No duplication. :) You still have to put the event somewhere, though.
ollehar

ollehar

2021-04-17 10:48

administrator   ~64000

Another alternative is to memoize the result in a static variable, to avoid to fetch the question attributes multiple times. The filtering would be trivial if you use question attribute name as key in the array.
DenisChenu

DenisChenu

2021-04-17 12:27

developer   ~64001

> Another alternative is to memoize the result in a static variable, to avoid to fetch the question attributes multiple times. The filtering would be trivial if you use question attribute name as key in the array.

It's not already a static var for 3.X ?

Els e: the imprtantpar is to have a way to use it in TWIG with i18n too.

> 1. Return All the attribute with default value and with **current language only** no key by language. Then QuestionTheme can use (for example) questionattribute.dualscale_headerA to have the current dual scame header (and not check questionattribute.dualscale_headerA[language] because it's complex for twig)

@tpartner : i don't find your bug about no way to get i18n value for QuestionTheme attribute .
tpartner

tpartner

2021-04-17 13:05

developer   ~64002

@DenisChenu, it's closed - https://bugs.limesurvey.org/view.php?id=16876
DenisChenu

DenisChenu

2021-04-17 13:24

developer   ~64003

Thanks you !

I check when this one was closed too ;)
gabrieljenik

gabrieljenik

2021-04-19 22:01

manager   ~64024

PR: https://github.com/LimeSurvey/LimeSurvey/pull/1850

At last, I didn't create new methods for fetching single attributes.
Let's just leave the cache do its magic.
gabrieljenik

gabrieljenik

2021-04-22 14:12

manager   ~64111

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=31622
c_schmitz

c_schmitz

2021-07-12 11:53

administrator   ~65302

Release done.

Related Changesets

LimeSurvey: master a028dce4

2021-04-13 16:24:49

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16669: getQuestionAttributes function don't get the plugins attribute (#1843)

* Fixed ticket 16669: getQuestionAttributes function don't get the plugins attribute

- Added new function 'getAttributesFromPlugin' to QuestionAttributeHelper, which calls the old 'getOwnQuestionAttributesViaPlugin' function and filters by question type.
- Use the new function in Question::getAdvancedSettingsWithValues()

* Fixed ticket 16669: getQuestionAttributes function don't get the plugins attribute

- Added more helper methods

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
16669
mod - application/models/Question.php Diff File
mod - application/models/QuestionTheme.php Diff File
mod - application/models/services/QuestionAttributeHelper.php Diff File

LimeSurvey: master 37758c50

2021-04-22 14:12:21

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16669: getQuestionAttributes function don't get the plugins attribute (#1850)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Affected Issues
16669
mod - application/models/Question.php Diff File
mod - application/models/QuestionAttribute.php Diff File
mod - application/models/services/QuestionAttributeHelper.php Diff File

Issue History

Date Modified Username Field Change
2020-09-15 15:14 DenisChenu New Issue
2020-09-15 15:14 DenisChenu File Added: limesurvey_survey_addScriptToQuestion.lss
2020-09-15 15:29 DenisChenu Relationship added related to 15224
2020-10-21 18:07 gabrieljenik Issue cloned: 16772
2020-10-21 18:07 gabrieljenik Relationship added related to 16772
2020-10-28 11:31 ollehar Note Added: 60435
2020-10-28 11:32 ollehar Note Added: 60436
2020-10-28 11:39 ollehar Note Edited: 60436 View Revisions
2020-10-28 12:38 DenisChenu Note Added: 60437
2020-10-28 12:39 DenisChenu Note Added: 60438
2021-02-02 15:21 DenisChenu Relationship added related to 17049
2021-03-09 17:04 Mazi Relationship added related to 17169
2021-04-09 21:03 gabrieljenik Note Added: 63905
2021-04-09 21:06 gabrieljenik Note Added: 63906
2021-04-09 21:06 gabrieljenik File Added: image.png
2021-04-13 16:18 gabrieljenik Issue cloned: 17242
2021-04-13 16:18 gabrieljenik Relationship added related to 17242
2021-04-13 16:24 gabrieljenik Changeset attached => LimeSurvey master a028dce4
2021-04-13 16:24 gabrieljenik Note Added: 63923
2021-04-13 16:24 gabrieljenik Assigned To => gabrieljenik
2021-04-13 16:24 gabrieljenik Resolution open => fixed
2021-04-13 19:11 DenisChenu Note Added: 63926
2021-04-13 19:11 DenisChenu File Added: limesurvey_survey_287188.lss
2021-04-13 19:15 DenisChenu Note Added: 63927
2021-04-14 18:45 gabrieljenik Note Added: 63942
2021-04-14 18:52 DenisChenu Note Added: 63943
2021-04-14 18:53 DenisChenu Note Added: 63944
2021-04-14 19:13 gabrieljenik Note Added: 63945
2021-04-14 19:21 gabrieljenik Note Edited: 63945 View Revisions
2021-04-15 12:13 DenisChenu Note Added: 63949
2021-04-15 14:25 ollehar Note Added: 63957
2021-04-15 15:06 DenisChenu Note Added: 63958
2021-04-15 16:09 gabrieljenik Note Added: 63975
2021-04-15 16:19 DenisChenu Note Added: 63976
2021-04-15 16:23 DenisChenu Note Added: 63977
2021-04-15 16:23 DenisChenu Note Edited: 63977 View Revisions
2021-04-15 20:11 ollehar Note Added: 63980
2021-04-15 20:19 ollehar Note Added: 63981
2021-04-16 01:42 gabrieljenik Note Added: 63985
2021-04-16 07:59 DenisChenu Note Added: 63986
2021-04-16 15:38 ollehar Note Added: 63989
2021-04-16 16:01 DenisChenu Note Added: 63990
2021-04-17 01:30 gabrieljenik Note Added: 63996
2021-04-17 01:30 gabrieljenik Note Edited: 63996 View Revisions
2021-04-17 01:31 gabrieljenik Note Edited: 63996 View Revisions
2021-04-17 10:30 ollehar Note Added: 63999
2021-04-17 10:31 ollehar Note Edited: 63999 View Revisions
2021-04-17 10:48 ollehar Note Added: 64000
2021-04-17 12:27 DenisChenu Note Added: 64001
2021-04-17 13:05 tpartner Note Added: 64002
2021-04-17 13:24 DenisChenu Note Added: 64003
2021-04-19 22:01 gabrieljenik Note Added: 64024
2021-04-20 17:34 gabrieljenik Issue cloned: 17261
2021-04-20 17:34 gabrieljenik Relationship added related to 17261
2021-04-21 14:36 ollehar Status new => assigned
2021-04-22 14:12 gabrieljenik Changeset attached => LimeSurvey master 37758c50
2021-04-22 14:12 gabrieljenik Note Added: 64111
2021-04-22 16:15 gabrieljenik Status assigned => testing
2021-04-22 16:48 gabrieljenik Status testing => resolved
2021-07-12 11:53 c_schmitz Note Added: 65302
2021-07-12 11:53 c_schmitz Bug heat 8 => 10
2021-07-12 11:53 c_schmitz Status resolved => closed