Home arrow Ondersteuning arrow Forums
LimeSurvey Forums
Welcome, Guest
Please Login or Register.    Lost Password?
Send results custom code broke post upd to 5394 (1 viewing) (1) Guest
Go to bottom Favoured: 0
TOPIC: Send results custom code broke post upd to 5394
#17743
simonx (User)
Senior Lime
Posts: 71
graphgraph
User Offline Click here to see the profile of this user
Send results custom code broke post upd to 5394 3 Months ago Karma: 1  
Dear All,
Since 5394 (I think) a bit of code I copied from another bit to send survey responses to the respondent doesn't work:
Code:

//Send results as well. Currently just bare-bones - will be extended in later release
$message .= "nn----------------------------n";
foreach ($_SESSION['insertarray'] as $value)
{
$questiontitle=returnquestiontitlefromfieldcode($value);
$message .= "$questiontitle:   ";
$details = arraySearchByKey($value, createFieldMap($surveyid),"fieldname", 1);
if ( $details['type'] == "T" or $details['type'] == "U")
{
$message .= "rn";
if (isset($_SESSION[$value]))
{
foreach (explode("n",getextendedanswer($value,$_SESSION[$value])) as $line) $message .= "t" . $line . "n";
}
}
elseif (isset($_SESSION[$value]))
{
$message .= getextendedanswer($value, $_SESSION[$value]);
$message .= "n";
}
}
$message .= "----------------------------nn";
//End Send results


This was inserted into function submittokens at line 1403 before
Code:

//Only send confirmation email if there is a valid email address.
It was taken from the function sendsubmitnotification below.
The respondent receives:
Code:

Token:   1234567890
Array:   Yes [Y]
Array:   No [N]
Etc.


The php error log shows:
Code:

Undefined variable: sourceQuestionGid in /var/www/survey/group.php on line 669


Changing the inserted code to the latest from
Code:

//v2: Send results as well. Currently just bare-bones - will be extended in later release
$message .= "nn----------------------------n";
foreach ($_SESSION['insertarray'] as $value)
{
$questiontitle=strip_tags(html_entity_decode_php4(returnquestiontitlefromfieldcode($value), ENT_QUOTES, "UTF-8"));
$message .= "$questiontitle:   ";
$details = arraySearchByKey($value, createFieldMap($surveyid),"fieldname", 1);
if ( $details['type'] == "T" or $details['type'] == "U")
{
$message .= "rn";
if (isset($_SESSION[$value]))
{
foreach (explode("n",getextendedanswer($value,$_SESSION[$value])) as $line)
{
$message .= "t" . strip_tags(html_entity_decode_php4($line, ENT_QUOTES, "UTF-8"));
$message .= "n";
}
}
}
elseif (isset($_SESSION[$value]))
{
$message .= strip_tags(html_entity_decode_php4(getextendedanswer($value, $_SESSION[$value],ENT_QUOTES, "UTF-8")));
$message .= "n";
}
}
$message .= "nn----------------------------nn";
//End Send results


gives in php error log:
Code:

Undefined variable: sourceQuestionGid in /var/www/survey/group.php on line 669
html_entity_decode() expects parameter 1 to be string, array given in /var/www/survey/classes/core/html_entity_decode_php4.php on line 50


and following to respondent:
Code:

Token:   1234567890
:   Yes [Y]
:   No [N]
etc.



BTW Administrator receives full responses, but starts with:
Code:

T:
[o]:   1234567890



I'm not mega php proficient, but can follow instructions.

TIA
Simon
 
Logged Logged  
 
Cheers,
Simon.
  The administrator has disabled public write access.
#17752
c_schmitz (Admin)
Moderator Lime
Posts: 1354
graphgraph
User Online Now Click here to see the profile of this user
Re:Send results custom code broke post upd to 5394 3 Months ago Karma: 39  
Hi!

This error will be fixed with tomorrows release.
It is already fixed in subversion.
 
Logged Logged  
 
Best regards

Carsten Schmitz
LimeSurvey Project Leader
  The administrator has disabled public write access.
#17767
simonx (User)
Senior Lime
Posts: 71
graphgraph
User Offline Click here to see the profile of this user
Re:Send results custom code broke post upd to 5394 3 Months ago Karma: 1  
Thanks Carsten,
Is "tomorrows release" today the 19th?
 
Logged Logged  
 
Cheers,
Simon.
  The administrator has disabled public write access.
Go to top