now showing both login form and add-new-person form side-by-side

master
Marek Isalski 6 years ago
parent 16974ef4c0
commit 64ec097b4c

@ -466,10 +466,14 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
// $form[ 'person' ] = fulcrm_collection_to_form( 'person', $eventbookingtype[ 'person_ddatacollection' ], $person[ 'd' ] );
if ( array_key_exists( 'name', $person ) )
$persons = array( 'myself' => $person[ 'name' ] . ' (myself)' );
else
$persons = array( 'myself' => '(myself)' );
if ( array_key_exists( 'url', $person ) ) {
if ( array_key_exists( 'name', $person ) )
$persons = array( 'myself' => $person[ 'name' ] . ' (myself)' );
else
$persons = array( 'myself' => '(myself)' );
} else {
$persons = array();
}
if ( array_key_exists( 'related_from_person2persons', $person ) ) {
foreach ( $person[ 'related_from_person2persons' ] as $p2p ) {
@ -484,11 +488,21 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
}
}
$form[ 'ticket_for_persons' ] = array( '#type' => 'checkboxes',
'#title' => 'Who is coming to the event? (<a href="' . url( 'fulcrm/cart/person/add/' . $eventbookingtype[ 'person_ddatacollection' ][ 'id' ] . '/' . fulcrm_crypto_object_id_hmac( 'collection', $eventbookingtype[ 'person_ddatacollection' ][ 'id' ] ), $options = array( 'query' => array( 'destination' => fulcrm_shoppingcart_buy_url( $product[ 'id' ] ) ) ) ) . '">add a new person to this list</a>)',
'#description' => 'Tick the box next to each person for whom you want to buy a ticket.',
'#options' => $persons,
);
if ( $persons ) {
$form[ 'ticket_for_persons' ] = array( '#type' => 'checkboxes',
'#title' => 'Who is coming to the event? (<a href="' . url( 'fulcrm/cart/person/add/' . $eventbookingtype[ 'person_ddatacollection' ][ 'id' ] . '/' . fulcrm_crypto_object_id_hmac( 'collection', $eventbookingtype[ 'person_ddatacollection' ][ 'id' ] ), $options = array( 'query' => array( 'destination' => fulcrm_shoppingcart_buy_url( $product[ 'id' ] ) ) ) ) . '">add a new person to this list</a>)',
'#description' => 'Tick the box next to each person for whom you want to buy a ticket.',
'#options' => $persons,
);
} else {
if ( $eventbookingtype[ 'person_ddatacollection' ] ) {
$collection_id = $eventbookingtype[ 'person_ddatacollection' ][ 'id' ];
$collection_data = fulcrm_apiv2_GET( 'ddatacollection/' . $collection_id . '/' );
if ( $collection_data[ 'success' ] ) {
$form[ 'new_person' ] = fulcrm_collection_to_form( 'person', $collection_data[ 'data' ], array() );
}
}
}
$form[ 'actions' ] = array( '#type' => 'actions' );
$form[ 'actions' ][ 'submit' ] = array( '#type' => 'submit',
@ -514,28 +528,24 @@ function fulcrm_shoppingcart_buy_eventbookingtype( $person, $eventbookingtype, $
$fulcrm_shoppingcart_buy_eventbookingtype_form = drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person, $eventbookingtype, $product );
return theme( 'fulcrm_shoppingcart_buy_eventbookingtype', array( 'fulcrm_shoppingcart_buy_eventbookingtype_form' => $fulcrm_shoppingcart_buy_eventbookingtype_form, 'user_login_form' => $user_login_form ) );
} else {
return 'ZZZ'; // drupal_render( something );
}
break;
case 'force':
if ( user_is_anonymous() ) {
drupal_set_message( t('You need to be logged in to continue shopping.'), 'error' ); // XXX change to be on form
drupal_set_message( t('<strong>Sorry</strong>, but you need to be logged in to continue shopping.'), 'error' ); // XXX change to be on form
$form = user_login( $form, $form_state );
$form_state[ 'fulcrm_shoppingcart' ][ 'redirect_buy_product_id' ] = $product[ 'id' ];
$form[ '#submit' ][] = 'fulcrm_shoppingcart_buy_eventbookingtype_login_form_submit';
return 'XXX'; // drupal_render( $form );
return drupal_render( $form );
} else {
drupal_set_message( t('Sorry! There was a problem looking up your record, and this means we cannot complete this order.'), 'error' );
return 'YYY'; // drupal_render( $form );
}
break;
}
}
return drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person_data[ 'data' ], $eventbookingtype_data[ 'data' ], $product_data[ 'data' ] );
$form = drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person, $eventbookingtype, $product );
return druapl_render( $form );
}
function fulcrm_shoppingcart_buy_generic_product_form_submit( $form, &$form_state ) {

@ -15,7 +15,7 @@
</div>
<div class="col hide-xs col-md-1"></div>
<div class="col col-xs-12 col-md-7">
<div class="panel panel-default">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Or continue your order by providing some details&hellip;</h3></div>
<div class="panel-body">
<?php print drupal_render( $fulcrm_shoppingcart_buy_eventbookingtype_form ); ?>

Loading…
Cancel
Save