|
|
@ -590,6 +590,44 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|
|
|
$form[ '#submit' ] = 'fulcrm_shoppingcart_buy_eventbookingtype_person_add_guest_form_submit';
|
|
|
|
$form[ '#submit' ] = 'fulcrm_shoppingcart_buy_eventbookingtype_person_add_guest_form_submit';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form[ 'eventslots' ] = array( '#title' => 'Options',
|
|
|
|
|
|
|
|
'#type' => 'fieldset',
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$eventslots = array();
|
|
|
|
|
|
|
|
$eventpart = array();
|
|
|
|
|
|
|
|
foreach ( $eventbookingtype[ 'event' ][ 'eventparts' ] as $eventpart ) {
|
|
|
|
|
|
|
|
$eventparts[ $eventpart[ 'id' ] ] = $eventpart;
|
|
|
|
|
|
|
|
foreach ( $eventpart[ 'eventslots' ] as $eventslot ) {
|
|
|
|
|
|
|
|
$eventslots[ $eventslot[ 'id' ] ] = $eventslot;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ( $eventbookingtype[ 'eventbookingtypeslots' ] as $ebts ) {
|
|
|
|
|
|
|
|
$eventslot = $ebts[ 'eventslot' ];
|
|
|
|
|
|
|
|
$eventpart_id = fulcrm_apiv2_url_to_pk( $eventslot[ 'eventpart' ] );
|
|
|
|
|
|
|
|
if ( !array_key_exists( $eventpart_id, $form[ 'eventslots' ] ) )
|
|
|
|
|
|
|
|
$form[ 'eventslots' ][ $eventpart_id ] = array( '#type' => 'radios',
|
|
|
|
|
|
|
|
'#title' => $eventparts[ $eventpart_id ][ 'name' ],
|
|
|
|
|
|
|
|
'#options' => array(),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$eventslot_id = fulcrm_crypto_object_id_form_value( 'eventslot.id', $eventslot[ 'id' ] );
|
|
|
|
|
|
|
|
$form[ 'eventslots' ][ $eventpart_id ][ '#options' ][ $eventslot_id ] = $eventslot[ 'name' ];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
foreach ( $eventpart[ '#options' ] as $option_key => $option_value ) {
|
|
|
|
|
|
|
|
$eventslot_id = fulcrm_crypto_get_object_id_form_value( 'eventslot.id', $option_key );
|
|
|
|
|
|
|
|
if ( $eventslot_id && !fulcrm_shoppingcart_eventslot_has_capacity( $eventslot_id ) ) {
|
|
|
|
|
|
|
|
unset( $eventpart[ '#options' ][ $option_key ] );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
|
$form[ 'actions' ][ 'submit' ] = array( '#type' => 'submit',
|
|
|
|
$form[ 'actions' ][ 'submit' ] = array( '#type' => 'submit',
|
|
|
|
'#value' => t('Add to Cart'),
|
|
|
|
'#value' => t('Add to Cart'),
|
|
|
@ -793,7 +831,10 @@ function fulcrm_shoppingcart_buy( $product_id, $hmac ) {
|
|
|
|
'person_ddatacollection',
|
|
|
|
'person_ddatacollection',
|
|
|
|
'eventbooking_ddatacollection',
|
|
|
|
'eventbooking_ddatacollection',
|
|
|
|
'eventbookingtypeslots',
|
|
|
|
'eventbookingtypeslots',
|
|
|
|
'eventbookingtypeslots.eventslot' ) ) ) );
|
|
|
|
'eventbookingtypeslots.eventslot',
|
|
|
|
|
|
|
|
'event',
|
|
|
|
|
|
|
|
'event.eventparts',
|
|
|
|
|
|
|
|
'event.eventparts.eventslots' ) ) ) );
|
|
|
|
if ( !$eventbookingtype_data[ 'success' ] ) {
|
|
|
|
if ( !$eventbookingtype_data[ 'success' ] ) {
|
|
|
|
return 'error while fetching information about your booking!';
|
|
|
|
return 'error while fetching information about your booking!';
|
|
|
|
}
|
|
|
|
}
|
|
|
|