diff --git a/CHANGELOG b/CHANGELOG index ca5e5fa0..0349772c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -25,7 +25,8 @@ INSERT INTO `sample_var_type` (`type`, `description`, `table`) VALUES Specify details of respondent self completion: -ALTER TABLE `questionnaire` ADD `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self completion' AFTER `info` , +ALTER TABLE `questionnaire` ADD `self_complete` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `info`, +ADD `lime_mode` VARCHAR( 64 ) NULL COMMENT 'Limesurvey mode for respondent self completion' AFTER `self_complete` , ADD `lime_template` VARCHAR( 128 ) NULL COMMENT 'Limesurvey template for respondent self completion' AFTER `lime_mode` , ADD `lime_endurl` VARCHAR( 256 ) NULL COMMENT 'Forwarding end URL for respondent self completion' AFTER `lime_template` ; diff --git a/admin/new.php b/admin/new.php index fac19006..1c7e90e0 100644 --- a/admin/new.php +++ b/admin/new.php @@ -76,17 +76,6 @@ if (isset($_POST['import_file'])) if (isset($_POST['respsc'])) $respsc = 1; if ($_POST['selectrs'] != "none") $rs = 1; - $lime_mode = "NULL"; - $lime_template = "NULL"; - $lime_endurl = "NULL"; - - if ($respsc == 1) - { - $lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc()); - $lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc()); - $lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc()); - } - $name = $db->qstr($_POST['description'],get_magic_quotes_gpc()); $rs_intro = $db->qstr(html_entity_decode($_POST['rs_intro'],get_magic_quotes_gpc())); $rs_project_intro = $db->qstr(html_entity_decode($_POST['rs_project_intro'],get_magic_quotes_gpc())); @@ -104,14 +93,26 @@ if (isset($_POST['import_file'])) $lime_rs_sid = bigintval($_POST['selectrs']); } - $sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,lime_mode,lime_template,lime_endurl) - VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$lime_mode,$lime_template,$lime_endurl)"; + $sql = "INSERT INTO questionnaire (questionnaire_id,description,lime_sid,restrict_appointments_shifts,restrict_work_shifts,respondent_selection,rs_intro,rs_project_intro,rs_project_end,rs_callback,rs_answeringmachine,testing,lime_rs_sid,info,self_complete) + VALUES (NULL,$name,'$lime_sid','$ras','$rws','$rs',$rs_intro,$rs_project_intro,$rs_project_end,$rs_callback,$rs_answeringmachine,'$testing',$lime_rs_sid,$info,$respsc)"; $rs = $db->Execute($sql); if ($rs) { $qid = $db->Insert_ID(); + if ($respsc == 1) + { + $lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc()); + $lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc()); + $lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc()); + + $sql = "UPDATE questionnaire + SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl + WHERE questionnaire_id = $qid"; + + $db->Execute($sql); + } print "

" . T_("Successfully inserted") . " $name " . T_("as questionnaire") . " $qid, " . T_("linked to") . " $lime_sid

"; }else { diff --git a/admin/questionnairelist.php b/admin/questionnairelist.php index 005e5062..01ddfaf8 100644 --- a/admin/questionnairelist.php +++ b/admin/questionnairelist.php @@ -91,17 +91,6 @@ if (isset($_POST['update']) && isset($_GET['modify'])) if (isset($_POST['rws'])) $rws = 1; if (isset($_POST['respsc'])) $respsc = 1; - $lime_mode = "NULL"; - $lime_template = "NULL"; - $lime_endurl = "NULL"; - - if ($respsc == 1) - { - $lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc()); - $lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc()); - $lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc()); - } - $name = $db->qstr(html_entity_decode($_POST['description'])); if (isset($_POST['rs_intro'])) { @@ -115,7 +104,7 @@ if (isset($_POST['update']) && isset($_GET['modify'])) $rs_project_end = $db->qstr(html_entity_decode($_POST['rs_project_end'],true)); $sql = "UPDATE questionnaire - SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl + SET description = $name, info = $info, rs_project_end = $rs_project_end, restrict_appointments_shifts = '$ras', restrict_work_shifts = '$rws', self_complete = $respsc WHERE questionnaire_id = '$questionnaire_id'"; $db->Execute($sql); @@ -129,7 +118,19 @@ if (isset($_POST['update']) && isset($_GET['modify'])) $db->Execute($sql); } - + if ($respsc == 1) + { + $lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc()); + $lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc()); + $lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc()); + + $sql = "UPDATE questionnaire + SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl + WHERE questionnaire_id = $questionnaire_id"; + + $db->Execute($sql); + } + } xhtml_head(T_("Questionnaire list"),true,array("../css/table.css"),array("../js/new.js")); @@ -175,7 +176,7 @@ if (isset($_GET['modify'])) if ($rs['restrict_appointments_shifts'] != 1) $ras = ""; if ($rs['restrict_work_shifts'] != 1) $rws = ""; if ($rs['testing'] != 1) $testing = ""; - if (empty($rs['lime_mode'])) + if ($rs['self_complete'] == 0) { $rsc = ""; $rscd = "style='display:none;'";