View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
16619Feature requestsRemoteControlpublic2023-07-17 18:07
ReporterMazi Assigned Toollehar  
PrioritynoneSeverityfeature 
Status resolvedResolutionfixed 
Summary16619: API function get_uploaded_files() can only be used for closed surveys using tokens
Description

As outlined at https://api.limesurvey.org/classes/remotecontrol_handle.html#method_get_uploaded_files the get_uploaded_files() API function uses a token to identify a data set and get the related uploaded files. That is a problme for several reasons:

  1. At most surveys there simply are no tokens.
  2. With certain settings you can have the same token for multiple data sets.
  3. The ID is the unique key at the response table, not the token.

With the current implementation you can't use the function to get the files uploaded to a certain data set. One needs to pass the data set ID but that'S not possible.

Solution:

  1. Extend the function to add a third parameter for the data set ID: get_uploaded_files(string $sSessionKey,integer $iSurveyID,string $sToken,int $srid)
  2. If that parameter exists, get the uploaded files for the given data set ID.
  3. If not, use the token as done before.
  4. If both are not available, throw an error.
Additional Information

See discussion at https://forums.limesurvey.org/forum/development/120057-is-there-an-api-like-get_url_from_uploaded_file#204508.

TagsNo tags attached.
Bug heat8
Story point estimate
Users affected %

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2020-08-26 14:08

updater   ~59625

@gabrieljenik, can you roughly estimate hours for adding that third parameter? I may be interested to pay for this fix since we need an API function to get uploaded files but that is an open survey where no tokens are available.

gabrieljenik

gabrieljenik

2020-08-26 15:13

manager   ~59628

Last edited: 2021-11-01 11:15

I like the approach.
@ollehar what do you think? If building this, would be OK to merge it?

ollehar

ollehar

2020-08-26 15:14

administrator   ~59629

Last edited: 2021-11-01 11:15

It has to be done for LS4 too, including acceptance test.

Mazi

Mazi

2020-08-29 00:35

updater   ~59666

Last edited: 2021-11-01 11:15

Best solution seems to be adding another parameter as discussed at https://forums.limesurvey.org/forum/development/120057-is-there-an-api-like-get_url_from_uploaded_file#204508.

Mazi

Mazi

2020-09-01 12:41

updater   ~59673

Last edited: 2021-11-01 11:15

@ollehar, the code adjustment seems to be pretty straightforward and not that complex. But it could get tricky to code the test for the download stuff. Have you ever done that? Do we have any examples?

Because from a monetary point of view it doesn't make that much sense to code a test if that is twice the effort of the original code adjutment.
So question is: Wouldn't some careful testing also do the trick?

ollehar

ollehar

2020-09-01 13:26

administrator   ~59674

Last edited: 2021-11-01 11:15

Wouldn't some careful testing also do the trick?

Manual testing is more expensive in the long run. The automated tests are there to make sure the feature remains through future changes. But maybe we can help you write the test, or provide a scaffold?

I've done testing with files for the theme editor.

ollehar

ollehar

2021-03-10 17:13

administrator   ~63061

Last edited: 2021-11-01 11:15

You're using an outdated version of LimeSurvey. Please update to the latest version and check if the bug can still be reproduced. Thank you.

Mazi

Mazi

2021-03-10 17:36

updater   ~63094

Last edited: 2021-11-01 11:15

@ollehar: You are taking too much time to address bugs. Please be faster :-)

Thing is: The function get_uploaded_files() has not changed from the bug report until now, see https://github.com/LimeSurvey/LimeSurvey/commits/3.x-LTS/application/helpers/remotecontrol. So why should this suddenly be fixed.

Pasting a default "Please test again" message is not useful in every case...

ollehar

ollehar

2021-03-10 17:40

administrator   ~63099

Last edited: 2021-11-01 11:15

It's very useful. Thanks for the feedback.

ollehar

ollehar

2021-03-10 17:41

administrator   ~63101

Last edited: 2021-11-01 11:15

This is a new feature, or?

Mazi

Mazi

2021-03-10 17:48

