View Issue Details

This bug affects 1 person(s).
 12
IDProjectCategoryView StatusLast Update
06210Bug reportsOtherpublic2012-07-05 22:16
Reporteruser19905Assigned ToDenisChenu  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.92+ 
Fixed in Version1.92+ 
Summary06210: Inconsistent database after deleting a file by "clear & exit" button
Description

Suppose you have a survey that uses tokens and allows editing answers after completion. This survey has a "file upload" question type and you upload a file.

If you edit the answers after completion and use the "clear & exit" button, you can see that the file is deleted from the filesystem, but the references to the same file in the database are NOT deleted.

Expected behavior: the file, previously uploaded, must not be deleted.

TagsNo tags attached.
Bug heat12
Complete LimeSurvey version number (& build)120530
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySql 5.0
Server OS (if known)Linux Centos
Webserver software & version (if known)Apache 2
PHP Version5.3

Users monitoring this issue

c_schmitz

Activities

TMSWhite

TMSWhite

2012-06-13 15:29

reporter   ~19237

Are you sure? I thought "clear and exit" meant that the entire data record and all uploaded files should be deleted. In which case, the files are appropriately deleted, but the references in the database are accidentally sticking around and should be purged.

user19905

2012-06-13 16:46

  ~19239

It seems right, but after completion, if you go back onto your compilation and push "clear and exit" button, no data record is deleted: only the files are deleted in the filesystem. We can turn over the bug: it's ok to delete the files, but the entire data record should be deleted too.
Thanks a lot!

Mazi

Mazi

2012-06-19 12:12

updater   ~19343

Carsten, what is your opinion on this?

I think exit and clear should mean that the whole record, including uploaded files, should be deleted!?

c_schmitz

c_schmitz

2012-06-20 14:20

administrator   ~19413

Mazi, yes, the whole record should be deleted.

Mazi

Mazi

2012-06-20 14:43

updater   ~19415

Denis, can you have a look?

DenisChenu

DenisChenu

2012-06-20 17:09

developer   ~19425

Last edited: 2012-06-20 17:10

Actually:

// delete the response but only if not already completed
$connect->query('DELETE FROM '.db_tablename('survey'.$surveyid).' WHERE id='.$_SESSION['srid']." AND submitdate IS NULL");

We delete the response even if it's already completed ? Are you sure ?

Maybe best is to remove the "Clear and exit" if submitdate IS NOT NULL

c_schmitz

c_schmitz

2012-06-22 12:19

administrator   ~19462

ok, after some more talk about this:

After the survey is completed the link 'Clear your response' should not show anymore.
The link should only show when a user has not completed a survey, yet.

DenisChenu

DenisChenu

2012-06-22 13:17

developer   ~19463

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

DenisChenu

DenisChenu

2012-06-22 15:46

developer   ~19470

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

DenisChenu

DenisChenu

2012-06-22 16:28

developer   ~19476

Reopened

DenisChenu

DenisChenu

2012-06-22 17:11

developer   ~19479

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

DenisChenu

DenisChenu

2012-06-22 18:53

developer   ~19483

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

DenisChenu

DenisChenu

2012-06-22 18:56

developer   ~19484

Sorry for the error in patch.

Good now.

c_schmitz

c_schmitz

2012-07-05 22:16

administrator   ~19630

New 1.92+ version released.

Related Changesets

LimeSurvey: master 47baddbb

2012-06-22 04:15:43

DenisChenu

Details Diff
Fixed issue 06210 Inconsistent database after deleting a file by "clear & exit" button
Dev : show clear and exit button only if token aren't used for survey with alloweditaftercompletion
Dev : test if we delete the DB line before delete it and remove the files
Affected Issues
06210
mod - index.php Diff File
mod - replacements.php Diff File

LimeSurvey: Yii 16be365a

2012-06-22 06:44:38

DenisChenu

Details Diff
Fixed issue 06210 Inconsistent database after deleting a file by "clear & exit" button
Dev : review fixed issue 06226 & 06229
Dev : show clear and exit button only if token aren't used for survey with alloweditaftercompletion
Dev : test if we delete the DB line before delete it and remove the files
Affected Issues
06210, 06226
mod - application/controllers/survey/index.php Diff File
mod - application/helpers/common_helper.php Diff File
mod - application/helpers/frontend_helper.php Diff File
mod - application/helpers/replacements_helper.php Diff File

LimeSurvey: master bbdacadb

2012-06-22 08:09:20

DenisChenu

Details Diff
Dev : better fix 06210 Affected Issues
06210
mod - common_functions.php Diff File
mod - index.php Diff File
mod - replacements.php Diff File

LimeSurvey: Yii 7057cfd0

2012-06-22 09:51:05

DenisChenu

Details Diff
Dev : better fix 06210 Affected Issues
06210
mod - application/controllers/survey/index.php Diff File
mod - application/helpers/replacements_helper.php Diff File
mod - application/models/Survey_dynamic.php Diff File

Issue History

Date Modified Username Field Change
2012-06-13 11:00 user19905 New Issue
2012-06-13 11:03 user19905 Issue Monitored: user19905
2012-06-13 15:29 TMSWhite Note Added: 19237
2012-06-13 15:29 TMSWhite Status new => feedback
2012-06-13 16:46 user19905 Note Added: 19239
2012-06-13 16:46 user19905 Status feedback => new
2012-06-19 12:11 Mazi Issue Monitored: c_schmitz
2012-06-19 12:12 Mazi Note Added: 19343
2012-06-19 12:12 Mazi Assigned To => Mazi
2012-06-19 12:12 Mazi Status new => assigned
2012-06-20 14:20 c_schmitz Note Added: 19413
2012-06-20 14:43 Mazi Assigned To Mazi => DenisChenu
2012-06-20 14:43 Mazi Note Added: 19415
2012-06-20 17:09 DenisChenu Note Added: 19425
2012-06-20 17:10 DenisChenu Note Edited: 19425
2012-06-20 17:10 DenisChenu Note Edited: 19425
2012-06-22 12:19 c_schmitz Note Added: 19462
2012-06-22 13:17 DenisChenu Changeset attached => LimeSurvey master 47baddbb
2012-06-22 13:17 DenisChenu Note Added: 19463
2012-06-22 13:17 DenisChenu Resolution open => fixed
2012-06-22 15:46 DenisChenu Changeset attached => LimeSurvey Yii 16be365a
2012-06-22 15:46 DenisChenu Note Added: 19470
2012-06-22 16:12 DenisChenu Status assigned => resolved
2012-06-22 16:12 DenisChenu Fixed in Version => 1.92+
2012-06-22 16:28 DenisChenu Note Added: 19476
2012-06-22 16:28 DenisChenu Status resolved => assigned
2012-06-22 16:52 DenisChenu Status assigned => confirmed
2012-06-22 16:52 DenisChenu Resolution fixed => open
2012-06-22 17:11 DenisChenu Changeset attached => LimeSurvey master bbdacadb
2012-06-22 17:11 DenisChenu Note Added: 19479
2012-06-22 17:11 DenisChenu Resolution open => fixed
2012-06-22 18:53 DenisChenu Changeset attached => LimeSurvey Yii 7057cfd0
2012-06-22 18:53 DenisChenu Note Added: 19483
2012-06-22 18:56 DenisChenu Note Added: 19484
2012-06-22 18:56 DenisChenu Status confirmed => resolved
2012-07-05 22:16 c_schmitz Note Added: 19630
2012-07-05 22:16 c_schmitz Status resolved => closed
2021-08-02 17:20 guest Bug heat 10 => 12