fetch ddatacollection information and use fulcrm_collection to show it
This commit is contained in:
parent
0292445e5e
commit
41984d4926
@ -117,23 +117,30 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
|
|||||||
|
|
||||||
if ( is_array( $cart ) ) {
|
if ( is_array( $cart ) ) {
|
||||||
if ( $person_uuid ) {
|
if ( $person_uuid ) {
|
||||||
$api_data = fulcrm_apiv2_PATCH( $cart[ 'url' ], array( 'd' => array( 'fulcrm' => array( 'transaction' => array( 'person' => $person_uuid,
|
$api_data = fulcrm_apiv2_PATCH( $cart[ 'url' ],
|
||||||
|
array( 'd' => array( 'fulcrm' => array( 'transaction' => array( 'person' => $person_uuid,
|
||||||
|
),
|
||||||
|
'person' => array( $person_uuid => array() ),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
) );
|
$query = array( 'expand' => 'd' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// $cart[ 'd' ][ 'fulcrm' ][ 'person' ] = array( $uuid => array() );
|
// $cart[ 'd' ][ 'fulcrm' ][ 'person' ] = array( $uuid => array() );
|
||||||
// $cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ] = $uuid;
|
// $cart[ 'd' ][ 'fulcrm' ][ 'transaction' ][ 'person' ] = $uuid;
|
||||||
|
|
||||||
|
foreach ( $form_state[ 'values' ][ 'ticket_for_persons' ] as $ticket_for_person ) {
|
||||||
|
$person_uuid = fulcrm_crypto_get_object_id_form_value( 'person.uuid', $ticket_for_person );
|
||||||
|
|
||||||
|
if ( $person_uuid ) {
|
||||||
$item = array( 'shoppingcart' => $cart[ 'url' ],
|
$item = array( 'shoppingcart' => $cart[ 'url' ],
|
||||||
'product' => fulcrm_apiv2_make_url( 'product', $product_id ),
|
'product' => fulcrm_apiv2_make_url( 'product', $product_id ),
|
||||||
'quantity' => 1.0,
|
'quantity' => 1.0,
|
||||||
'd' => array( 'fulcrm' => array( 'eventbooking' => array( 'eventbooking' => array( 'foo' => 'bar',
|
'd' => array( 'fulcrm' => array( 'eventbooking' => array( 'eventbooking' => array( 'foo' => 'bar',
|
||||||
),
|
),
|
||||||
// 'eventslotbookings' => array( $part => $slot )
|
// 'eventslotbookings' => array( $part => $slot )
|
||||||
// 'person' => $uuid,
|
'person' => $person_uuid,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'name' => $form_state[ 'values' ][ 'shoppingitem_name' ],
|
'name' => $form_state[ 'values' ][ 'shoppingitem_name' ],
|
||||||
@ -147,6 +154,8 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form_submit( $form, &$form_sta
|
|||||||
} else {
|
} else {
|
||||||
drupal_set_message( t('There was a problem adding your item to the shopping cart.'), 'error' );
|
drupal_set_message( t('There was a problem adding your item to the shopping cart.'), 'error' );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
drupal_set_message( t('There was a problem adding your item to the shopping cart.'), 'error' );
|
drupal_set_message( t('There was a problem adding your item to the shopping cart.'), 'error' );
|
||||||
}
|
}
|
||||||
@ -180,6 +189,8 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|||||||
'#value' => fulcrm_crypto_object_id_form_value( 'person.uuid', $person[ 'uuid' ] ) );
|
'#value' => fulcrm_crypto_object_id_form_value( 'person.uuid', $person[ 'uuid' ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form[ 'test' ] = fulcrm_collection_to_form( $eventbookingtype[ 'person_ddatacollection' ] );
|
||||||
|
|
||||||
if ( array_key_exists( 'id', $person ) )
|
if ( array_key_exists( 'id', $person ) )
|
||||||
$persons = array( fulcrm_crypto_object_id_hmac( 'person', $person[ 'id' ] ) => 'myself' );
|
$persons = array( fulcrm_crypto_object_id_hmac( 'person', $person[ 'id' ] ) => 'myself' );
|
||||||
else
|
else
|
||||||
@ -187,12 +198,12 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
|
|||||||
|
|
||||||
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[ fulcrm_crypto_object_id_hmac( 'person', $p2p[ 'related_from' ][ 'id' ] ) ] = $p2p[ 'related_from' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
$persons[ fulcrm_crypto_object_id_hmac( 'person.uuid', $p2p[ 'related_from' ][ 'uuid' ] ) ] = $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[ fulcrm_crypto_object_id_hmac( 'person', $p2p[ 'related_to' ][ 'id' ] ) ] = $p2p[ 'related_to' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
$persons[ fulcrm_crypto_object_id_hmac( 'person.uuid', $p2p[ 'related_to' ][ 'uuid' ] ) ] = $p2p[ 'related_to' ][ 'name' ] . ' (your ' . $p2p[ 'relationship' ][ 'name' ] . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +270,9 @@ function fulcrm_shoppingcart_buy( $product_id, $hmac ) {
|
|||||||
switch ( fulcrm_apiv2_url_to_type( $product_data[ 'data' ][ 'content_object' ][ 'url' ] ) ) {
|
switch ( fulcrm_apiv2_url_to_type( $product_data[ 'data' ][ 'content_object' ][ 'url' ] ) ) {
|
||||||
case 'eventbookingtype':
|
case 'eventbookingtype':
|
||||||
$eventbookingtype_data = fulcrm_apiv2_GET( $product_data[ 'data' ][ 'content_object' ][ 'url' ],
|
$eventbookingtype_data = fulcrm_apiv2_GET( $product_data[ 'data' ][ 'content_object' ][ 'url' ],
|
||||||
$query = array( 'expand' => implode( ',', array( 'event' ) ) ) );
|
$query = array( 'expand' => implode( ',', array( 'event',
|
||||||
|
'person_ddatacollection',
|
||||||
|
'eventbooking_ddatacollection' ) ) ) );
|
||||||
if ( $eventbookingtype_data[ 'success' ] ) {
|
if ( $eventbookingtype_data[ 'success' ] ) {
|
||||||
return drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person_data[ 'data' ], $eventbookingtype_data[ 'data' ], $product_data[ 'data' ] );
|
return drupal_get_form( 'fulcrm_shoppingcart_buy_eventbookingtype_form', $person_data[ 'data' ], $eventbookingtype_data[ 'data' ], $product_data[ 'data' ] );
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><?php if ( array_key_exists( 'name', $item[ 'd' ] ) ) print nl2br( check_plain( $item[ 'd' ][ 'name' ] ) ); else print check_plain( $item[ 'product' ][ 'name' ] ); ?></td>
|
<td><span class="pull-right"><a class="btn btn-xs btn-danger" title="Remove from cart" href=""><span class="glyphicon glyphicon-trash"></span></a></span><?php if ( array_key_exists( 'name', $item[ 'd' ] ) ) print nl2br( check_plain( $item[ 'd' ][ 'name' ] ) ); else print check_plain( $item[ 'product' ][ 'name' ] ); ?></td>
|
||||||
<td><?php print check_plain( $item[ 'product' ][ '_price' ][ 'format_total_net' ] ); ?></td>
|
<td class="text-right"><?php print check_plain( $item[ 'product' ][ '_price' ][ 'format_total_net' ] ); ?></td>
|
||||||
<td><?php print check_plain( $item[ 'quantity' ] ); ?></td>
|
<td class="text-right"><?php print check_plain( $item[ 'quantity' ] ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user