Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

copy array question - only first subquestion and answer option copied

  • fvanderstarre
  • fvanderstarre's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 8 months ago #123026 by fvanderstarre
Hi,
I'm using L.S. 2.05+ build 150310 on Linux RHEL 7, PHP 5.4.43. When copying an array type question having multiple subquestions and answer options, only the first ones are copied. I suspect this has something to do with this OS/PHP version combination, because on Linux RHEL 5.5/PHP 5.3.3 it goes OK (same LS build).
I'm far from proficient in PHP, but I was wondering about the relevant code in ../application/controllers/admin/database.php (lines 474 & 496):

$r1 = Question::model()->getSubQuestions(returnGlobal('oldqid'));
while ($qr1 = $r1->read())
....

$r1 = Answer::model()->getAnswers(returnGlobal('oldqid'));
while ($qr1 = $r1->read())
.....
Is there another way of coding this (foreach?) and if so, could anyone show me? Thx!
Frank
The topic has been locked.
  • fvanderstarre
  • fvanderstarre's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 7 months ago #123300 by fvanderstarre
I replaced "while ($qr1 = $r1->read())" by:
"$qra = $r1->readAll();
foreach ($qra as $qr1)"
This seems to do the trick!
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #123322 by holch
I would do a bug report, because this could impact others as well.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • fvanderstarre
  • fvanderstarre's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 7 months ago #123334 by fvanderstarre
I just did, see bug report .
Cheers, Frank
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose