View Issue Details

This bug affects 1 person(s).
 0
IDProjectCategoryView StatusLast Update
19182Bug reportsPluginspublic2023-10-25 18:48
Reporterfcatalan Assigned Togabrieljenik  
PrioritynoneSeverityminor 
Status closedResolutionduplicate 
Product Version6.2.x 
Summary19182: ConsoleApplication can't use Survey->getSurveyUrl()
Description

We use the sendMailCron plugin to automate our reminder mailings. We have a new 6.2 install and were trying the plugin. We had to update the compatibility section in config.xml on the plugin and then it installed and configured just fine.

But when trying it we got the following error:

CException: ConsoleApplication and its behaviors do not have a method or closure named "createPublicUrl". in /var/www/limesurvey/vendor/yiisoft/yii/framework/base/CComponent.php:266

We have worked around this by reverting the Survey URL generation in LimeMailer->getTokenReplacements() to use App()->getController()
->createAbsoluteUrl() as in previous versions instead of using Survey->getSurveyUrl(). The old style url generation seems to work fine so far.

Steps To Reproduce

Steps to reproduce

-Install the latest version of sendMailCron https://github.com/SondagesPro/LS-sendMailCron (update config.xml to allow installing on LS 6.x)
-Set up mail delivery and create a survey with users and pending reminders.
-Run the console command to send the reminders:
php limesurvey/application/commands/console.php plugin --target=sendMailCron

Expected result

Pending mails are sent, for example:

[2023-10-20T08:47:28+02:00] [INFO] Start sendMailByCron for 122796
[2023-10-20T08:47:28+02:00] [INFO] 2 messages sent
[2023-10-20T08:47:28+02:00] [INFO] No message to sent

Actual result

CException: ConsoleApplication and its behaviors do not have a method or closure named "createPublicUrl". in /var/www/limesurvey/vendor/yiisoft/yii/framework/base/CComponent.php:266
Stack trace:
#0 /var/www/limesurvey/application/models/Survey.php(2357): CComponent->__call()
#1 /var/www/limesurvey/application/core/LimeMailer.php(826): Survey->getSurveyUrl()
#2 /var/www/limesurvey/application/core/LimeMailer.php(855): LimeMailer->getTokenReplacements()
#3 /var/www/limesurvey/application/core/LimeMailer.php(566): LimeMailer->doReplacements()
#4 /var/www/limesurvey/plugins/sendMailCron/sendMailCron.php(963): LimeMailer->sendMessage()
#5 /var/www/limesurvey/plugins/sendMailCron/sendMailCron.php(766): sendMailCron->sendEmails()
#6 /var/www/limesurvey/plugins/sendMailCron/sendMailCron.php(323): sendMailCron->sendTokenMessages()
#7 [internal function]: sendMailCron->sendMailByCli()
#8 /var/www/limesurvey/application/libraries/PluginManager/PluginManager.php(269): call_user_func()
#9 /var/www/limesurvey/application/commands/PluginCommand.php(55): LimeSurvey\PluginManager\PluginManager->dispatchEvent()
#10 [internal function]: PluginCommand->actionIndex()
#11 /var/www/limesurvey/vendor/yiisoft/yii/framework/console/CConsoleCommand.php(178): ReflectionMethod->invokeArgs()
#12 /var/www/limesurvey/vendor/yiisoft/yii/framework/console/CConsoleCommandRunner.php(71): CConsoleCommand->run()
#13 /var/www/limesurvey/vendor/yiisoft/yii/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run()
#14 /var/www/limesurvey/vendor/yiisoft/yii/framework/base/CApplication.php(185): CConsoleApplication->processRequest()
#15 /var/www/limesurvey/application/commands/console.php(77): CApplication->run()
#16 {main}www-data@encuesta/var/www/limesurvey/application/models/Survey.phpSurvey.php

TagsNo tags attached.
Bug heat0
Complete LimeSurvey version number (& build)6.2.5+230828
I will donate to the project if issue is resolvedNo
Browser-
Database type & versionmysql Ver 8.0.34
Server OS (if known)Ubuntu 22.04.3
Webserver software & version (if known)nginx
PHP VersionPHP 8.1.2-1

Relationships

duplicate of 18961 closedDenisChenu {SURVEYURL} didn't work with plugin using cli event 

Users monitoring this issue

There are no users monitoring this issue.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2023-10-20 09:30 fcatalan New Issue
2023-10-20 09:37 DenisChenu Relationship added related to 18961
2023-10-25 18:48 gabrieljenik Assigned To => gabrieljenik
2023-10-25 18:48 gabrieljenik Status new => closed
2023-10-25 18:48 gabrieljenik Resolution open => duplicate
2023-10-25 18:48 gabrieljenik Relationship replaced duplicate of 18961