View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 11447 | Bug reports | Plugins | public | 2016-07-12 09:54 | 2019-09-23 12:18 |
| Reporter | DenisChenu | Assigned To | DenisChenu | ||
| Priority | normal | Severity | minor | ||
| Status | closed | Resolution | reopened | ||
| Product Version | 2.50.x | ||||
| Fixed in Version | 3.x | ||||
| Summary | 11447: Unable to use beforeTokenSave afterSurveySave event | ||||
| Description | See discussion here : https://github.com/LimeSurvey/LimeSurvey/commit/c69d913562cb4bcf87453ba3f6e7ad65b6f2fcaf#commitcomment-18190072 In fact : we already have an event for beforeSave and afterSave, but we can not uise it for Dynbamic moodel (Token or Survey) | ||||
| Steps To Reproduce | Add Yii::log('after'.get_class($this->owner).'Save', 'info','application.plugins.event'); And Look at tmp/runtime/application.log | ||||
| Additional Information | $this->owner send Model class + model id, maybe we need to fix it or send it with another part, specific for dynamic model. | ||||
| Tags | No tags attached. | ||||
| Bug heat | 8 | ||||
| Complete LimeSurvey version number (& build) | 160712 | ||||
| I will donate to the project if issue is resolved | No | ||||
| Browser | not relevant | ||||
| Database type & version | not relevant | ||||
| Server OS (if known) | not relevant | ||||
| Webserver software & version (if known) | not relevant | ||||
| PHP Version | not relevant | ||||
| Git branch / Pull Request URL | |||||
|
if(is_subclass_of($this->owner,'Dynamic')) Does the trick, but must add the dynamicId too (i think) I'm sure we can have the model |
|
|
The question is :
Same for Survey, then Same for all dynamic => add the dynamicId /!\ Danger : This plugin can fix the looping, but diod we need to fix it before ? In another plugin, i do: class extendAdminStatitistics extends PluginBase protected $storage = 'DbStorage'; /**
|
|
|
I think we should fix/update PluginEventBehavior to send the beforeTokenSave with the surveyId and the model. Denis, can you do that? |
|
|
OK, Make a pull request because : i want to remove other event :) then aestaban must test the plugin. Choice 2 , maybe with a partial plugin (to be moved in own plugin after) in https://github.com/LimeSurvey/LimeSurvey/blob/master/application/core/plugins/Authdb/Authdb.php to send the 2 plugins. |
|
|
The other event is generic so I think it will be very hard to remove it - it is supposed to fire for all static tables that way. So please just introduce the beforeTokenSave - same issue should exist for all dynamic models. Therefore survey_xxx and timings_xxx might need to be fixed, too. |
|
|
No, We must have only one event at a time. Send dynamicId |
|
|
@c_schmitz, @DenisChenu: Please, take a look at: https://github.com/LimeSurvey/LimeSurvey/pull/526 This is not the definitive solution you are talking about in this bug but this is better than current code. |
|
|
@aesteban : i think we can have only one event, really. Actually 2 events : The first beforeToken_12421Save can not be used : then it must be removed and replace by beforeTokenSave :). I get it. Your patch really is better than the other : \o/ Do it for bedoreSurveySave too. Then n: when fixing PluginEventBehavior i just have to remove 2 others event :). |
|
|
Merged. I fixed two issues too. I added survey id in entity field. I thinks this is better than not having this information and is correct from a DB point of view (table name is lime_token_XXXXX). @DenisChenu: When you write the permanent solution, remember you can remove the whole save() method, not just the event call. I will take a look at Survey case to try to reproduce this solution. |
|
|
@aesteban : i review system to add Response, but more : adding iSurveyId to TokenDynamic too https://github.com/LimeSurvey/LimeSurvey/commit/399b4f0e99e8d61ae1d40e3555a7e5c895bf2f72 |
|
|
Add iSurveyID and surveyId for Timing done here https://github.com/LimeSurvey/LimeSurvey/commit/fbeb2db6fe6df46e45073e0d06f460c24508fb30 Timing is not a child of Dynamic. Still other model where need surveyId ? |
|
|
LimeSurvey: master 81aeb59f 2016-07-31 00:58 Details Diff |
Dev: Improving previous ugly solution for token changes not logged Dev: See commit c69d913 (ugly solution) and bug 11447 |
Affected Issues 11447 |
|
| mod - application/controllers/admin/tokens.php | Diff File | ||
| mod - application/models/Token.php | Diff File | ||
|
LimeSurvey: master 399b4f0e 2018-10-06 19:07 Details Diff |
Dev: add iSurveyID and surveyId for event Dev: Token + TokenDynamic + Response + SurveyDynamic |
Affected Issues 11447 |
|
| mod - application/models/Response.php | Diff File | ||
| mod - application/models/SurveyDynamic.php | Diff File | ||
| mod - application/models/Token.php | Diff File | ||
| mod - application/models/TokenDynamic.php | Diff File | ||
| mod - application/models/behaviors/PluginEventBehavior.php | Diff File | ||
|
LimeSurvey: master fbeb2db6 2018-10-06 19:12 Details Diff |
Dev: add survey id in beforeTimingSave + afterTimingSave |
Affected Issues 11447 |
|
| mod - application/models/Timing.php | Diff File | ||
|
LimeSurvey: master e5427b5d 2018-10-06 19:15 Details Diff |
Dev: oups … Timing didn't use sid but surveyId … |
Affected Issues 11447 |
|
| mod - application/models/Timing.php | Diff File | ||
|
LimeSurvey: master fd7911f8 2018-10-06 19:22 Details Diff |
Dev: fix whole … getDynamicId and method_exists |
Affected Issues 11447 |
|
| mod - application/models/Dynamic.php | Diff File | ||
| mod - application/models/behaviors/PluginEventBehavior.php | Diff File | ||
|
LimeSurvey: master 6bb4566a 2018-10-06 21:01 Details Diff |
Dev: sid in SurveyDynamic and TokenDynamic are static … |
Affected Issues 11447 |
|
| mod - application/models/Response.php | Diff File | ||
| mod - application/models/SurveyDynamic.php | Diff File | ||
| mod - application/models/Token.php | Diff File | ||
| mod - application/models/TokenDynamic.php | Diff File | ||
| mod - application/models/behaviors/PluginEventBehavior.php | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2016-07-12 09:54 | DenisChenu | New Issue | |
| 2016-07-12 10:19 | DenisChenu | Note Added: 39869 | |
| 2016-07-12 10:39 | DenisChenu | Note Added: 39870 | |
| 2016-07-12 10:42 | DenisChenu | Note Edited: 39870 | |
| 2016-07-19 14:01 | c_schmitz | Note Added: 39989 | |
| 2016-07-19 14:01 | c_schmitz | Assigned To | => DenisChenu |
| 2016-07-19 14:01 | c_schmitz | Status | new => assigned |
| 2016-07-21 15:51 | DenisChenu | Note Added: 40010 | |
| 2016-07-22 12:00 | c_schmitz | Note Added: 40016 | |
| 2016-07-22 12:00 | c_schmitz | Priority | none => normal |
| 2016-07-22 13:11 | DenisChenu | Note Added: 40021 | |
| 2016-07-31 01:14 | aesteban | Note Added: 40118 | |
| 2016-07-31 01:17 | aesteban | Issue Monitored: aesteban | |
| 2016-07-31 12:15 | DenisChenu | Note Added: 40119 | |
| 2016-07-31 18:25 | aesteban | Changeset attached | => LimeSurvey master 81aeb59f |
| 2016-07-31 19:22 | aesteban | Note Added: 40121 | |
| 2016-09-14 16:31 | DenisChenu | Project | Bug reports => @10@ |
| 2018-10-06 17:09 | DenisChenu | Note Added: 49276 | |
| 2018-10-06 17:09 | DenisChenu | Status | assigned => resolved |
| 2018-10-06 17:09 | DenisChenu | Resolution | open => fixed |
| 2018-10-06 17:09 | DenisChenu | Fixed in Version | => 3.x |
| 2018-10-06 17:14 | DenisChenu | Status | resolved => feedback |
| 2018-10-06 17:14 | DenisChenu | Resolution | fixed => reopened |
| 2018-10-06 17:14 | DenisChenu | Note Added: 49277 | |
| 2018-10-06 17:14 | DenisChenu | Status | feedback => resolved |
| 2018-10-06 17:23 | DenisChenu | Changeset attached | => LimeSurvey master fd7911f8 |
| 2018-10-06 17:23 | DenisChenu | Changeset attached | => LimeSurvey master e5427b5d |
| 2018-10-06 17:23 | DenisChenu | Changeset attached | => LimeSurvey master fbeb2db6 |
| 2018-10-06 17:23 | DenisChenu | Changeset attached | => LimeSurvey master 399b4f0e |
| 2018-10-06 19:04 | DenisChenu | Changeset attached | => LimeSurvey master 6bb4566a |
| 2019-09-23 12:18 | c_schmitz | Status | resolved => closed |
| 2024-05-03 10:24 | DenisChenu | Bug heat | 6 => 8 |
| 2024-05-04 17:19 | guest | Bug heat | 8 => 6 |
| 2024-05-13 10:06 | DenisChenu | Bug heat | 6 => 8 |
| 2024-05-13 12:17 | guest | Bug heat | 8 => 6 |
| 2026-11-19 23:36 | c_schmitz | Bug heat | 6 => 8 |