Skip to content

Commit

Permalink
Fixed issue #6468 - Can't set participant attribute value to 0 (zero)…
Browse files Browse the repository at this point in the history
… on drop down
  • Loading branch information
jcleeland committed Aug 14, 2012
1 parent 306c432 commit 008e293
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -1322,24 +1322,26 @@ function saveAttribute()

ParticipantAttributeNames::model()->saveAttributeLanguages($langdata);
}
if (Yii::app()->request->getPost('attribute_value_name_1'))
/* Create new attribute value */
if (Yii::app()->request->getPost('attribute_value_name_1') || Yii::app()->request->getPost('attribute_value_name_1') == "0")
{
$i = 1;
do
{
$attvaluename = 'attribute_value_name_' . $i;
if (!empty($_POST[$attvaluename]))
if ($_POST[$attvaluename] != "")
{
$aDatavalues[$i] = array(
'attribute_id' => $iAttributeId,
'value' => Yii::app()->request->getPost($attvaluename)
);
}
$i++;
} while (isset($_POST[$attvaluename]));
} while ($_POST[$attvaluename] != "");
ParticipantAttributeNames::model()->storeAttributeValues($aDatavalues);
}
if (Yii::app()->request->getPost('editbox'))
/* Save updated attribute values */
if (Yii::app()->request->getPost('editbox') || Yii::app()->request->getPost('editbox')=="0")
{
$editattvalue = array(
'attribute_id' => $iAttributeId,
Expand Down Expand Up @@ -1367,7 +1369,7 @@ function delAttributeValues()
*/
function editAttributevalue()
{
if (Yii::app()->request->getPost('oper') == "edit" && Yii::app()->request->getPost('attvalue'))
if (Yii::app()->request->getPost('oper') == "edit" && (Yii::app()->request->getPost('attvalue') || Yii::app()->request->getPost('attvalue')=="0"))
{
$iAttributeId = explode("_", Yii::app()->request->getPost('id'));
$aData = array('participant_id' => Yii::app()->request->getPost('participant_id'), 'attribute_id' => $iAttributeId[1], 'value' => Yii::app()->request->getPost('attvalue'));
Expand Down
2 changes: 1 addition & 1 deletion application/models/ParticipantAttributeNames.php
Expand Up @@ -396,7 +396,7 @@ function saveAttributeLanguages($data)

function storeAttributeValues($data)
{
foreach ($data as $record) {
foreach ($data as $record) {
Yii::app()->db->createCommand()->insert('{{participant_attribute_values}}',$record);
}
}
Expand Down

0 comments on commit 008e293

Please sign in to comment.