I am getting the following:

Notice: Undefined variable: status_code em limesurvey_sync_test_interface() (line 395 of /srv/www/domain/public_html/sites/all/modules/limesurvey_sync/limesurvey_sync.inc).

and:

A LimeSurvey site page has been successfully reached, but it does not match the same LimeSurvey database.

The "LimeSurvey site path" is settled correctly. Drupal resides in the root of a domain with Limesurvey installed within a folder in that same domain.

I am using a fresh install of Drupal 7.23 with PHP 5.3.10-1ubuntu3.8 and MySQL 5.5.34-0ubuntu0.12.04.1 if that helps

Any ideas on what might be the cause?

Comments

thedut’s picture

Hello hvalentim,

Nice shot :
in order to fix this issue : edit the limesurvey_sync.inc file, remplacing the line 395 :
case ($status_code >= 500):
by :
case ($httpcode >= 500):

and report.

thedut’s picture

Issue summary: View changes

add details

hvalentim’s picture

Replaced the line. The "Undefined variable:" portion is gone and I am getting a "The LimeSurvey site page has not been reached (Error 503: server replied with an error)" prior to trying to define the correct "LimeSurvey site path"

When I define the correct site path, I still get the warning "A LimeSurvey site page has been successfully reached, but it does not match the same LimeSurvey database."

But the tested url is correct and works fine if I open in a browser.

This is what I have in drupal settings.php:
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'customname_drup',
'username' => 'customusername',
'password' => 'randonpassword',
'host' => 'localhost',
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
),
),
);

$databases['ls']['default'] = array(
'driver' => 'mysql',
'database' => 'customname2',
'username' => 'customusername',
'password' => 'randonpassword',
'host' => 'localhost',
'prefix' => 'lime_',
'collation' => 'utf8_general_ci',
);

The username and password are the same for both databases.

I really have no clue as what the problem might be.

I will message you the urls.

Thanks for the assistance.

hvalentim’s picture

BTW, in node/add/survey I correctly see the polls available in the limesurvey installation.

But sync fails with a:

"Answers importation has encountered an error."
and
"An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?render=overlay&id=3&op=do StatusText: Internal Server Error ResponseText:"

thedut’s picture

Hello,

I have found a code fix for both issues :
Notice: Undefined variable: status_code em limesurvey_sync_test_interface() (line 395 of /srv/www/domain/public_html/sites/all/modules/limesurvey_sync/limesurvey_sync.inc).
and:
A LimeSurvey site page has been successfully reached, but it does not match the same LimeSurvey database.
I will publish it here soon (it is into your mailbox).

I am still investigating the issue you meet in #3 :

"Answers importation has encountered an error."
and
"An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?render=overlay&id=3&op=do StatusText: Internal Server Error ResponseText:"

Please be patient.

maxime.deg’s picture

Everything is cool.

Just the same problem as #3 on synchronization

"Answers importation has encountered an error."
and
"An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?render=overlay&id=3&op=do StatusText: Internal Server Error ResponseText:"

thedut’s picture

Assigned: Unassigned » thedut
Issue summary: View changes
Status: Active » Patch (to be ported)
StatusFileSize
new1.12 KB
new9.35 KB

Here is the fix for the both initial issues :

Notice: Undefined variable: status_code em limesurvey_sync_test_interface() (line 395 of /srv/www/domain/public_html/sites/all/modules/limesurvey_sync/limesurvey_sync.inc).

and:

A LimeSurvey site page has been successfully reached, but it does not match the same LimeSurvey database.
thedut’s picture

And here is the Patch fixing the issue in #3 and #5 :
Error 500 on trying to import new answers (from the survey synchronization tab).

maxime.deg’s picture

I confirm it's working now.

Thank you :)

thedut’s picture

Great !

hvalentim’s picture

Thanks a lot!

Some issues I have found while testing the configuration:

a) The "Respond to the survey" link which appears once you try to resume a Survey does not work as it links to "http://node/13/edit" instead of linking to "http://mydomain.com/node/13/edit"

