|
|
|
@ -401,25 +401,9 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
|
|
|
|
|
$form_state[ 'fulcrm_shoppingcart' ][ 'shoppingcart' ] = $cart;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_login_form_submit( $form, &$form_state ) {
|
|
|
|
|
user_login_submit( $form, $form_state );
|
|
|
|
|
$form_state[ 'redirect' ] = fulcrm_shoppingcart_buy_url( $form_state[ 'fulcrm_shoppingcart' ][ 'redirect_buy_product_id' ] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_login_or_add_person_form_submit( $form, &$form_state ) {
|
|
|
|
|
if ( array_key_exists( 'submit', $form_state[ 'values' ] ) ) {
|
|
|
|
|
$action = $form_state[ 'values' ][ 'submit' ];
|
|
|
|
|
|
|
|
|
|
if ( $action === 'Log in' ) {
|
|
|
|
|
user_login_submit( $form, $form_state );
|
|
|
|
|
$form_state[ 'redirect' ] = fulcrm_shoppingcart_buy_url( $form_state[ 'fulcrm_shoppingcart' ][ 'redirect_buy_product_id' ] );
|
|
|
|
|
} elseif ( $action === 'XXX' ) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_guest_add_person_form_submit( $form, &$form_state ) {
|
|
|
|
|
die( print_r( $form_state[ 'values' ], 1 ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $person, $eventbookingtype, $product ) {
|
|
|
|
|
$form = array();
|
|
|
|
@ -502,6 +486,7 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|
|
|
|
$form[ 'new_person' ] = fulcrm_collection_to_form( 'person', $collection_data[ 'data' ], array() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$form[ '#submit' ] = 'fulcrm_shoppingcart_buy_eventbookingtype_guest_add_person_form_submit';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
|
@ -513,6 +498,27 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|
|
|
|
return $form;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _fulcrm_shoppingcart_drupal_get_form_with_form_state( $form_id, $form_state ) {
|
|
|
|
|
$args = func_get_args();
|
|
|
|
|
|
|
|
|
|
array_shift( $args ); // Remove $form_id from the arguments.
|
|
|
|
|
array_shift( $args ); // Remove $form_state from the arguments.
|
|
|
|
|
$form_state[ 'build_info' ][ 'args' ] = $args;
|
|
|
|
|
return drupal_build_form( $form_id, $form_state );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_login_form_submit( $form, &$form_state ) {
|
|
|
|
|
user_login_submit( $form, $form_state );
|
|
|
|
|
$form_state[ 'redirect' ] = fulcrm_shoppingcart_buy_url( $form_state[ 'fulcrm_shoppingcart' ][ 'redirect_buy_product_id' ] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_login_form( $form, &$form_state, $product_id ) {
|
|
|
|
|
$form = user_login( $form, $form_state );
|
|
|
|
|
$form_state[ 'fulcrm_shoppingcart' ][ 'redirect_buy_product_id' ] = $product_id;
|
|
|
|
|
//$form[ 'actions' ][ 'submit' ][ '#submit' ] = array( 'fulcrm_shoppingcart_buy_eventbookingtype_login_form_submit' );
|
|
|
|
|
return $form;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype( $person, $eventbookingtype, $product ) {
|
|
|
|
|
$person_id = NULL;
|
|
|
|
|
if ( array_key_exists( 'id', $person ) )
|
|
|
|
@ -523,7 +529,7 @@ function fulcrm_shoppingcart_buy_eventbookingtype( $person, $eventbookingtype, $
|
|
|
|
|
case 'guest':
|
|
|
|
|
case 'user':
|
|
|
|
|
if ( user_is_anonymous() ) {
|
|
|
|
|
$user_login_form = drupal_get_form( 'user_login' );
|
|
|
|
|
$user_login_form = drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_login_form', $product_id = $product[ 'id' ] );
|
|
|
|
|
|
|
|
|
|
$fulcrm_shoppingcart_buy_eventbookingtype_form = drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person, $eventbookingtype, $product );
|
|
|
|
|
|
|
|
|
@ -545,7 +551,7 @@ function fulcrm_shoppingcart_buy_eventbookingtype( $person, $eventbookingtype, $
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$form = drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person, $eventbookingtype, $product );
|
|
|
|
|
return druapl_render( $form );
|
|
|
|
|
return drupal_render( $form );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_generic_product_form_submit( $form, &$form_state ) {
|
|
|
|
|