From 0976fe62ee8dacf71d34e5efe11b09ff767a9395 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Fri, 14 Nov 2008 00:58:44 +0000 Subject: [PATCH] checked for existence of result set before applying RecordCount method New questionnaire form has larger text boxes for entering data - and hides entry when rs not required --- admin/clientquestionnaire.php | 6 ++++-- admin/new.php | 18 ++++++++++-------- admin/operatorquestionnaire.php | 6 ++++-- admin/operatorskill.php | 6 ++++-- functions/functions.calendar.php | 2 +- functions/functions.limesurvey.php | 2 +- js/new.js | 13 +++++++++++++ 7 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 js/new.js diff --git a/admin/clientquestionnaire.php b/admin/clientquestionnaire.php index d2a2372d..58384ad5 100644 --- a/admin/clientquestionnaire.php +++ b/admin/clientquestionnaire.php @@ -62,8 +62,10 @@ function vq($client_id,$questionnaire_id) $vq = $db->Execute($sql); - return $vq->RecordCount(); - + if ($vq) + return $vq->RecordCount(); + else + return 0; } /** diff --git a/admin/new.php b/admin/new.php index c832164c..bac360ff 100644 --- a/admin/new.php +++ b/admin/new.php @@ -55,7 +55,7 @@ include("../functions/functions.input.php"); global $ldb; global $db; -xhtml_head(T_("New: Create new questionnaire")); +xhtml_head(T_("New: Create new questionnaire"),true,false,array("../js/new.js")); if (isset($_POST['import_file'])) { @@ -139,13 +139,15 @@ foreach($surveys as $s)

-

-

-

-

-

-

-

+

+
+

+

+

+

+

+
+

"/>

Execute($sql); - return $vq->RecordCount(); - + if ($vq) + return $vq->RecordCount(); + else + return 0; } /** diff --git a/admin/operatorskill.php b/admin/operatorskill.php index 71592e86..1da0f6d7 100644 --- a/admin/operatorskill.php +++ b/admin/operatorskill.php @@ -62,8 +62,10 @@ function vq($operator_id,$outcome_type_id) $vq = $db->Execute($sql); - return $vq->RecordCount(); - + if ($vq) + return $vq->RecordCount(); + else + return 0; } /** diff --git a/functions/functions.calendar.php b/functions/functions.calendar.php index e24f6b95..2393f932 100644 --- a/functions/functions.calendar.php +++ b/functions/functions.calendar.php @@ -496,7 +496,7 @@ function display_calendar($respondent_id, $questionnaire_id, $year = false, $mon AND MONTH(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisMonth()}' AND YEAR(CONVERT_TZ(s.start,'UTC',r.Time_zone_name)) = '{$Day->thisYear()}'"); - if ($rs->RecordCount() == 0) + if (!empty($rs) && $rs->RecordCount() == 0) { echo ( "".$Day->thisDay()."\n" ); } diff --git a/functions/functions.limesurvey.php b/functions/functions.limesurvey.php index 21931619..5eeda045 100644 --- a/functions/functions.limesurvey.php +++ b/functions/functions.limesurvey.php @@ -95,7 +95,7 @@ function create_limesurvey_questionnaire($title) $isquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE sid=$surveyid"; $isresult = $ldb->Execute($isquery); } - while ($isresult->RecordCount()>0); + while (!empty($isresult) && $isresult->RecordCount() > 0); $isquery = "INSERT INTO ". LIME_PREFIX ."surveys\n" . "(sid, owner_id, admin, active, useexpiry, expires, " diff --git a/js/new.js b/js/new.js new file mode 100644 index 00000000..5e1f867b --- /dev/null +++ b/js/new.js @@ -0,0 +1,13 @@ +function showHide(me,id) +{ + e = document.getElementById(id); + if (me.checked == true) + { + e.style.display = 'inline'; + } + else + { + e.style.display = 'none'; + } + +}