From cf2bdabbea793a49e18c8a7cdde7bcb0f35bbc21 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Thu, 7 Mar 2019 10:31:39 +0100 Subject: [PATCH] default to self if only self to make bookings for --- fulcrm_shoppingcart.module | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/fulcrm_shoppingcart.module b/fulcrm_shoppingcart.module index 0ce7884..af2dcc9 100644 --- a/fulcrm_shoppingcart.module +++ b/fulcrm_shoppingcart.module @@ -456,7 +456,7 @@ function _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( &$form_s drupal_set_message( t('There was a problem adding your item to the shopping cart.'), 'error' ); } } else { - /* drupal_set_message( t('Cannot find your record\'s UUID. This order might have problems...'), 'error' ); */ + drupal_set_message( t('Cannot find your record\'s UUID. This order might have problems...'), 'error' ); } } @@ -540,10 +540,12 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta $made_choices = $made_choices ); } } else { - $person = $cart[ 'd' ][ 'fulcrm' ][ 'person' ][ $person_uuid ]; - _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart, - $person_uuid, $person[ 'name' ], $product_id, - $made_choices = $made_choices ); + if ( $person_uuid ) { + $person = $cart[ 'd' ][ 'fulcrm' ][ 'person' ][ $person_uuid ]; + _fulcrm_shoppingcart_buy_eventbookingtype_create_shoppingitem( $form_state, $cart, + $person_uuid, $person[ 'name' ], $product_id, + $made_choices = $made_choices ); + } } if ( !empty( $ac ) ) { @@ -674,6 +676,11 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe $form[ '#submit' ] = 'fulcrm_shoppingcart_buy_eventbookingtype_person_add_guest_form_submit'; } + if ( count( $form[ 'ticket_for_persons' ][ '#options' ] ) == 1 ) { + foreach ( $form[ 'ticket_for_persons' ][ '#options' ] as $k => $v ) + $form[ 'ticket_for_persons' ][ '#default_value' ] = $k; + } + $form[ 'eventslots' ] = array(); $eventslots = array(); $eventpart = array();