fill in eventslotbookings when ordering (currently doesn't give choice)

master
Marek Isalski 9 years ago
parent c6c655cdea
commit db43364b17

@ -143,9 +143,6 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
$query = array( 'expand' => 'd' ) );
}
// $cart[ 'd' ][ 'fulcrm' ][ 'person' ] = array( $uuid => array() );
// $cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ] = $uuid;
foreach ( $form_state[ 'values' ][ 'ticket_for_persons' ] as $ticket_for_person ) {
if ( $ticket_for_person === 'myself' ) {
$person_uuid = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'uuid' ];
@ -160,14 +157,23 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
$form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'name' ] . "\r\n" .
$form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'event' ][ 'name' ] );
$eventslotbookings = array();
foreach ( $form_state[ 'fulcrm_shoppingcart' ][ 'eventbookingtype' ][ 'eventslotbookings' ] as $eventslotbooking ) {
$eventpart_id = fulcrm_apiv2_url_to_pk( $eventslotbooking[ 'eventslot' ][ 'eventpart' ] );
$eventslot_id = fulcrm_apiv2_url_to_pk( $eventslotbooking[ 'eventslot' ][ 'url' ] );
if ( array_key_exists( $eventpart_id, $eventslotbookings ) )
drupal_set_message( 'XXX cannot yet cope with multiple choice event slot bookings; defaulting to first.', 'warning' );
$eventslotbookings[ $eventpart_id ] = $eventslot_id;
}
if ( $person_uuid ) {
$item = array( 'shoppingcart' => $cart[ 'url' ],
'product' => fulcrm_apiv2_make_url( 'product', $product_id ),
'quantity' => 1.0,
'd' => array( 'fulcrm' => array( 'eventbooking' => array( 'eventbooking' => array( 'foo' => 'bar',
),
// 'eventslotbookings' => array( $part => $slot )
'd' => array( 'fulcrm' => array( 'eventbooking' => array( 'eventbooking' => array(),
'eventslotbookings' => $eventslotbookings,
'person' => $person_uuid,
),
),
@ -292,7 +298,9 @@ function fulcrm_shoppingcart_buy( $product_id, $hmac ) {
$eventbookingtype_data = fulcrm_apiv2_GET( $product_data[ 'data' ][ 'content_object' ][ 'url' ],
$query = array( 'expand' => implode( ',', array( 'event',
'person_ddatacollection',
'eventbooking_ddatacollection' ) ) ) );
'eventbooking_ddatacollection',
'eventbookingtypeslots',
'eventbookingtypeslots.eventslot' ) ) ) );
if ( $eventbookingtype_data[ 'success' ] ) {
return drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person_data[ 'data' ], $eventbookingtype_data[ 'data' ], $product_data[ 'data' ] );
}
@ -319,7 +327,6 @@ function fulcrm_shoppingcart_remove_shoppingitem_confirm_submit( $form, &$form_s
$form_state[ 'redirect' ] = 'fulcrm/cart';
}
function fulcrm_shoppingcart_remove_shoppingitem_confirm( $form, &$form_state, $shoppingitem ) {
$form_state[ 'fulcrm_shoppingcart' ][ 'shoppingitem' ] = $shoppingitem;

Loading…
Cancel
Save