View Issue Details

IDProjectCategoryView StatusLast Update
15793Bug reportsPluginspublic2020-02-10 17:37
Reporterjonasdoerken Assigned Toollehar  
PrioritynormalSeveritypartial_block 
Status confirmedResolutionopen 
Product Version4.0.1 
Summary15793: Upgrading Plugin from 3.* to 4.0 not possible, API calls throw error
Description

Hello everybody,
I have written a plugin that works quite a lot with the API of Limesurvey. Among others the function getQuestions. After I found out that I now have to create a config.xml to load my plugin, I now get error messages regarding missing columns in the question table. The function wants to pass 'language' = * as parameter, but since the column does not exist in the new question table, it spits out an error message. Can someone help me with this?

If there is still work to be done, i'd like to help and contribute but I would like to know if i misunderstood something.

Steps To Reproduce

Create Plugin and try to call getQuestions

Additional Information

https://www.limesurvey.org/forum/plugins/120116-upgrading-plugin-from-3-to-4-0 is the forum thread for that.

If this is a bug im gladly ready to fix this myself and create a pull request on github.

TagsNo tags attached.
Complete LimeSurvey version number (& build)Version 4.0.1+200120
I will donate to the project if issue is resolvedNo
Browser
Database & DB-VersionMariaDB
Server OS (if known)Debian
Webserver software & version (if known)
PHP Version7.4

Activities

jonasdoerken

jonasdoerken

2020-01-28 18:17

reporter   ~55548

cdorin told me in IRC i should add him here, so this is my attempt @cdorin

DenisChenu

DenisChenu

2020-01-29 10:17

developer   ~55556

@jonasdoerken : about config.xml files : it's to avoid to broke instance in such situation.

Move for 3.X to 4. X : yes we upadte API numbre, then previous method didn'tb work.

\QUestion::model are not inside API https://github.com/LimeSurvey/LimeSurvey/blob/master/application/libraries/PluginManager/LimesurveyApi.php

Maybe you can create a LimesurveyApi->getQuestion(…) but it can not be in 3.12.1 for example …

jonasdoerken

jonasdoerken

2020-01-29 13:30

reporter  

jonasdoerken

jonasdoerken

2020-01-29 13:30

reporter   ~55561

Hello Denis, thank you very much for your answer.

If i understand you correctly, there is already a function at the LimsurveyAPI called getQuestions, which is working fine if i comment out the conditions line regarding the language. I attached you the function in the limesurveyAPI i'm talking about.

In your Github link its the line https://github.com/LimeSurvey/LimeSurvey/blob/71898e9d27fbfe439ecd685cdf100f4d2118e908/application/libraries/PluginManager/LimesurveyApi.php#L400

Thank you very much for your time!

DenisChenu

DenisChenu

2020-01-29 14:32

developer   ~55562

If i understand you correctly, there is already a function at the LimsurveyAPI called getQuestions,

I never write or say that. Question are not in Plugin Api … then : you must rewriter your plugin using the same method than LimeSurvey.

Please : better read

Maybe you can create a

jonasdoerken

jonasdoerken

2020-01-29 14:54

reporter   ~55564

Hello, Denis, I think we're getting off on the wrong foot. I expressed myself wrong. The getQuestions function is already in the API, I linked it to you. But since the upgrade it doesn't work anymore because the column language is missing in the question table.

Once again in short: getQuestions worked with 3., but does not work with 4. anymore. So the Model Question is available in the API as return value.

Sorry for the misunderstanding caused by my formulation.

Of course I can't use the API in my plugin anymore and directly access the models, but that's what it's there for, isn't it?

https://github.com/LimeSurvey/LimeSurvey/blob/71898e9d27fbfe439ecd685cdf100f4d2118e908/application/libraries/PluginManager/LimesurveyApi.php#L400

DenisChenu

DenisChenu

2020-01-29 15:03

developer   ~55565

Last edited: 2020-01-29 15:03

View 2 revisions

Arg, yes … sorry …

You did good … bug in LimeSurvey

LimesurveyApi.php file must be updated  …
Can you make a pull request ?

Seems need with('questionL10ns')

jonasdoerken

jonasdoerken

2020-01-29 15:06

reporter   ~55566

Yes i can, thank you for your time!

ollehar

ollehar

2020-01-31 17:10

administrator   ~55607

Please test on branch bug/15793-plugin-api-breaks.

Also test with postgres.

DenisChenu

DenisChenu

2020-01-31 17:20

developer   ~55609

Direct link is so cooooooooooooooooooooooooooooooooooooooooool

https://github.com/LimeSurvey/LimeSurvey/tree/bug/15793-plugin-api-breaks

Issue History

Date Modified Username Field Change
2020-01-28 18:12 jonasdoerken New Issue
2020-01-28 18:17 jonasdoerken Note Added: 55548
2020-01-29 10:17 DenisChenu Note Added: 55556
2020-01-29 13:30 jonasdoerken File Added: Anmerkung 2020-01-28 131709.jpg
2020-01-29 13:30 jonasdoerken Note Added: 55561
2020-01-29 14:32 DenisChenu Note Added: 55562
2020-01-29 14:54 jonasdoerken Note Added: 55564
2020-01-29 15:03 DenisChenu Note Added: 55565
2020-01-29 15:03 DenisChenu Note Edited: 55565 View Revisions
2020-01-29 15:06 jonasdoerken Note Added: 55566
2020-01-31 15:47 ollehar Assigned To => ollehar
2020-01-31 15:47 ollehar Status new => confirmed
2020-01-31 15:47 ollehar Priority none => normal
2020-01-31 17:10 ollehar Note Added: 55607
2020-01-31 17:20 DenisChenu Note Added: 55609