working with multiple guest purchases

master
Marek Isalski 7 years ago
parent 67215e6e7e
commit cd6323a4c5

@ -427,25 +427,23 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
if ( array_key_exists( 'ticket_for_persons', $form_state[ 'values' ] ) ) { if ( array_key_exists( 'ticket_for_persons', $form_state[ 'values' ] ) ) {
foreach ( $form_state[ 'values' ][ 'ticket_for_persons' ] as $ticket_for_person ) { foreach ( $form_state[ 'values' ][ 'ticket_for_persons' ] as $ticket_for_person ) {
$person_name = 'unnamed person'; $add_person_name = 'unnamed person';
if ( $ticket_for_person === 'myself' ) { if ( $ticket_for_person === 'myself' ) {
$person_uuid = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'uuid' ]; $add_person_uuid = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'uuid' ];
$person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'name' ]; $add_person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'person' ][ 'name' ];
} else { } else {
$person_uuid = fulcrm_crypto_get_object_id_form_value( 'person.uuid', $ticket_for_person ); $add_person_uuid = fulcrm_crypto_get_object_id_form_value( 'person.uuid', $ticket_for_person );
if ( $person_uuid ) if ( $add_person_uuid )
$person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'persons' ][ $person_uuid ][ 'name' ]; $add_person_name = $form_state[ 'fulcrm_shoppingcart' ][ 'persons' ][ $add_person_uuid ][ 'name' ];
} }
_fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart, _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart,
$person_uuid, $person_name, $product_id ); $add_person_uuid, $add_person_name, $product_id );
} }
} else { } else {
$person = $cart[ 'd' ][ 'fulcrm' ][ 'person' ][ $cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ] ]; $person = $cart[ 'd' ][ 'fulcrm' ][ 'person' ][ $person_uuid ];
_fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart, _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart,
$cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ], $person_uuid, $person[ 'name' ], $product_id );
$person[ 'name' ],
$product_id );
} }
} else { } else {

Loading…
Cancel
Save