updater   ~63115

Last edited: 2021-11-01 11:15

Well, it is more like making this a usable feature at all. Currently the usage is limited to closed surveys using tokens for unknown reasons. Most surveys are not using tokens though.
The fix for making the feature support open and closed surveys is pretty straightforward and makes this a feature usable for everyone.

ollehar

ollehar

2021-03-10 17:55

administrator   ~63121

Last edited: 2021-11-01 11:15

Alright. :)

gabrieljenik

gabrieljenik

2022-04-21 19:34

manager   ~69183

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

Documentation should be updated as well.
Is that done automatically?

guest

guest

2023-07-17 18:07

viewer   ~76115

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

Related Changesets

LimeSurvey: master 22f31323

2023-01-26 11:15:54

Gabriel Jenik


Committer: GitHub Details Diff
New feature 16619: Allow calling get_uploaded_files() remote control function by response ID (#2363)

Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
Co-authored-by: lapiudevgit <devgit@lapiu.biz>
Affected Issues
16619
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File
mod - tests/TestBaseClass.php Diff File
add - tests/data/surveys/survey_archive_getFileUploadTest.lsa Diff File
add - tests/data/surveys/survey_archive_getFileUploadTestClosed.lsa Diff File
add - tests/unit/helpers/RemoteControlGetUploadedFilesTest.php Diff File
mod - tests/unit/helpers/RemoteControlTest.php Diff File

Issue History

Date Modified Username Field Change
2020-08-26 14:06 Mazi New Issue
2020-08-26 14:08 Mazi Note Added: 59625
2020-08-26 15:13 gabrieljenik Note Added: 59628
2020-08-26 15:14 ollehar Note Added: 59629
2020-08-29 00:35 Mazi Note Added: 59666
2020-09-01 12:41 Mazi Note Added: 59673
2020-09-01 13:26 ollehar Note Added: 59674
2021-03-10 17:13 ollehar Assigned To => ollehar
2021-03-10 17:13 ollehar Status new => feedback
2021-03-10 17:13 ollehar Note Added: 63061
2021-03-10 17:36 Mazi Note Added: 63094
2021-03-10 17:36 Mazi Status feedback => assigned
2021-03-10 17:40 ollehar Note Added: 63099
2021-03-10 17:40 ollehar Status assigned => new
2021-03-10 17:41 ollehar Note Added: 63101
2021-03-10 17:48 Mazi Note Added: 63115
2021-03-10 17:55 ollehar Note Added: 63121
2021-03-10 17:58 ollehar Project Bug reports => Feature requests
2021-11-01 11:15 galads Status new => acknowledged
2021-11-01 11:15 galads Severity @60@ => feature
2021-11-01 11:15 galads Product Version 3.23.1 =>
2021-11-01 11:15 galads Zoho Project Synchronization => |Yes|
2021-11-01 11:15 LimeBot Zoho Projects ID => 85781000001394001
2021-11-01 11:15 LimeBot Zoho Projects URL => https://projects.limesurvey.org/portal/limesurvey#taskdetail/85781000001335039/85781000001348001/85781000001394001
2021-11-02 09:52 galads Status acknowledged => confirmed
2022-03-31 12:04 galads Zoho Project Synchronization Yes =>
2022-03-31 12:04 galads Zoho Projects ID 85781000001394001 =>
2022-04-11 13:42 galads Assigned To ollehar => gabrieljenik
2022-04-21 19:34 gabrieljenik Status confirmed => ready for testing
2022-04-21 19:34 gabrieljenik Note Added: 69183
2023-01-24 18:01 gabrieljenik Assigned To gabrieljenik => ollehar
2023-01-24 18:01 gabrieljenik Status ready for testing => ready for merge
2023-02-02 16:36 ollehar Status ready for merge => resolved
2023-02-02 16:36 ollehar Resolution open => fixed
2023-07-17 18:07 Changeset attached => LimeSurvey master 22f31323
2023-07-17 18:07 guest Note Added: 76115
2023-07-17 18:07 guest Bug heat 6 => 8