Index: openacs-4/contrib/packages/survey/tcl/survey-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/tcl/Attic/survey-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 13 Jan 2004 20:19:31 -0000 1.1.2.2 +++ openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 13 Jan 2004 22:53:06 -0000 1.1.2.3 @@ -190,22 +190,26 @@ set user_value "" - db_1row predefined_question_id "" if {$predefined_question_id!=[db_null]} { # question is a predefined question. If it has already been answered, get the last response value from the db # if it is a predefined question with action_type="db" get the value from the db instead. db_1row predefined_question_data "" if {$action_type == "db"} { # select preselected value from the db set user_id [ad_get_user_id] - set user_value [db_string ignore "select $column_name from $table_name where $key_name=:user_id"] - set choice_id $user_value - set boolean_answer $user_value - set clob_answer $user_value - set number_answer $user_value - set varchar_answer $user_value - set date_answer $user_value - set attachment_answer $user_value + # We have to check for date + if {$abstract_data_type == "date"} { + set user_value [db_string ignore "select to_char($column_name,'YYYY MM DD') from $table_name where $key_name=:user_id" -default ""] + set date_answer $user_value + } else { + set user_value [db_string ignore "select $column_name from $table_name where $key_name=:user_id" -default ""] + set choice_id $user_value + set boolean_answer $user_value + set clob_answer $user_value + set number_answer $user_value + set varchar_answer $user_value + set attachment_answer $user_value + } } else { # select preselected value from latest response set user_id [ad_get_user_id] @@ -400,7 +404,7 @@ -datatype text \ -widget checkbox \ -label "$question_text" \ - -value $user_value \ + -values $user_value \ -options $options \ -required_p $required_p } Index: openacs-4/contrib/packages/survey/tcl/survey-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/tcl/Attic/survey-procs.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/survey/tcl/survey-procs.xql 13 Jan 2004 20:19:31 -0000 1.1.2.1 +++ openacs-4/contrib/packages/survey/tcl/survey-procs.xql 13 Jan 2004 22:53:06 -0000 1.1.2.2 @@ -110,7 +110,8 @@ presentation_options, presentation_alignment, creation_user, - creation_date + creation_date, + predefined_question_id from survey_questions, acs_objects where @@ -119,17 +120,9 @@ - - - - select predefined_question_id from survey_questions where - question_id=:question_id - - - - select action_type,table_name,column_name,key_name from + select action_type,abstract_data_type,table_name,column_name,key_name from survey_predefined_questions where predefined_question_id=:predefined_question_id