|
|
@ -104,6 +104,14 @@ function fulcrm_shoppingcart_buy_url( $product_id ) {
|
|
|
|
return url( 'fulcrm/buy/' . $product_id . '/' . $hmac );
|
|
|
|
return url( 'fulcrm/buy/' . $product_id . '/' . $hmac );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _fulcrm_shoppingcart_person_id_hmac( $person_id ) {
|
|
|
|
|
|
|
|
return drupal_hmac_base64( 'fulcrm:' . strval( $person_id ) . ':person_id', session_id() . drupal_get_hash_salt() );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_state ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $person, $eventbookingtype, $product ) {
|
|
|
|
function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $person, $eventbookingtype, $product ) {
|
|
|
|
$form = array();
|
|
|
|
$form = array();
|
|
|
|
|
|
|
|
|
|
|
@ -118,26 +126,26 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if ( array_key_exists( 'id', $person ) )
|
|
|
|
if ( array_key_exists( 'id', $person ) )
|
|
|
|
$persons = array( $person[ 'id' ] => 'myself' );
|
|
|
|
$persons = array( _fulcrm_shoppingcart_person_id_hmac( $person[ 'id' ] ) => 'myself' );
|
|
|
|
else
|
|
|
|
else
|
|
|
|
$persons = array( 0 => 'myself' );
|
|
|
|
$persons = array( 'myself' => 'myself' );
|
|
|
|
|
|
|
|
|
|
|
|
if ( array_key_exists( 'related_from_person2persons', $person ) ) {
|
|
|
|
if ( array_key_exists( 'related_from_person2persons', $person ) ) {
|
|
|
|
foreach ( $person[ 'related_from_person2persons' ] as $p2p ) {
|
|
|
|
foreach ( $person[ 'related_from_person2persons' ] as $p2p ) {
|
|
|
|
$persons[ $p2p[ 'related_from' ][ 'id' ] ] = $p2p[ 'related_from' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
|
|
|
$persons[ _fulcrm_shoppingcart_person_id_hmac( $p2p[ 'related_from' ][ 'id' ] ) ] = $p2p[ 'related_from' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( array_key_exists( 'related_to_person2persons', $person ) ) {
|
|
|
|
if ( array_key_exists( 'related_to_person2persons', $person ) ) {
|
|
|
|
foreach ( $person[ 'related_to_person2persons' ] as $p2p ) {
|
|
|
|
foreach ( $person[ 'related_to_person2persons' ] as $p2p ) {
|
|
|
|
$persons[ $p2p[ 'related_to' ][ 'id' ] ] = $p2p[ 'related_to' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
|
|
|
$persons[ _fulcrm_shoppingcart_person_id_hmac( $p2p[ 'related_to' ][ 'id' ] ) ] = $p2p[ 'related_to' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$form[ 'tickets_for_persons' ] = array( '#type' => 'checkboxes',
|
|
|
|
$form[ 'ticket_for_persons' ] = array( '#type' => 'checkboxes',
|
|
|
|
'#title' => 'Who is coming to the event?',
|
|
|
|
'#title' => 'Who is coming to the event?',
|
|
|
|
'#description' => 'Tick the box next to each person for whom you want to buy a ticket.',
|
|
|
|
'#description' => 'Tick the box next to each person for whom you want to buy a ticket.',
|
|
|
|
'#options' => $persons,
|
|
|
|
'#options' => $persons,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$form[ 'tickets_for_others' ] = array( '#type' => 'select',
|
|
|
|
$form[ 'tickets_for_others' ] = array( '#type' => 'select',
|
|
|
|
'#title' => 'How many tickets would you like for other people?',
|
|
|
|
'#title' => 'How many tickets would you like for other people?',
|
|
|
|
'#description' => 'Choose how many tickets you are getting for other people. You\'ll be asked their names soon.',
|
|
|
|
'#description' => 'Choose how many tickets you are getting for other people. You\'ll be asked their names soon.',
|
|
|
@ -149,12 +157,11 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
$form[ 'person' ] = array( '#type' => 'markup',
|
|
|
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
|
|
|
'#markup' => '<pre>' . print_r( $person, 1 ) . '</pre>' );
|
|
|
|
$form[ 'actions' ][ 'save' ] = array( '#type' => 'submit',
|
|
|
|
$form[ 'eventbookingtype' ] = array( '#type' => 'markup',
|
|
|
|
'#value' => t('Add to Basket'),
|
|
|
|
'#markup' => '<pre>' . print_r( $eventbookingtype, 1 ) . '</pre>' );
|
|
|
|
'#submit' => array( 'fulcrm_shoppingcart_buy_eventbookingtype_form_submit' ),
|
|
|
|
$form[ 'product' ] = array( '#type' => 'markup',
|
|
|
|
);
|
|
|
|
'#markup' => '<pre>' . print_r( $product, 1 ) . '</pre>' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $form;
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
}
|
|
|
|