diff --git a/application/models/Participant.php b/application/models/Participant.php index 3b0e1cf80f1..2cfeb10214d 100755 --- a/application/models/Participant.php +++ b/application/models/Participant.php @@ -327,13 +327,13 @@ public function getColumns() 'htmlOptions' => ['class' => 'ls-sticky-column'], ], [ - "name" => 'lastname' + "name" => 'lastname', ], [ - "name" => 'firstname' + "name" => 'firstname', ], [ - "name" => 'email' + "name" => 'email', ], [ "name" => 'language', @@ -417,6 +417,15 @@ public function getColumns() */ public function search() { + $encryptedAttributes = $this->getParticipantsEncryptionOptions(); + $encryptedAttributesColums = isset($encryptedAttributes) && isset($encryptedAttributes['columns']) + ? $encryptedAttributes['columns'] + : []; + $encryptedAttributesColums = array_filter($encryptedAttributesColums, function ($column) { + return $column === 'Y'; + }); + $encryptedAttributesColums = array_keys($encryptedAttributesColums); + $sort = new CSort(); $sort->defaultOrder = 'lastname'; $sortAttributes = array( @@ -455,6 +464,14 @@ public function search() ); $this->decryptEncryptAttributes('encrypt'); + if (!empty($encryptedAttributesColums)) { + foreach ($encryptedAttributesColums as $encryptedColum) { + if (isset($sortAttributes[$encryptedColum])) { + unset($sortAttributes[$encryptedColum]); + } + } + } + $criteria = new CDbCriteria(); $criteria->join = 'LEFT JOIN {{users}} as owner on uid=owner_uid LEFT JOIN {{participant_shares}} AS shares ON t.participant_id = shares.participant_id AND (shares.share_uid = ' . Yii::app()->user->id . ' OR shares.share_uid = -1)'; $criteria->compare('t.participant_id', $this->participant_id, true, 'AND', true);