View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
19951Bug reportsPluginspublic2025-02-04 20:54
Reporterfrancois-charles.hebert Assigned ToDenisChenu  
PrioritynoneSeverityblock 
Status assignedResolutionopen 
Product Version6.6.x 
Summary19951: Some events are not triggered
Description

I'm trying to log question group delete actions in a table, but some events are not triggered upon deletion.
The objective is to log the user action. I want to know which user deleted the question group, and which questions were deleted with the group.

Events that i tried:

  • beforeQuestionGroupDelete is NOT triggered;
  • afterQuestionGroupDelete is NOT triggered;
  • beforeModelDelete is NOT triggered;
  • beforeModelDeleteMany is triggered;

beforeModelDeleteMany is triggered multiple times when deleting a question group:
2025/01/31 16:09:06 [trace] [plugin.Trigger Plugins Events] beforeModelDeleteMany: {"model":"Assessment","filterCriteria":{"select":"*","distinct":false,"condition":"lime_assessments.sid=:yp0 AND lime_assessments.gid=:yp1","params":{":yp0":277374,":yp1":83},"limit":-1,"offset":-1,"order":"","group":"","join":"","having":"","with":null,"alias":null,"together":null,"index":null,"scopes":null},"surveyId":null,"iSurveyID":null,"dynamicId":null}

2025/01/31 16:09:06 [trace] [plugin.Trigger Plugins Events] beforeModelDeleteMany: {"model":"QuestionGroupL10n","filterCriteria":{"select":"*","distinct":false,"condition":"lime_group_l10ns.gid=:yp0","params":{":yp0":83},"limit":-1,"offset":-1,"order":"","group":"","join":"","having":"","with":null,"alias":null,"together":null,"index":null,"scopes":null},"surveyId":null,"iSurveyID":null,"dynamicId":null}

2025/01/31 16:09:06 [trace] [plugin.Trigger Plugins Events] beforeModelDeleteMany: {"model":"QuestionGroup","filterCriteria":{"select":"*","distinct":false,"condition":"lime_groups.sid=:yp0 AND lime_groups.gid=:yp1","params":{":yp0":277374,":yp1":83},"limit":-1,"offset":-1,"order":"","group":"","join":"","having":"","with":null,"alias":null,"together":null,"index":null,"scopes":null},"surveyId":null,"iSurveyID":null,"dynamicId":null}

When i query the questions table using the sid and gid params contained in the filterCriteria, the result is always false. I think at this point the question are already deleted, but the afterQuestionDelete event is not raised.

Steps To Reproduce

Steps to reproduce

  1. install the plugin;
  2. Create a survey;
  3. Create a question group;
  4. Add a question to the group;
  5. Delete the question group;
  6. Check the plugin.log

Expected result

The log should contains message that indicates that the events were triggered.
It only contains the beforeModelDeleteMany, and the query to get all related questions returns false.

Actual result

I think the following events should be triggered upon QuestionGroup deletion:

  • beforeQuestionGoupDelete
  • afterQuestionGroupDelete
  • beforeModelDelete
  • afterModelDelete
  • beforeModelDeleteMany

I think the questions should be deleted after the resolution of beforeModelDeleteMany, so we can fetch all the related data. Or maybe it should triggers the beforeModelDelete and afterModelDelete for related models. For example, in the case of QuestionGroup delete, the beforeQuestionDelete and AfterQuestionDelete should be triggered. Same for QuestionL10n...

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)6.10.1 build 255
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql
Server OS (if known)
Webserver software & version (if known)
PHP Version8.3.1

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2025-02-03 11:27

developer   ~81939

@gabrieljenik : we don't have an existing Pull Request for such issue ?

gabrieljenik

gabrieljenik

2025-02-03 13:34

manager   ~81945

I don't think so... at least not recent...

francois-charles.hebert

francois-charles.hebert

2025-02-04 20:54

reporter   ~81969

Also the beforeQuestionSave is triggered like 10 times when creating a question (Long free text (Type: T)) for some reasons.

image.png (74,707 bytes)   
image.png (74,707 bytes)   

Issue History

Date Modified Username Field Change
2025-01-31 18:20 francois-charles.hebert New Issue
2025-01-31 18:20 francois-charles.hebert File Added: TriggerPluginsEvents.zip
2025-01-31 19:13 DenisChenu Category Plugins => Usability/user experience
2025-01-31 19:13 DenisChenu Additional Information Updated
2025-01-31 19:14 DenisChenu Category Usability/user experience => Plugins
2025-01-31 19:14 DenisChenu Additional Information Updated
2025-02-03 11:19 tibor.pacalat Assigned To => DenisChenu
2025-02-03 11:19 tibor.pacalat Status new => assigned
2025-02-03 11:27 DenisChenu Note Added: 81939
2025-02-03 11:27 DenisChenu Bug heat 0 => 2
2025-02-03 13:34 gabrieljenik Note Added: 81945
2025-02-03 13:34 gabrieljenik Bug heat 2 => 4
2025-02-04 20:54 francois-charles.hebert Note Added: 81969
2025-02-04 20:54 francois-charles.hebert File Added: image.png
2025-02-04 20:54 francois-charles.hebert Bug heat 4 => 6