View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
18366Bug reportsRemoteControlpublic2022-09-24 00:00
Reportersciarab Assigned To 
PrioritynormalSeverityminor 
Status acknowledgedResolutionopen 
Product Version5.4.x 
Summary18366: add_participants duplicates already existing participants
Description

When adding participants to a survey there is no check if the added participants already exist.
In line 1878, inside the foreach loop of the participants that should be added, the new token is created without any previous check if he/she already exists.
I solved adding the following code before line 1878

            $model =Token::model($iSurveyID)->findByAttributes(array(
                'firstname' => $aParticipant['firstname'],
                'lastname'  => $aParticipant['lastname'],
                'email'     => $aParticipant['email']
            ));
            if ($model) {
                $aParticipant["errors"] = "Participant already existent";
                continue;
            }

Anyway this is just one possible solution. Another one would be allowing the update of already existing participants. Also the check if the participant already exists could be done on just the email field rather than the three fields I used.

Steps To Reproduce

Steps to reproduce

(Replace this text with detailed step-by-step instructions on how to reproduce the issue)

Expected result

(Write here what you expected to happen)

Actual result

(Write here what happened instead)

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)5.4.2
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMariadb
Server OS (if known)
Webserver software & version (if known)
PHP Version7.4

Users monitoring this issue

sciarab

Activities

DenisChenu

DenisChenu

2022-09-21 10:56

developer   ~71863

Since it's not a mandatory options, and the list for duplicate check can be different : need an new parameters (array of attributes)

DenisChenu

DenisChenu

2022-09-21 10:56

developer   ~71864

Last edited: 2022-09-21 10:58

About updating by duplicate control : it's really a good feature to have (I already think of a plugin creation, but export/delete/import work too …)
But in core GUI or via a (core) plugin in my opinion before core remote_control

Issue History

Date Modified Username Field Change
2022-09-21 10:48 sciarab New Issue
2022-09-21 10:49 sciarab Issue Monitored: sciarab
2022-09-21 10:49 sciarab Bug heat 0 => 2
2022-09-21 10:56 DenisChenu Note Added: 71863
2022-09-21 10:56 DenisChenu Bug heat 2 => 4
2022-09-21 10:56 DenisChenu Note Added: 71864
2022-09-21 10:57 DenisChenu Note Edited: 71864
2022-09-21 10:58 DenisChenu Note Edited: 71864
2022-09-23 16:26 ollehar Priority none => normal
2022-09-24 00:00 gabrieljenik Status new => acknowledged