fixup auto-check single options

master
Marek Isalski 6 years ago
parent 5f8b5286f3
commit 3b476d3868

@ -582,6 +582,7 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
$form[ 'eventslots' ][ $eventpart_key ] = array( '#type' => 'radios',
'#title' => $eventparts[ $eventpart_id ][ 'name' ],
'#options' => array(),
'#required' => TRUE,
);
$eventslot_id = fulcrm_crypto_object_id_form_value( 'eventslot.id', $eventslot[ 'id' ] );
$remaining_capacity = $eventslot[ '_remaining_capacity' ];
@ -590,10 +591,10 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
}
$choices = false;
foreach ( $form[ 'eventslots' ] as $eventpart_id => $eventpart ) {
if ( count( $eventpart[ '#options' ] ) == 1 ) {
foreach ( $eventpart[ '#options' ] as $option_key => $option_value )
$eventpart[ '#default_value' ] = $option_key;
foreach ( $form[ 'eventslots' ] as $eventpart_id => $eventpart_form ) {
if ( count( $eventpart_form[ '#options' ] ) == 1 ) {
foreach ( $eventpart_form[ '#options' ] as $option_key => $option_value )
$form[ 'eventslots' ][ $eventpart_id ][ '#default_value' ] = $option_key;
} else {
$choices = true;
}

Loading…
Cancel
Save