|
From: <gem...@li...> - 2011-10-20 11:10:41
|
Revision: 115
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=115&view=rev
Author: matijsdejong
Date: 2011-10-20 11:10:35 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Surveys give information based on the group they are assigned on as per #24. Also found database field no longer in use in code.
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Survey.php
trunk/library/configs/db/tables/gems__surveys.30.sql
Modified: trunk/library/classes/Gems/Tracker/Survey.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Survey.php 2011-10-19 18:01:56 UTC (rev 114)
+++ trunk/library/classes/Gems/Tracker/Survey.php 2011-10-20 11:10:35 UTC (rev 115)
@@ -104,6 +104,26 @@
}
/**
+ * Makes sure the receptioncode data is part of the $this->_gemsData
+ *
+ * @param boolean $reload Optional parameter to force reload.
+ */
+ private function _ensureGroupData($reload = false)
+ {
+ if ($reload || (! isset($this->_gemsSurvey['ggp_id_group']))) {
+ $sql = "SELECT * FROM gems__groups WHERE ggp_id_group = ?";
+ $code = $this->_gemsSurvey['gsu_id_primary_group'];
+
+ if ($row = $this->db->fetchRow($sql, $code)) {
+ $this->_gemsSurvey = $row + $this->_gemsSurvey;
+ } else {
+ $name = $this->getName();
+ throw new Gems_Exception("Group code $code is missing for survey '$name'.");
+ }
+ }
+ }
+
+ /**
* Update the survey, both in the database and in memory.
*
* @param array $values The values that this token should be set to
@@ -466,6 +486,20 @@
}
/**
+ * Should this survey be filled in by staff members.
+ *
+ * @return boolean
+ */
+ public function isTakenByStaff()
+ {
+ if (! isset($this->_gemsSurvey['ggp_staff_members'])) {
+ $this->_ensureGroupData();
+ }
+
+ return (boolean) $this->_gemsSurvey['ggp_staff_members'];
+ }
+
+ /**
* Update the survey, both in the database and in memory.
*
* @param array $values The values that this token should be set to
Modified: trunk/library/configs/db/tables/gems__surveys.30.sql
===================================================================
--- trunk/library/configs/db/tables/gems__surveys.30.sql 2011-10-19 18:01:56 UTC (rev 114)
+++ trunk/library/configs/db/tables/gems__surveys.30.sql 2011-10-20 11:10:35 UTC (rev 115)
@@ -20,7 +20,10 @@
references gems__sources (gso_id_source),
gsu_active boolean not null default 0,
gsu_status varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
+
+ -- depreciated
gsu_staff boolean not null default 0,
+ -- end depreciated
gsu_id_primary_group bigint unsigned null
references gems__groups (ggp_id_group),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|