diff --git a/booking.regn_node.inc b/booking.regn_node.inc index c102665..e2a1e94 100644 --- a/booking.regn_node.inc +++ b/booking.regn_node.inc @@ -384,6 +384,8 @@ function booking_update($node) { global $event; $data = array(); + //TODO: make sure these exclusions match with admin selected options (eg passport details) + //these fields should be stored in the database as Y or N, but come back from the FAPI as 1 or 0 $boolean_keys = array('booking_baptised', 'booking_married', 'booking_help_praying', 'booking_help_meditations', 'booking_help_reading', 'booking_help_chairing', 'booking_help_readgroup_lead', 'booking_help_discussgroup_lead', 'booking_lifesaver', @@ -411,19 +413,20 @@ function booking_update($node) { foreach ($node as $key => $value) { //check if the key is a field that belongs in the database if ((strpos($key, "booking_") === 0) || $key === "nid") { - //do we need to treat this field carefully? - if (strpos($key, "booking_dob") === 0) { + //what special handling does this field need? + //handle dates properly + if ((strpos($key, "booking_dob") === 0) || (strpos($key, "booking_passport_issue_date") === 0)) { $data[$key] = _date_to_ts($value); } + elseif (in_array($key, $excluded_keys, FALSE)) { + //skip these fields from the update of booking_person + } elseif (in_array($key, $boolean_keys, FALSE)) { $data[$key] = $value == 1 ? 'Y' : 'N'; } elseif (in_array($key, $default_zero_keys, FALSE)) { $data[$key] = $value == '' ? 0 : $value; } - elseif (in_array($key, $excluded_keys, FALSE)) { - //skip these fields from the update of booking_person - } else { $data[$key] = _booking_remove_emoji($value); }