Skip to content

Commit

Permalink
Dev: Fix bug with CPDB when saving new participant without any attrib…
Browse files Browse the repository at this point in the history
…utes
  • Loading branch information
olleharstedt committed Nov 22, 2016
1 parent bb7ab24 commit 828add0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -555,6 +555,9 @@ public function editParticipant()
}

$extraAttributes = Yii::app()->request->getPost('Attributes');
if (is_null($extraAttributes)) {
$extraAttributes = array();
}

switch ($operation) {
case 'edit':
Expand All @@ -577,7 +580,7 @@ public function editParticipant()
* @param array $extraAttributes
* @return void
*/
public function updateParticipant($aData, $extraAttributes)
public function updateParticipant($aData, array $extraAttributes = array())
{
$participant = Participant::model()->findByPk($aData['participant_id']);

Expand All @@ -598,7 +601,7 @@ public function updateParticipant($aData, $extraAttributes)
$participant->attributes = $aData;
$success['participant'] = $participant->save();

foreach( $extraAttributes as $htmlName => $attributeValue ) {
foreach($extraAttributes as $htmlName => $attributeValue ) {
list(,$attribute_id) = explode('_',$htmlName);
$data = array(
'attribute_id'=>$attribute_id,
Expand All @@ -617,7 +620,7 @@ public function updateParticipant($aData, $extraAttributes)
* @param array $extraAttributes
* @return string json
*/
public function addParticipant($aData, $extraAttributes)
public function addParticipant($aData, array $extraAttributes = array())
{
if (Permission::model()->hasGlobalPermission('participantpanel', 'create')) {
$uuid = Participant::gen_uuid();
Expand Down

0 comments on commit 828add0

Please sign in to comment.