On the Limesurvey database the table prefix is set to "" (blank, there is no table prefix).
When I set the 'LimeSurvey database prefix' to blank in the module settings on Drupal,
The LimeSurvey site database tables are OK (green checkmark)
The LimeSurvey site url is OK (green checkmark)
but there are errors:

user warning: Table 'db_lime.lime_surveys_languagesettings' doesn't exist query: INSERT INTO lime_surveys_languagesettings(surveyls_survey_id, surveyls_title, surveyls_description) VALUES (159, 'Fake survey #159 from the drupal site http://www.example.com/', 'This survey is not functionnal, it is generated by the LimeSurvey Sync Drupal module from the synchronisation setting page http://www.example.com/index.php?q=admin/config/media/ls_sync') in /home/user1/public_html/drupal/sites/all/modules/limesurvey_sync/ls_api/limesurvey_sync_api_sync.inc on line 562.

The same error for table lime_surveys on line 561.
I've tried changing line 120 on limesurvey_sync/ls_api/limesurvey_sync_api_sync.inc:
$ls_settings = variable_get('ls_settings', array('ls_db_prefix' => 'lime_'));
to
$ls_settings = variable_get('ls_settings', array('ls_db_prefix' => ''));

But I did not work. I gues i'm not that good at coding.
And don't tell me that bugs are features :)

Comments

agent_danniel’s picture

I'm using 2 different domain-names (on the same server: localhost)
$db_url['default'] = 'mysql://username:password@localhost/databasename';
$db_url['ls'] = 'mysql://username:password@your_LimeSurvey_host/your_LimeSurvey_database_name';

thedut’s picture

Hello agent_danniel

Yes it is a bug !
Try this : Edit

  • the ls_api/limesurvey_sync_api_sync.inc file
    • on line 528 remplacing :
      function limesurvey_sync_fake_survey($sid = '', $action = 'create') {
      by
      function limesurvey_sync_fake_survey($sid = '', $action = 'create', $ls_settings) {
    • on line 561 remplacing :
      $success1 = db_query('INSERT INTO ' . limesurvey_sync_table('surveys') . " (sid, active, listpublic, owner_id, admin, language, datecreated) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s')", array_values(array_merge($for_fake_survey, $fix_insert)));
      by
      $success1 = db_query('INSERT INTO ' . limesurvey_sync_table('surveys', '', $ls_settings) . " (sid, active, listpublic, owner_id, admin, language, datecreated) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s')", array_values(array_merge($for_fake_survey, $fix_insert)));
    • on line 562 remplacing :
      $success2 = db_query('INSERT INTO ' . limesurvey_sync_table('surveys_languagesettings') . "(surveyls_survey_id, surveyls_title, surveyls_description) VALUES (%d, '%s', '%s')", array_values($surveys_languagesettings));
      by
      $success2 = db_query('INSERT INTO ' . limesurvey_sync_table('surveys_languagesettings', '', $ls_settings) . "(surveyls_survey_id, surveyls_title, surveyls_description) VALUES (%d, '%s', '%s')", array_values($surveys_languagesettings));
    • on line 566 remplacing :
      $success1 = db_query('DELETE FROM ' . limesurvey_sync_table('surveys') . ' WHERE sid = %d', $sid);
      by
      $success1 = db_query('DELETE FROM ' . limesurvey_sync_table('surveys', '', $ls_settings) . ' WHERE sid = %d', $sid);
    • on line 567 remplacing :
      $success2 = db_query('DELETE FROM ' . limesurvey_sync_table('surveys_languagesettings') . ' WHERE surveyls_survey_id = %d', $sid);
      by
      $success2 = db_query('DELETE FROM ' . limesurvey_sync_table('surveys_languagesettings', '', $ls_settings) . ' WHERE surveyls_survey_id = %d', $sid);
  • And the limesurvey_sync.inc file
    • on line 450 replacing :
      $fake_sid = limesurvey_sync_fake_survey();
      by
      $fake_sid = limesurvey_sync_fake_survey('', 'create', $settings);
    • and on line 464, replacing :
      limesurvey_sync_fake_survey($fake_sid, 'delete');
      by
      limesurvey_sync_fake_survey($fake_sid, 'delete', $settings);

and report.

thedut’s picture

Assigned: Unassigned » thedut
Status: Active » Patch (to be ported)
StatusFileSize
new3.77 KB

Here is the corresponding patch.
This issue should only appears on v6.x-1.3 to 1.5, with a LimeSurvey database prefix distinct to the default value : 'lime_'.
The 7.x-1.x branch is not concerned.
I will merge this patch into the next release.

thedut’s picture

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

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