|
From: <gem...@li...> - 2012-10-10 17:43:51
|
Revision: 976
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=976&view=rev
Author: matijsdejong
Date: 2012-10-10 17:43:44 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
If you have multi org rights and login as an organization that has patients, that organization is selected by default in the respondent overview
Modified Paths:
--------------
trunk/library/classes/Gems/Default/RespondentAction.php
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2012-10-10 16:00:45 UTC (rev 975)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2012-10-10 17:43:44 UTC (rev 976)
@@ -115,7 +115,7 @@
protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false)
{
$returnValues = array();
-
+
if (APPLICATION_ENV !== 'production') {
$bsn = new MUtil_Validate_Dutch_Burgerservicenummer();
$num = mt_rand(100000000, 999999999);
@@ -353,6 +353,28 @@
}
/**
+ * Returns the default search values for this class instance.
+ *
+ * Used to specify the filter when no values have been entered by the user.
+ *
+ * @return array
+ */
+ public function getDefaultSearchData()
+ {
+ if ($this->getModel()->isMultiOrganization()) {
+ $user = $this->loader->getCurrentUser();
+
+ $orgId = $user->getCurrentOrganizationId();
+ $orgs = $user->getRespondentOrganizations();
+
+ if (isset($orgs[$orgId])) {
+ return array(MUtil_Model::REQUEST_ID2 => $orgId);
+ }
+ }
+ return parent::getDefaultSearchData();
+ }
+
+ /**
* Returns the currently used organization
*
* @param int $default Optional default value
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|