Couple of tweaks to travel form
This commit is contained in:
@@ -106,7 +106,8 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
|||||||
{
|
{
|
||||||
$booking_dietary = $person->booking_dietary;
|
$booking_dietary = $person->booking_dietary;
|
||||||
$booking_medical_conditions = $person->booking_medical_conditions;
|
$booking_medical_conditions = $person->booking_medical_conditions;
|
||||||
$booking_bf_gf_nid = $person->booking_bf_gf_nid;
|
//an empty value is zero in this case
|
||||||
|
$booking_bf_gf_nid = $person->booking_bf_gf_nid == 0 ? '' : $person->booking_bf_gf_nid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transport_type_options = array(
|
$transport_type_options = array(
|
||||||
@@ -332,7 +333,7 @@ function travel_form_submit($form, &$form_state) {
|
|||||||
global $event;
|
global $event;
|
||||||
$values = $form_state['input'];
|
$values = $form_state['input'];
|
||||||
|
|
||||||
watchdog('booking', 'Submitting travel form: @info', array('@info' => var_export($values, TRUE)));
|
//watchdog('booking', 'Submitting travel form: @info', array('@info' => var_export($values, TRUE)));
|
||||||
|
|
||||||
//check that $values['personid'] is a number
|
//check that $values['personid'] is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $values['personid'])) {
|
if (! preg_match('/^[0-9]+$/', $values['personid'])) {
|
||||||
@@ -379,7 +380,7 @@ function travel_form_submit($form, &$form_state) {
|
|||||||
$node->booking_medical_conditions = $values['booking_medical_conditions'];
|
$node->booking_medical_conditions = $values['booking_medical_conditions'];
|
||||||
$node->booking_bf_gf_nid = empty($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid'];
|
$node->booking_bf_gf_nid = empty($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid'];
|
||||||
|
|
||||||
watchdog('booking', "<pre>Travel data to save:\n@info</pre>", array('@info' => print_r( $node, true)));
|
//watchdog('booking', "<pre>Travel data to save:\n@info</pre>", array('@info' => print_r( $node, true)));
|
||||||
|
|
||||||
//store the node
|
//store the node
|
||||||
$foo = node_submit(&$node);
|
$foo = node_submit(&$node);
|
||||||
@@ -424,7 +425,8 @@ function travel_load($nodes) {
|
|||||||
|
|
||||||
function travel_insert($node)
|
function travel_insert($node)
|
||||||
{
|
{
|
||||||
watchdog('booking', 'Inserting travel form: @info', array('@info' => var_export($node, TRUE)));
|
//watchdog('booking', 'Inserting travel form: @info', array('@info' => var_export($node, TRUE)));
|
||||||
|
|
||||||
db_insert('booking_travel')
|
db_insert('booking_travel')
|
||||||
->fields(array(
|
->fields(array(
|
||||||
'tid' => $node->nid,
|
'tid' => $node->nid,
|
||||||
@@ -443,8 +445,6 @@ function travel_insert($node)
|
|||||||
))
|
))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
watchdog('booking', 'booking_travel table completed.');
|
|
||||||
|
|
||||||
//update the booking_person fields
|
//update the booking_person fields
|
||||||
db_update('booking_person')
|
db_update('booking_person')
|
||||||
->fields(array(
|
->fields(array(
|
||||||
@@ -454,8 +454,6 @@ function travel_insert($node)
|
|||||||
))
|
))
|
||||||
->condition('nid', $node->booking_person_nid)
|
->condition('nid', $node->booking_person_nid)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
watchdog('booking', 'booking_person table completed.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function travel_update($node)
|
function travel_update($node)
|
||||||
|
Reference in New Issue
Block a user