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

Loading…
Cancel
Save