b) Is there a way to limit the number of times a registered user can answer a given survey? As it is it is unlimited.

I am looking for a solution that once a registered user tries to answer a survey a second time he is shown something like: "You already answered this survey. You can [link]see/edit your answers or resume the survey here[/link]." I guess some sort of block using views will do the trick.

c) In the demo site you have a form (here) where the "Submit this page in order to access to the survey form" step is supressed. How does one achieve this?

thedut’s picture

StatusFileSize
new1.14 KB

Here is the fix for the 'answer completed link issue a)
I will include it into the next release

thedut’s picture

b) Is there a way to limit the number of times a registered user can answer a given survey? As it is it is unlimited.

Yes : you can use :

There is already a thread about it, with rules examples. In your case, I guess rules is the right way.

thedut’s picture

c) In the demo site you have a form (here) where the "Submit this page in order to access to the survey form" step is supressed. How does one achieve this?

On my demo site : the http://www.drupal-limesurvey-synchronization.com/site/node/add/all-question-types-en url directly redirect to the http://www.drupal-limesurvey-synchronization.com/site/toform/all_question_types_en url : but you should consider it is the same page.
It hapens in a specific situation :
When the LimeSurvey parameter are : do not activate token persistence and the token table does not exists.
In such case : the node/add/ page will not save the answer node, that why the node is not submitted.

Concerning the other survey of the demo site : http://www.drupal-limesurvey-synchronization.com/site/node/add/test-survey-en, I want to save the answer title that why the node is submitted. In this case, an answer node is created.

thedut’s picture

I have split the extra issues from #7 and #11 into 2 other issues, with explicit titles :

hvalentim’s picture

Thanks a lot for your advice.

MATTER ONE - As far as b (allowing an authenticated user to answer only once to a survey) I found the most straightforward and user friendly approach to be creating a single "landing" page for the survey using Display Suite and Views. Considering I am using Facebook for authentication the scenario of use goes like this:

a -> Anonymous users are shown a "connect with facebook button" alone (Facebook OAuth block).
b -> Once authenticated they are shown a single link to add a new node/start answering (Using a "Global: Text area" for a "No Results Behaviour" in a block created in Views).
c -> Afterwards (once they already started answering and authored a survey node) they are shown resumed info on the node/survey they own/authored, namely completion status etc... (using LS answers fields) and a link to either resume a started but unfinished survey or just to see the answers previously given. It is also possible to use a "Content: Rendered Node" field to show these directly on a block or display suite field.

I still use "Node Limit" in case the user somehow tries to add a second node/survey (say if he remember the URL from the first time).

With rules I stumbled on this issue, even following your advice. The user was redirected and the message shown but the new node was still being created even using the 'node_presave' event.

MATTER TWO - Regarding issue c (taking the user directly to start answering), I guess Drupal architecture somehow imposes an intermediate step in order to create a new node but the ideal thing would be to while still using tokens taking the user directly to LimeSurvey with a single click. The step where the user is shown the respond title for the survey/node being created/started is of no practical use and unnecessarily confusing.

Also the interface for resuming an incomplete survey with the "Edit the survey respond" thick box step might be more than the "average Joe" can handle. Personally if possible I would rather see the "Resume Answer" link take you directly to the Survey.

Perhaps by exposing/adding the "Referrer URL" (carrying the token) as a field in Views one could allow for this to be simplified/manipulated there?

thedut’s picture

Hello hvalentim,

Concerning Matter one :
The event is 'node_presave' but the action should be to redirect immediately without finishing the script (there should be a option about it).

Concerning Matter 2 :
Here is a workarround for this. Using Rules, I suggest you :

  1. automatically create a node answer with the connected user as author,
  2. then retrieving the token value,
  3. then build the survey url,
  4. and then redirecting to this url in order to complete the survey.

Before going forward, I suggest you create a new issue with an appropriate title in order to complete the interesting discussion.

thedut’s picture

Status: Patch (to be ported) » Closed (fixed)

Fixed into the LimeSurvey Sync 7.x-1.6 release and 6.x-1.6 release.